From 752af31947114d88a2994ee6435c94ed9643f76a Mon Sep 17 00:00:00 2001 From: Parshad Patel Date: Fri, 30 Nov 2018 20:15:11 +0900 Subject: Rename test classes in apex-pdp Make test classes name consitence by adding 'Support' or 'Dummy' at start of util or dummy type of test classes Issue-ID: POLICY-1263 Change-Id: I1dc1a7f174660a90664ebdcff2ea79ed30aa465c Signed-off-by: Parshad Patel --- .../context/impl/schema/java/BadJsonAdapter.java | 63 ---------------------- .../java/JavaSchemaHelperParametersTest.java | 6 +-- .../impl/schema/java/JavaSchemaHelperTest.java | 10 ++-- .../apex/context/impl/schema/java/MyBaseClass.java | 33 ------------ .../apex/context/impl/schema/java/MySubClass.java | 27 ---------- .../impl/schema/java/SupportBadJsonAdapter.java | 63 ++++++++++++++++++++++ .../context/impl/schema/java/SupportBaseClass.java | 33 ++++++++++++ .../impl/schema/java/SupportJsonAdapter.java | 55 +++++++++++++++++++ .../impl/schema/java/SupportJsonDeserializer.java | 44 +++++++++++++++ .../impl/schema/java/SupportJsonSerializer.java | 50 +++++++++++++++++ .../context/impl/schema/java/SupportSubClass.java | 27 ++++++++++ .../context/impl/schema/java/TestJsonAdapter.java | 55 ------------------- .../impl/schema/java/TestJsonDeserializer.java | 44 --------------- .../impl/schema/java/TestJsonSerializer.java | 50 ----------------- 14 files changed, 280 insertions(+), 280 deletions(-) delete mode 100644 context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/BadJsonAdapter.java delete mode 100644 context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/MyBaseClass.java delete mode 100644 context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/MySubClass.java create mode 100644 context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/SupportBadJsonAdapter.java create mode 100644 context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/SupportBaseClass.java create mode 100644 context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/SupportJsonAdapter.java create mode 100644 context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/SupportJsonDeserializer.java create mode 100644 context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/SupportJsonSerializer.java create mode 100644 context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/SupportSubClass.java delete mode 100644 context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/TestJsonAdapter.java delete mode 100644 context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/TestJsonDeserializer.java delete mode 100644 context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/TestJsonSerializer.java (limited to 'context/context-management/src') diff --git a/context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/BadJsonAdapter.java b/context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/BadJsonAdapter.java deleted file mode 100644 index fef69ac33..000000000 --- a/context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/BadJsonAdapter.java +++ /dev/null @@ -1,63 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2018 Ericsson. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.apex.context.impl.schema.java; - -import com.google.gson.Gson; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonSerializationContext; -import com.google.gson.JsonSerializer; - -import java.lang.reflect.Type; - -/** - * This class serialises and deserialises various type of event protocol parameters to and from - * JSON. - * - * @author Liam Fallon (liam.fallon@ericsson.com) - */ -public class BadJsonAdapter - implements JsonSerializer, JsonDeserializer { - - public BadJsonAdapter() throws IllegalAccessException { - throw new IllegalAccessException("Test for Bad Adapter"); - } - - /** - * {@inheritDoc} - */ - @Override - public JsonElement serialize(final String src, final Type typeOfSrc, - final JsonSerializationContext context) { - return new Gson().toJsonTree(src, String.class); - } - - /** - * {@inheritDoc} - */ - @Override - public String deserialize(final JsonElement json, final Type typeOfT, - final JsonDeserializationContext context) { - - return new Gson().fromJson(json, String.class); - } -} diff --git a/context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/JavaSchemaHelperParametersTest.java b/context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/JavaSchemaHelperParametersTest.java index c0287bfe2..8735c922a 100644 --- a/context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/JavaSchemaHelperParametersTest.java +++ b/context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/JavaSchemaHelperParametersTest.java @@ -62,15 +62,15 @@ public class JavaSchemaHelperParametersTest { assertFalse(pars.validate().isValid()); jsonPars.setAdaptedClass("java.lang.String"); - jsonPars.setAdaptorClass("org.onap.policy.apex.context.impl.schema.java.TestJsonDeserializer"); + jsonPars.setAdaptorClass("org.onap.policy.apex.context.impl.schema.java.SupportJsonDeserializer"); assertFalse(pars.validate().isValid()); jsonPars.setAdaptedClass("java.lang.String"); - jsonPars.setAdaptorClass("org.onap.policy.apex.context.impl.schema.java.TestJsonSerializer"); + jsonPars.setAdaptorClass("org.onap.policy.apex.context.impl.schema.java.SupportJsonSerializer"); assertFalse(pars.validate().isValid()); jsonPars.setAdaptedClass("java.lang.String"); - jsonPars.setAdaptorClass("org.onap.policy.apex.context.impl.schema.java.TestJsonAdapter"); + jsonPars.setAdaptorClass("org.onap.policy.apex.context.impl.schema.java.SupportJsonAdapter"); assertTrue(pars.validate().isValid()); Map adapterMap = new LinkedHashMap<>(); diff --git a/context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/JavaSchemaHelperTest.java b/context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/JavaSchemaHelperTest.java index c746198e7..16976f268 100644 --- a/context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/JavaSchemaHelperTest.java +++ b/context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/JavaSchemaHelperTest.java @@ -52,7 +52,7 @@ public class JavaSchemaHelperTest { JavaSchemaHelperJsonAdapterParameters stringAdapterPars = new JavaSchemaHelperJsonAdapterParameters(); stringAdapterPars.setAdaptedClass("java.lang.String"); - stringAdapterPars.setAdaptorClass("org.onap.policy.apex.context.impl.schema.java.TestJsonAdapter"); + stringAdapterPars.setAdaptorClass("org.onap.policy.apex.context.impl.schema.java.SupportJsonAdapter"); javaSchemaHelperPars.getJsonAdapters().put("String", stringAdapterPars); @@ -212,7 +212,7 @@ public class JavaSchemaHelperTest { stringSchemaHelper.init(userKey, stringSchema); AxContextSchema myBaseClassSchema = new AxContextSchema(schemaKey, "Java", - "org.onap.policy.apex.context.impl.schema.java.MyBaseClass"); + "org.onap.policy.apex.context.impl.schema.java.SupportBaseClass"); SchemaHelper myBaseClassSchemaHelper = new JavaSchemaHelper(); myBaseClassSchemaHelper.init(userKey, myBaseClassSchema); @@ -315,7 +315,7 @@ public class JavaSchemaHelperTest { assertEquals("123", stringSchemaHelper.unmarshal(123)); - MySubClass subClassInstance = new MySubClass("123"); + SupportSubClass subClassInstance = new SupportSubClass("123"); assertEquals(subClassInstance, myBaseClassSchemaHelper.unmarshal(subClassInstance)); } @@ -375,7 +375,7 @@ public class JavaSchemaHelperTest { JavaSchemaHelperParameters javaShPars = (JavaSchemaHelperParameters) pars.getSchemaHelperParameterMap() .get("Java"); javaShPars.getJsonAdapters().get("String") - .setAdaptorClass("org.onap.policy.apex.context.impl.schema.java.BadJsonAdapter"); + .setAdaptorClass("org.onap.policy.apex.context.impl.schema.java.SupportBadJsonAdapter"); AxContextSchema stringSchema = new AxContextSchema(schemaKey, "Java", "java.lang.String"); SchemaHelper stringSchemaHelper = new JavaSchemaHelper(); @@ -386,7 +386,7 @@ public class JavaSchemaHelperTest { fail("test should throw an exception"); } catch (ContextRuntimeException pre) { assertEquals("UserKey:0.0.1: instantiation of adapter class " - + "\"org.onap.policy.apex.context.impl.schema.java.BadJsonAdapter\" " + + "\"org.onap.policy.apex.context.impl.schema.java.SupportBadJsonAdapter\" " + "to decode and encode class \"java.lang.String\" failed: Test for Bad Adapter", pre.getMessage()); } diff --git a/context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/MyBaseClass.java b/context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/MyBaseClass.java deleted file mode 100644 index 6dd6e2527..000000000 --- a/context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/MyBaseClass.java +++ /dev/null @@ -1,33 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.apex.context.impl.schema.java; - -public class MyBaseClass { - final String stringField; - - public MyBaseClass(final String stringField) { - this.stringField = stringField; - } - - public String getStringField() { - return stringField; - } -} diff --git a/context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/MySubClass.java b/context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/MySubClass.java deleted file mode 100644 index f68bcf4dc..000000000 --- a/context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/MySubClass.java +++ /dev/null @@ -1,27 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.apex.context.impl.schema.java; - -public class MySubClass extends MyBaseClass { - public MySubClass(String stringField) { - super(stringField); - } -} diff --git a/context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/SupportBadJsonAdapter.java b/context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/SupportBadJsonAdapter.java new file mode 100644 index 000000000..e45eb9aa3 --- /dev/null +++ b/context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/SupportBadJsonAdapter.java @@ -0,0 +1,63 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 Ericsson. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.apex.context.impl.schema.java; + +import com.google.gson.Gson; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; + +import java.lang.reflect.Type; + +/** + * This class serialises and deserialises various type of event protocol parameters to and from + * JSON. + * + * @author Liam Fallon (liam.fallon@ericsson.com) + */ +public class SupportBadJsonAdapter + implements JsonSerializer, JsonDeserializer { + + public SupportBadJsonAdapter() throws IllegalAccessException { + throw new IllegalAccessException("Test for Bad Adapter"); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonElement serialize(final String src, final Type typeOfSrc, + final JsonSerializationContext context) { + return new Gson().toJsonTree(src, String.class); + } + + /** + * {@inheritDoc} + */ + @Override + public String deserialize(final JsonElement json, final Type typeOfT, + final JsonDeserializationContext context) { + + return new Gson().fromJson(json, String.class); + } +} diff --git a/context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/SupportBaseClass.java b/context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/SupportBaseClass.java new file mode 100644 index 000000000..004737559 --- /dev/null +++ b/context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/SupportBaseClass.java @@ -0,0 +1,33 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.apex.context.impl.schema.java; + +public class SupportBaseClass { + final String stringField; + + public SupportBaseClass(final String stringField) { + this.stringField = stringField; + } + + public String getStringField() { + return stringField; + } +} diff --git a/context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/SupportJsonAdapter.java b/context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/SupportJsonAdapter.java new file mode 100644 index 000000000..5c26beaee --- /dev/null +++ b/context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/SupportJsonAdapter.java @@ -0,0 +1,55 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 Ericsson. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.apex.context.impl.schema.java; + +import com.google.gson.Gson; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; + +import java.lang.reflect.Type; + +/** + * This class serialises and deserialises various type of event protocol parameters to and from JSON. + * + * @author Liam Fallon (liam.fallon@ericsson.com) + */ +public class SupportJsonAdapter implements JsonSerializer, JsonDeserializer { + + /** + * {@inheritDoc} + */ + @Override + public JsonElement serialize(final String src, final Type typeOfSrc, final JsonSerializationContext context) { + return new Gson().toJsonTree(src, String.class); + } + + /** + * {@inheritDoc} + */ + @Override + public String deserialize(final JsonElement json, final Type typeOfT, final JsonDeserializationContext context) { + + return new Gson().fromJson(json, String.class); + } +} diff --git a/context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/SupportJsonDeserializer.java b/context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/SupportJsonDeserializer.java new file mode 100644 index 000000000..be279bf52 --- /dev/null +++ b/context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/SupportJsonDeserializer.java @@ -0,0 +1,44 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 Ericsson. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.apex.context.impl.schema.java; + +import com.google.gson.Gson; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; + +import java.lang.reflect.Type; + +/** + * This class serialises and deserialises various type of event protocol parameters to and from JSON. + * + * @author Liam Fallon (liam.fallon@ericsson.com) + */ +public class SupportJsonDeserializer implements JsonDeserializer { + /** + * {@inheritDoc} + */ + @Override + public String deserialize(final JsonElement json, final Type typeOfT, final JsonDeserializationContext context) { + + return new Gson().fromJson(json, String.class); + } +} diff --git a/context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/SupportJsonSerializer.java b/context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/SupportJsonSerializer.java new file mode 100644 index 000000000..1fcb858ab --- /dev/null +++ b/context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/SupportJsonSerializer.java @@ -0,0 +1,50 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 Ericsson. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.apex.context.impl.schema.java; + +import com.google.gson.JsonElement; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; + +import java.lang.reflect.Type; + +import org.onap.policy.common.parameters.ParameterRuntimeException; +import org.slf4j.ext.XLogger; +import org.slf4j.ext.XLoggerFactory; + +/** + * This class serialises and deserialises various type of event protocol parameters to and from JSON. + * + * @author Liam Fallon (liam.fallon@ericsson.com) + */ +public class SupportJsonSerializer implements JsonSerializer { + private static final XLogger LOGGER = XLoggerFactory.getXLogger(SupportJsonSerializer.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonElement serialize(final String src, final Type typeOfSrc, final JsonSerializationContext context) { + final String returnMessage = "serialization of Apex event protocol parameters to Json is not supported"; + LOGGER.error(returnMessage); + throw new ParameterRuntimeException(returnMessage); + } +} diff --git a/context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/SupportSubClass.java b/context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/SupportSubClass.java new file mode 100644 index 000000000..260f4eb8c --- /dev/null +++ b/context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/SupportSubClass.java @@ -0,0 +1,27 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.apex.context.impl.schema.java; + +public class SupportSubClass extends SupportBaseClass { + public SupportSubClass(String stringField) { + super(stringField); + } +} diff --git a/context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/TestJsonAdapter.java b/context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/TestJsonAdapter.java deleted file mode 100644 index 89dfb4c2d..000000000 --- a/context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/TestJsonAdapter.java +++ /dev/null @@ -1,55 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2018 Ericsson. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.apex.context.impl.schema.java; - -import com.google.gson.Gson; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonSerializationContext; -import com.google.gson.JsonSerializer; - -import java.lang.reflect.Type; - -/** - * This class serialises and deserialises various type of event protocol parameters to and from JSON. - * - * @author Liam Fallon (liam.fallon@ericsson.com) - */ -public class TestJsonAdapter implements JsonSerializer, JsonDeserializer { - - /** - * {@inheritDoc} - */ - @Override - public JsonElement serialize(final String src, final Type typeOfSrc, final JsonSerializationContext context) { - return new Gson().toJsonTree(src, String.class); - } - - /** - * {@inheritDoc} - */ - @Override - public String deserialize(final JsonElement json, final Type typeOfT, final JsonDeserializationContext context) { - - return new Gson().fromJson(json, String.class); - } -} diff --git a/context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/TestJsonDeserializer.java b/context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/TestJsonDeserializer.java deleted file mode 100644 index 463945872..000000000 --- a/context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/TestJsonDeserializer.java +++ /dev/null @@ -1,44 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2018 Ericsson. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.apex.context.impl.schema.java; - -import com.google.gson.Gson; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; - -import java.lang.reflect.Type; - -/** - * This class serialises and deserialises various type of event protocol parameters to and from JSON. - * - * @author Liam Fallon (liam.fallon@ericsson.com) - */ -public class TestJsonDeserializer implements JsonDeserializer { - /** - * {@inheritDoc} - */ - @Override - public String deserialize(final JsonElement json, final Type typeOfT, final JsonDeserializationContext context) { - - return new Gson().fromJson(json, String.class); - } -} diff --git a/context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/TestJsonSerializer.java b/context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/TestJsonSerializer.java deleted file mode 100644 index d58be6069..000000000 --- a/context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/TestJsonSerializer.java +++ /dev/null @@ -1,50 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2018 Ericsson. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.apex.context.impl.schema.java; - -import com.google.gson.JsonElement; -import com.google.gson.JsonSerializationContext; -import com.google.gson.JsonSerializer; - -import java.lang.reflect.Type; - -import org.onap.policy.common.parameters.ParameterRuntimeException; -import org.slf4j.ext.XLogger; -import org.slf4j.ext.XLoggerFactory; - -/** - * This class serialises and deserialises various type of event protocol parameters to and from JSON. - * - * @author Liam Fallon (liam.fallon@ericsson.com) - */ -public class TestJsonSerializer implements JsonSerializer { - private static final XLogger LOGGER = XLoggerFactory.getXLogger(TestJsonSerializer.class); - - /** - * {@inheritDoc} - */ - @Override - public JsonElement serialize(final String src, final Type typeOfSrc, final JsonSerializationContext context) { - final String returnMessage = "serialization of Apex event protocol parameters to Json is not supported"; - LOGGER.error(returnMessage); - throw new ParameterRuntimeException(returnMessage); - } -} -- cgit 1.2.3-korg