diff options
author | liamfallon <liam.fallon@est.tech> | 2020-01-23 16:50:47 +0000 |
---|---|---|
committer | liamfallon <liam.fallon@est.tech> | 2020-01-23 16:50:51 +0000 |
commit | f8000a9d35928f136216be504828ef9074dfb42a (patch) | |
tree | 5e81379c3eef8af54ff557cd641ab94faa426713 /plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src | |
parent | 755eb9df282d80273043a2e902e2a51bf6eaab24 (diff) |
Remove apex-pdp TextFileUtils class
This class was moved to policy-common some time ago. Removing it in
apex-pdp.
Issue-ID: POLICY-1913
Change-Id: I982fbd799334b34f1526e19f339236b52205b91e
Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src')
8 files changed, 97 insertions, 91 deletions
diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaAaiTest.java b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaAaiTest.java index b92615932..a201263b8 100644 --- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaAaiTest.java +++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaAaiTest.java @@ -1,19 +1,20 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2020 Nordix Foundation. * ================================================================================ * 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========================================================= */ @@ -38,14 +39,14 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxKey; import org.onap.policy.apex.model.basicmodel.service.ModelService; import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema; import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas; -import org.onap.policy.apex.model.utilities.TextFileUtils; import org.onap.policy.common.parameters.ParameterService; +import org.onap.policy.common.utils.resources.TextFileUtils; /** * The Class TestAvroSchemaAai. * * @author Liam Fallon (liam.fallon@ericsson.com) - * @version + * @version */ public class AvroSchemaAaiTest { private final AxKey testKey = new AxArtifactKey("AvroTest", "0.0.1"); @@ -61,7 +62,7 @@ public class AvroSchemaAaiTest { public void initTest() throws IOException { schemas = new AxContextSchemas(new AxArtifactKey("AvroSchemas", "0.0.1")); ModelService.registerModel(AxContextSchemas.class, schemas); - + aaiInventoryResponseSchema = TextFileUtils.getTextFileAsString("src/test/resources/avsc/AAIInventoryResponseItemType.avsc"); } @@ -75,7 +76,7 @@ public class AvroSchemaAaiTest { schemaParameters.setName(ContextParameterConstants.SCHEMA_GROUP_NAME); schemaParameters.getSchemaHelperParameterMap().put("AVRO", new AvroSchemaHelperParameters()); ParameterService.register(schemaParameters); - + } /** diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaArrayTest.java b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaArrayTest.java index e72f7c7b3..4bbaef8c9 100644 --- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaArrayTest.java +++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaArrayTest.java @@ -1,19 +1,20 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2020 Nordix Foundation. * ================================================================================ * 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========================================================= */ @@ -37,15 +38,15 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxKey; import org.onap.policy.apex.model.basicmodel.service.ModelService; import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema; import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas; -import org.onap.policy.apex.model.utilities.TextFileUtils; import org.onap.policy.common.parameters.ParameterService; +import org.onap.policy.common.utils.resources.TextFileUtils; // TODO: Auto-generated Javadoc /** * The Class TestAvroSchemaArray. * * @author Liam Fallon (liam.fallon@ericsson.com) - * @version + * @version */ public class AvroSchemaArrayTest { private final AxKey testKey = new AxArtifactKey("AvroTest", "0.0.1"); @@ -75,7 +76,7 @@ public class AvroSchemaArrayTest { schemaParameters.setName(ContextParameterConstants.SCHEMA_GROUP_NAME); schemaParameters.getSchemaHelperParameterMap().put("AVRO", new AvroSchemaHelperParameters()); ParameterService.register(schemaParameters); - + } /** diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaEnumTest.java b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaEnumTest.java index 54a46958b..c60abe1e2 100644 --- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaEnumTest.java +++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaEnumTest.java @@ -1,19 +1,20 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2020 Nordix Foundation. * ================================================================================ * 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========================================================= */ @@ -38,15 +39,15 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxKey; import org.onap.policy.apex.model.basicmodel.service.ModelService; import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema; import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas; -import org.onap.policy.apex.model.utilities.TextFileUtils; import org.onap.policy.common.parameters.ParameterService; +import org.onap.policy.common.utils.resources.TextFileUtils; // TODO: Auto-generated Javadoc /** * The Class TestAvroSchemaEnum. * * @author Liam Fallon (liam.fallon@ericsson.com) - * @version + * @version */ public class AvroSchemaEnumTest { private final AxKey testKey = new AxArtifactKey("AvroTest", "0.0.1"); @@ -74,7 +75,7 @@ public class AvroSchemaEnumTest { schemaParameters.setName(ContextParameterConstants.SCHEMA_GROUP_NAME); schemaParameters.getSchemaHelperParameterMap().put("AVRO", new AvroSchemaHelperParameters()); ParameterService.register(schemaParameters); - + } /** diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaFixedTest.java b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaFixedTest.java index ee742a8be..a23aac910 100644 --- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaFixedTest.java +++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaFixedTest.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2019-2020 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,8 +40,8 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxKey; import org.onap.policy.apex.model.basicmodel.service.ModelService; import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema; import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas; -import org.onap.policy.apex.model.utilities.TextFileUtils; import org.onap.policy.common.parameters.ParameterService; +import org.onap.policy.common.utils.resources.TextFileUtils; /** * The Class TestAvroSchemaFixed. @@ -93,8 +93,8 @@ public class AvroSchemaFixedTest { */ @Test public void testFixedInit() throws IOException { - final AxContextSchema avroSchema = new AxContextSchema(new AxArtifactKey("AvroRecord", "0.0.1"), "AVRO", - fixedSchema); + final AxContextSchema avroSchema = + new AxContextSchema(new AxArtifactKey("AvroRecord", "0.0.1"), "AVRO", fixedSchema); schemas.getSchemasMap().put(avroSchema.getKey(), avroSchema); final SchemaHelper schemaHelper = new SchemaHelperFactory().createSchemaHelper(testKey, avroSchema.getKey()); @@ -104,8 +104,8 @@ public class AvroSchemaFixedTest { fail("Test should throw an exception here"); } catch (final Exception e) { assertEquals("AvroTest:0.0.1: could not create an instance " - + "of class \"org.apache.avro.generic.GenericData$Fixed\" " - + "using the default constructor \"Fixed()\"", e.getMessage()); + + "of class \"org.apache.avro.generic.GenericData$Fixed\" " + + "using the default constructor \"Fixed()\"", e.getMessage()); } final String inString = TextFileUtils.getTextFileAsString("src/test/resources/data/FixedExampleGood.json"); @@ -121,8 +121,8 @@ public class AvroSchemaFixedTest { */ @Test public void testFixedUnmarshalMarshal() throws IOException { - final AxContextSchema avroSchema = new AxContextSchema(new AxArtifactKey("AvroArray", "0.0.1"), "AVRO", - fixedSchema); + final AxContextSchema avroSchema = + new AxContextSchema(new AxArtifactKey("AvroArray", "0.0.1"), "AVRO", fixedSchema); schemas.getSchemasMap().put(avroSchema.getKey(), avroSchema); final SchemaHelper schemaHelper = new SchemaHelperFactory().createSchemaHelper(testKey, avroSchema.getKey()); @@ -134,29 +134,29 @@ public class AvroSchemaFixedTest { fail("This test should throw an exception here"); } catch (final Exception e) { assertEquals("AvroTest:0.0.1: object \"null\" Avro unmarshalling failed: Expected fixed. Got VALUE_NULL", - e.getMessage()); + e.getMessage()); } try { testUnmarshalMarshal(schemaHelper, "src/test/resources/data/FixedExampleNull.json"); fail("This test should throw an exception here"); } catch (final Exception e) { assertEquals("AvroTest:0.0.1: object \"null\" Avro unmarshalling failed: Expected fixed. Got VALUE_NULL", - e.getMessage()); + e.getMessage()); } try { testUnmarshalMarshal(schemaHelper, "src/test/resources/data/FixedExampleBad0.json"); fail("This test should throw an exception here"); } catch (final Exception e) { assertEquals("AvroTest:0.0.1: object \"\"BADBAD\"\" " - + "Avro unmarshalling failed: Expected fixed length 64, but got6", e.getMessage()); + + "Avro unmarshalling failed: Expected fixed length 64, but got6", e.getMessage()); } try { testUnmarshalMarshal(schemaHelper, "src/test/resources/data/FixedExampleBad1.json"); fail("This test should throw an exception here"); } catch (final Exception e) { assertEquals("AvroTest:0.0.1: object " - + "\"\"0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0\"\" " - + "Avro unmarshalling failed: Expected fixed length 64, but got65", e.getMessage()); + + "\"\"0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0\"\" " + + "Avro unmarshalling failed: Expected fixed length 64, but got65", e.getMessage()); } } diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaMapTest.java b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaMapTest.java index 666dd064b..9e850aa30 100644 --- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaMapTest.java +++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaMapTest.java @@ -1,19 +1,20 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2020 Nordix Foundation. * ================================================================================ * 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========================================================= */ @@ -40,8 +41,8 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxKey; import org.onap.policy.apex.model.basicmodel.service.ModelService; import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema; import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas; -import org.onap.policy.apex.model.utilities.TextFileUtils; import org.onap.policy.common.parameters.ParameterService; +import org.onap.policy.common.utils.resources.TextFileUtils; /** * The Class TestAvroSchemaMap. @@ -67,8 +68,8 @@ public class AvroSchemaMapTest { ModelService.registerModel(AxContextSchemas.class, schemas); longMapSchema = TextFileUtils.getTextFileAsString("src/test/resources/avsc/MapExampleLong.avsc"); addressMapSchema = TextFileUtils.getTextFileAsString("src/test/resources/avsc/MapExampleAddress.avsc"); - addressMapSchemaInvalidFields = TextFileUtils - .getTextFileAsString("src/test/resources/avsc/MapExampleAddressInvalidFields.avsc"); + addressMapSchemaInvalidFields = + TextFileUtils.getTextFileAsString("src/test/resources/avsc/MapExampleAddressInvalidFields.avsc"); } /** @@ -98,8 +99,8 @@ public class AvroSchemaMapTest { */ @Test public void testMapInit() throws IOException { - final AxContextSchema avroSchema = new AxContextSchema(new AxArtifactKey("AvroRecord", "0.0.1"), "AVRO", - addressMapSchema); + final AxContextSchema avroSchema = + new AxContextSchema(new AxArtifactKey("AvroRecord", "0.0.1"), "AVRO", addressMapSchema); schemas.getSchemasMap().put(avroSchema.getKey(), avroSchema); final SchemaHelper schemaHelper = new SchemaHelperFactory().createSchemaHelper(testKey, avroSchema.getKey()); @@ -111,7 +112,7 @@ public class AvroSchemaMapTest { final HashMap<?, ?> newMapFull = (HashMap<?, ?>) schemaHelper.createNewInstance(inString); assertEquals("{\"streetaddress\": \"221 B Baker St.\", \"city\": \"London\"}", - newMapFull.get(new Utf8("address2")).toString()); + newMapFull.get(new Utf8("address2")).toString()); } /** @@ -121,8 +122,8 @@ public class AvroSchemaMapTest { */ @Test public void testLongMapUnmarshalMarshal() throws IOException { - final AxContextSchema avroSchema = new AxContextSchema(new AxArtifactKey("AvroMap", "0.0.1"), "AVRO", - longMapSchema); + final AxContextSchema avroSchema = + new AxContextSchema(new AxArtifactKey("AvroMap", "0.0.1"), "AVRO", longMapSchema); schemas.getSchemasMap().put(avroSchema.getKey(), avroSchema); final SchemaHelper schemaHelper = new SchemaHelperFactory().createSchemaHelper(testKey, avroSchema.getKey()); @@ -138,8 +139,8 @@ public class AvroSchemaMapTest { */ @Test public void testAddressMapUnmarshalMarshal() throws IOException { - final AxContextSchema avroSchema = new AxContextSchema(new AxArtifactKey("AvroMap", "0.0.1"), "AVRO", - addressMapSchema); + final AxContextSchema avroSchema = + new AxContextSchema(new AxArtifactKey("AvroMap", "0.0.1"), "AVRO", addressMapSchema); schemas.getSchemasMap().put(avroSchema.getKey(), avroSchema); final SchemaHelper schemaHelper = new SchemaHelperFactory().createSchemaHelper(testKey, avroSchema.getKey()); @@ -155,8 +156,8 @@ public class AvroSchemaMapTest { */ @Test public void testSubRecordCreateRecord() throws IOException { - final AxContextSchema avroSchema = new AxContextSchema(new AxArtifactKey("AvroMap", "0.0.1"), "AVRO", - addressMapSchema); + final AxContextSchema avroSchema = + new AxContextSchema(new AxArtifactKey("AvroMap", "0.0.1"), "AVRO", addressMapSchema); schemas.getSchemasMap().put(avroSchema.getKey(), avroSchema); final SchemaHelper schemaHelper = new SchemaHelperFactory().createSchemaHelper(testKey, avroSchema.getKey()); @@ -172,8 +173,8 @@ public class AvroSchemaMapTest { */ @Test public void testAddressMapUnmarshalMarshalInvalidFields() throws IOException { - final AxContextSchema avroSchema = new AxContextSchema(new AxArtifactKey("AvroMap", "0.0.1"), "AVRO", - addressMapSchemaInvalidFields); + final AxContextSchema avroSchema = + new AxContextSchema(new AxArtifactKey("AvroMap", "0.0.1"), "AVRO", addressMapSchemaInvalidFields); schemas.getSchemasMap().put(avroSchema.getKey(), avroSchema); final SchemaHelper schemaHelper = new SchemaHelperFactory().createSchemaHelper(testKey, avroSchema.getKey()); diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaRecordTest.java b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaRecordTest.java index 35e305734..a6a3f662d 100644 --- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaRecordTest.java +++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaRecordTest.java @@ -1,19 +1,20 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2020 Nordix Foundation. * ================================================================================ * 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========================================================= */ @@ -39,10 +40,9 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxKey; import org.onap.policy.apex.model.basicmodel.service.ModelService; import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema; import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas; -import org.onap.policy.apex.model.utilities.TextFileUtils; import org.onap.policy.common.parameters.ParameterService; +import org.onap.policy.common.utils.resources.TextFileUtils; -// TODO: Auto-generated Javadoc /** * The Class TestAvroSchemaRecord. * @@ -69,8 +69,8 @@ public class AvroSchemaRecordTest { recordSchema = TextFileUtils.getTextFileAsString("src/test/resources/avsc/RecordExample.avsc"); recordSchemaVpn = TextFileUtils.getTextFileAsString("src/test/resources/avsc/RecordExampleVPN.avsc"); recordSchemaVpnReuse = TextFileUtils.getTextFileAsString("src/test/resources/avsc/RecordExampleVPNReuse.avsc"); - recordSchemaInvalidFields = TextFileUtils - .getTextFileAsString("src/test/resources/avsc/RecordExampleInvalidFields.avsc"); + recordSchemaInvalidFields = + TextFileUtils.getTextFileAsString("src/test/resources/avsc/RecordExampleInvalidFields.avsc"); } /** @@ -100,8 +100,8 @@ public class AvroSchemaRecordTest { */ @Test public void testRecordInit() throws IOException { - final AxContextSchema avroSchema = new AxContextSchema(new AxArtifactKey("AvroRecord", "0.0.1"), "AVRO", - recordSchema); + final AxContextSchema avroSchema = + new AxContextSchema(new AxArtifactKey("AvroRecord", "0.0.1"), "AVRO", recordSchema); schemas.getSchemasMap().put(avroSchema.getKey(), avroSchema); final SchemaHelper schemaHelper = new SchemaHelperFactory().createSchemaHelper(testKey, avroSchema.getKey()); @@ -121,8 +121,8 @@ public class AvroSchemaRecordTest { */ @Test public void testRecordUnmarshalMarshal() throws IOException { - final AxContextSchema avroSchema = new AxContextSchema(new AxArtifactKey("AvroRecord", "0.0.1"), "AVRO", - recordSchema); + final AxContextSchema avroSchema = + new AxContextSchema(new AxArtifactKey("AvroRecord", "0.0.1"), "AVRO", recordSchema); schemas.getSchemasMap().put(avroSchema.getKey(), avroSchema); final SchemaHelper schemaHelper = new SchemaHelperFactory().createSchemaHelper(testKey, avroSchema.getKey()); @@ -138,8 +138,8 @@ public class AvroSchemaRecordTest { */ @Test public void testRecordCreateRecord() throws IOException { - final AxContextSchema avroSchema = new AxContextSchema(new AxArtifactKey("AvroRecord", "0.0.1"), "AVRO", - recordSchema); + final AxContextSchema avroSchema = + new AxContextSchema(new AxArtifactKey("AvroRecord", "0.0.1"), "AVRO", recordSchema); schemas.getSchemasMap().put(avroSchema.getKey(), avroSchema); final SchemaHelper schemaHelper = new SchemaHelperFactory().createSchemaHelper(testKey, avroSchema.getKey()); @@ -155,7 +155,7 @@ public class AvroSchemaRecordTest { fail("test should throw an exception here"); } catch (ContextRuntimeException cre) { assertEquals("AvroTest:0.0.1: the schema \"User\" does not have a subtype of type \"IDontExist\"", - cre.getMessage()); + cre.getMessage()); } } @@ -166,8 +166,8 @@ public class AvroSchemaRecordTest { */ @Test public void testRecordUnmarshalMarshalInvalid() throws IOException { - final AxContextSchema avroSchema = new AxContextSchema(new AxArtifactKey("AvroRecord", "0.0.1"), "AVRO", - recordSchemaInvalidFields); + final AxContextSchema avroSchema = + new AxContextSchema(new AxArtifactKey("AvroRecord", "0.0.1"), "AVRO", recordSchemaInvalidFields); schemas.getSchemasMap().put(avroSchema.getKey(), avroSchema); final SchemaHelper schemaHelper = new SchemaHelperFactory().createSchemaHelper(testKey, avroSchema.getKey()); @@ -182,8 +182,8 @@ public class AvroSchemaRecordTest { */ @Test public void testVpnRecordUnmarshalMarshal() throws IOException { - final AxContextSchema avroSchema = new AxContextSchema(new AxArtifactKey("AvroRecord", "0.0.1"), "AVRO", - recordSchemaVpn); + final AxContextSchema avroSchema = + new AxContextSchema(new AxArtifactKey("AvroRecord", "0.0.1"), "AVRO", recordSchemaVpn); schemas.getSchemasMap().put(avroSchema.getKey(), avroSchema); final SchemaHelper schemaHelper = new SchemaHelperFactory().createSchemaHelper(testKey, avroSchema.getKey()); @@ -198,8 +198,8 @@ public class AvroSchemaRecordTest { */ @Test public void testVpnRecordReuse() throws IOException { - final AxContextSchema avroSchema = new AxContextSchema(new AxArtifactKey("AvroRecord", "0.0.1"), "AVRO", - recordSchemaVpnReuse); + final AxContextSchema avroSchema = + new AxContextSchema(new AxArtifactKey("AvroRecord", "0.0.1"), "AVRO", recordSchemaVpnReuse); schemas.getSchemasMap().put(avroSchema.getKey(), avroSchema); schemas.getSchemasMap().put(avroSchema.getKey(), avroSchema); diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaUnionTest.java b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaUnionTest.java index 720b5046d..47b1593fa 100644 --- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaUnionTest.java +++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaUnionTest.java @@ -1,19 +1,20 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2020 Nordix Foundation. * ================================================================================ * 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========================================================= */ @@ -38,14 +39,14 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxKey; import org.onap.policy.apex.model.basicmodel.service.ModelService; import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema; import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas; -import org.onap.policy.apex.model.utilities.TextFileUtils; import org.onap.policy.common.parameters.ParameterService; +import org.onap.policy.common.utils.resources.TextFileUtils; /** * The Class TestAvroSchemaUnion. * * @author Liam Fallon (liam.fallon@ericsson.com) - * @version + * @version */ public class AvroSchemaUnionTest { private final AxKey testKey = new AxArtifactKey("AvroTest", "0.0.1"); @@ -93,7 +94,7 @@ public class AvroSchemaUnionTest { @Test public void testUnionAllFields() throws IOException { final AxContextSchema avroSchema = - new AxContextSchema(new AxArtifactKey("AvroRecord", "0.0.1"), "AVRO", uinionSchema); + new AxContextSchema(new AxArtifactKey("AvroRecord", "0.0.1"), "AVRO", uinionSchema); schemas.getSchemasMap().put(avroSchema.getKey(), avroSchema); final SchemaHelper schemaHelper = new SchemaHelperFactory().createSchemaHelper(testKey, avroSchema.getKey()); @@ -115,13 +116,13 @@ public class AvroSchemaUnionTest { @Test public void testUnionOptionalField() throws IOException { final AxContextSchema avroSchema = - new AxContextSchema(new AxArtifactKey("AvroRecord", "0.0.1"), "AVRO", uinionSchema); + new AxContextSchema(new AxArtifactKey("AvroRecord", "0.0.1"), "AVRO", uinionSchema); schemas.getSchemasMap().put(avroSchema.getKey(), avroSchema); final SchemaHelper schemaHelper = new SchemaHelperFactory().createSchemaHelper(testKey, avroSchema.getKey()); final String inString = - TextFileUtils.getTextFileAsString("src/test/resources/data/UnionExampleOptionalField.json"); + TextFileUtils.getTextFileAsString("src/test/resources/data/UnionExampleOptionalField.json"); final GenericRecord user = (GenericRecord) schemaHelper.createNewInstance(inString); assertEquals("Ben", user.get("name").toString()); @@ -138,7 +139,7 @@ public class AvroSchemaUnionTest { @Test public void testUnionNullField() throws IOException { final AxContextSchema avroSchema = - new AxContextSchema(new AxArtifactKey("AvroRecord", "0.0.1"), "AVRO", uinionSchema); + new AxContextSchema(new AxArtifactKey("AvroRecord", "0.0.1"), "AVRO", uinionSchema); schemas.getSchemasMap().put(avroSchema.getKey(), avroSchema); final SchemaHelper schemaHelper = new SchemaHelperFactory().createSchemaHelper(testKey, avroSchema.getKey()); diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/HealthCheckSchemaTest.java b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/HealthCheckSchemaTest.java index 9d99c2b6e..e9eaf14ea 100644 --- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/HealthCheckSchemaTest.java +++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/HealthCheckSchemaTest.java @@ -1,19 +1,20 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2020 Nordix Foundation. * ================================================================================ * 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========================================================= */ @@ -40,8 +41,8 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxKey; import org.onap.policy.apex.model.basicmodel.service.ModelService; import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema; import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas; -import org.onap.policy.apex.model.utilities.TextFileUtils; import org.onap.policy.common.parameters.ParameterService; +import org.onap.policy.common.utils.resources.TextFileUtils; /** * The Class TestHealthCheckSchema. @@ -93,8 +94,8 @@ public class HealthCheckSchemaTest { */ @Test public void testHealthCheck() throws IOException { - final AxContextSchema avroSchema = new AxContextSchema(new AxArtifactKey("AvroRecord", "0.0.1"), "AVRO", - healthCheckSchema); + final AxContextSchema avroSchema = + new AxContextSchema(new AxArtifactKey("AvroRecord", "0.0.1"), "AVRO", healthCheckSchema); schemas.getSchemasMap().put(avroSchema.getKey(), avroSchema); final SchemaHelper schemaHelper = new SchemaHelperFactory().createSchemaHelper(testKey, avroSchema.getKey()); @@ -107,15 +108,15 @@ public class HealthCheckSchemaTest { final GenericRecord inputRecord = new GenericData.Record(healthCheckRecordSchema.getField("input").schema()); final Schema inputRecordRecordSchema = inputRecord.getSchema(); - final GenericRecord actionIndentifiersRecord = new GenericData.Record( - inputRecordRecordSchema.getField("action_DasH_identifiers").schema()); + final GenericRecord actionIndentifiersRecord = + new GenericData.Record(inputRecordRecordSchema.getField("action_DasH_identifiers").schema()); - final GenericRecord commonHeaderRecord = new GenericData.Record( - inputRecordRecordSchema.getField("common_DasH_header").schema()); + final GenericRecord commonHeaderRecord = + new GenericData.Record(inputRecordRecordSchema.getField("common_DasH_header").schema()); final Schema commonHeaderRecordSchema = commonHeaderRecord.getSchema(); - final GenericRecord commonHeaderFlagsRecord = new GenericData.Record( - commonHeaderRecordSchema.getField("flags").schema()); + final GenericRecord commonHeaderFlagsRecord = + new GenericData.Record(commonHeaderRecordSchema.getField("flags").schema()); healthCheckRecord.put("input", inputRecord); inputRecord.put("action_DasH_identifiers", actionIndentifiersRecord); @@ -124,7 +125,7 @@ public class HealthCheckSchemaTest { inputRecord.put("action", "HealthCheck"); inputRecord.put("payload", "{\"host-ip-address\":\"131.160.203.125\",\"input.url\":\"131.160.203.125/afr\"," - + "\"request-action-type\":\"GET\",\"request-action\":\"AFR\"}"); + + "\"request-action-type\":\"GET\",\"request-action\":\"AFR\"}"); actionIndentifiersRecord.put("vnf_DasH_id", "49414df5-3482-4fd8-9952-c463dff2770b"); |