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 | |
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')
9 files changed, 132 insertions, 125 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"); diff --git a/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-yaml/src/test/java/org/onap/policy/apex/plugins/event/protocol/yaml/YamlEventProtocolTest.java b/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-yaml/src/test/java/org/onap/policy/apex/plugins/event/protocol/yaml/YamlEventProtocolTest.java index 2b6a13f89..65a6305f5 100644 --- a/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-yaml/src/test/java/org/onap/policy/apex/plugins/event/protocol/yaml/YamlEventProtocolTest.java +++ b/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-yaml/src/test/java/org/onap/policy/apex/plugins/event/protocol/yaml/YamlEventProtocolTest.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 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. @@ -42,12 +43,12 @@ import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas; import org.onap.policy.apex.model.eventmodel.concepts.AxEvent; import org.onap.policy.apex.model.eventmodel.concepts.AxEvents; import org.onap.policy.apex.model.eventmodel.concepts.AxField; -import org.onap.policy.apex.model.utilities.TextFileUtils; import org.onap.policy.apex.service.engine.event.ApexEvent; import org.onap.policy.apex.service.engine.event.ApexEventException; import org.onap.policy.apex.service.engine.event.impl.filecarrierplugin.consumer.HeaderDelimitedTextBlockReader; import org.onap.policy.apex.service.engine.event.impl.filecarrierplugin.consumer.TextBlock; import org.onap.policy.common.parameters.ParameterService; +import org.onap.policy.common.utils.resources.TextFileUtils; /** * The Class TestYamlEventProtocol. @@ -67,24 +68,24 @@ public class YamlEventProtocolTest { AxContextSchemas schemas = new AxContextSchemas(); - AxContextSchema simpleIntSchema = new AxContextSchema(new AxArtifactKey("SimpleIntSchema", "0.0.1"), "JAVA", - "java.lang.Integer"); + AxContextSchema simpleIntSchema = + new AxContextSchema(new AxArtifactKey("SimpleIntSchema", "0.0.1"), "JAVA", "java.lang.Integer"); schemas.getSchemasMap().put(simpleIntSchema.getKey(), simpleIntSchema); - AxContextSchema simpleDoubleSchema = new AxContextSchema(new AxArtifactKey("SimpleDoubleSchema", "0.0.1"), - "JAVA", "java.lang.Double"); + AxContextSchema simpleDoubleSchema = + new AxContextSchema(new AxArtifactKey("SimpleDoubleSchema", "0.0.1"), "JAVA", "java.lang.Double"); schemas.getSchemasMap().put(simpleDoubleSchema.getKey(), simpleDoubleSchema); - AxContextSchema simpleStringSchema = new AxContextSchema(new AxArtifactKey("SimpleStringSchema", "0.0.1"), - "JAVA", "java.lang.String"); + AxContextSchema simpleStringSchema = + new AxContextSchema(new AxArtifactKey("SimpleStringSchema", "0.0.1"), "JAVA", "java.lang.String"); schemas.getSchemasMap().put(simpleStringSchema.getKey(), simpleStringSchema); - AxContextSchema arrayListSchema = new AxContextSchema(new AxArtifactKey("ArrayListSchema", "0.0.1"), "JAVA", - "java.util.ArrayList"); + AxContextSchema arrayListSchema = + new AxContextSchema(new AxArtifactKey("ArrayListSchema", "0.0.1"), "JAVA", "java.util.ArrayList"); schemas.getSchemasMap().put(arrayListSchema.getKey(), arrayListSchema); AxContextSchema linkedHashMapSchema = new AxContextSchema(new AxArtifactKey("LinkedHashMapSchema", "0.0.1"), - "JAVA", "java.util.LinkedHashMap"); + "JAVA", "java.util.LinkedHashMap"); schemas.getSchemasMap().put(linkedHashMapSchema.getKey(), linkedHashMapSchema); ModelService.registerModel(AxContextSchemas.class, schemas); @@ -97,8 +98,8 @@ public class YamlEventProtocolTest { AxEvent testEvent1 = new AxEvent(new AxArtifactKey("TestEvent1", "0.0.1")); testEvent1.setNameSpace("org.onap.policy.apex.plugins.event.protocol.yaml"); - AxField te1Field0 = new AxField(new AxReferenceKey(testEvent1.getKey(), "yaml_field"), - arrayListSchema.getKey()); + AxField te1Field0 = + new AxField(new AxReferenceKey(testEvent1.getKey(), "yaml_field"), arrayListSchema.getKey()); testEvent1.getParameterMap().put("yaml_field", te1Field0); events.getEventMap().put(testEvent1.getKey(), testEvent1); @@ -122,25 +123,25 @@ public class YamlEventProtocolTest { AxEvent testEvent4 = new AxEvent(new AxArtifactKey("TestEvent4", "0.0.1")); testEvent4.setNameSpace("org.onap.policy.apex.plugins.event.protocol.yaml"); - AxField te4Field0 = new AxField(new AxReferenceKey(testEvent4.getKey(), "yaml_field"), - arrayListSchema.getKey()); + AxField te4Field0 = + new AxField(new AxReferenceKey(testEvent4.getKey(), "yaml_field"), arrayListSchema.getKey()); testEvent4.getParameterMap().put("yaml_field", te4Field0); events.getEventMap().put(testEvent4.getKey(), testEvent4); AxEvent testEvent5 = new AxEvent(new AxArtifactKey("TestEvent5", "0.0.1")); testEvent5.setNameSpace("org.onap.policy.apex.plugins.event.protocol.yaml"); - AxField te5Field0 = new AxField(new AxReferenceKey(testEvent5.getKey(), "yaml_field"), - arrayListSchema.getKey()); + AxField te5Field0 = + new AxField(new AxReferenceKey(testEvent5.getKey(), "yaml_field"), arrayListSchema.getKey()); testEvent5.getParameterMap().put("yaml_field", te5Field0); events.getEventMap().put(testEvent5.getKey(), testEvent5); AxEvent testEvent6 = new AxEvent(new AxArtifactKey("TestEvent6", "0.0.1")); testEvent6.setNameSpace("org.onap.policy.apex.plugins.event.protocol.yaml"); - AxField te6Field0 = new AxField(new AxReferenceKey(testEvent6.getKey(), "MarkMcGwire"), - linkedHashMapSchema.getKey()); + AxField te6Field0 = + new AxField(new AxReferenceKey(testEvent6.getKey(), "MarkMcGwire"), linkedHashMapSchema.getKey()); testEvent6.getParameterMap().put("Mark McGwire", te6Field0); - AxField te6Field1 = new AxField(new AxReferenceKey(testEvent6.getKey(), "SammySosa"), - linkedHashMapSchema.getKey()); + AxField te6Field1 = + new AxField(new AxReferenceKey(testEvent6.getKey(), "SammySosa"), linkedHashMapSchema.getKey()); testEvent6.getParameterMap().put("Sammy Sosa", te6Field1); events.getEventMap().put(testEvent6.getKey(), testEvent6); @@ -164,34 +165,34 @@ public class YamlEventProtocolTest { AxEvent testEvent9 = new AxEvent(new AxArtifactKey("TestEvent9", "0.0.1")); testEvent9.setNameSpace("org.onap.policy.apex.plugins.event.protocol.yaml"); - AxField te9Field0 = new AxField(new AxReferenceKey(testEvent9.getKey(), "ChicagoCubs"), - arrayListSchema.getKey()); + AxField te9Field0 = + new AxField(new AxReferenceKey(testEvent9.getKey(), "ChicagoCubs"), arrayListSchema.getKey()); testEvent9.getParameterMap().put("ChicagoCubs", te9Field0); - AxField te9Field1 = new AxField(new AxReferenceKey(testEvent9.getKey(), "AtlantaBraves"), - arrayListSchema.getKey()); + AxField te9Field1 = + new AxField(new AxReferenceKey(testEvent9.getKey(), "AtlantaBraves"), arrayListSchema.getKey()); testEvent9.getParameterMap().put("AtlantaBraves", te9Field1); events.getEventMap().put(testEvent9.getKey(), testEvent9); AxEvent testEvent10 = new AxEvent(new AxArtifactKey("TestEvent10", "0.0.1")); testEvent10.setNameSpace("org.onap.policy.apex.plugins.event.protocol.yaml"); - AxField te10Field0 = new AxField(new AxReferenceKey(testEvent10.getKey(), "yaml_field"), - arrayListSchema.getKey()); + AxField te10Field0 = + new AxField(new AxReferenceKey(testEvent10.getKey(), "yaml_field"), arrayListSchema.getKey()); testEvent10.getParameterMap().put("yaml_field", te10Field0); events.getEventMap().put(testEvent10.getKey(), testEvent10); AxEvent testEvent11 = new AxEvent(new AxArtifactKey("TestEvent11", "0.0.1")); testEvent11.setNameSpace("org.onap.policy.apex.plugins.event.protocol.yaml"); AxField te11Field0 = new AxField(new AxReferenceKey(testEvent11.getKey(), "tosca_definitions_version"), - simpleStringSchema.getKey()); + simpleStringSchema.getKey()); testEvent11.getParameterMap().put("tosca_definitions_version", te11Field0); - AxField te11Field1 = new AxField(new AxReferenceKey(testEvent11.getKey(), "description"), - simpleStringSchema.getKey(), true); + AxField te11Field1 = + new AxField(new AxReferenceKey(testEvent11.getKey(), "description"), simpleStringSchema.getKey(), true); testEvent11.getParameterMap().put("description", te11Field1); - AxField te11Field2 = new AxField(new AxReferenceKey(testEvent11.getKey(), "node_types"), - linkedHashMapSchema.getKey(), true); + AxField te11Field2 = + new AxField(new AxReferenceKey(testEvent11.getKey(), "node_types"), linkedHashMapSchema.getKey(), true); testEvent11.getParameterMap().put("node_types", te11Field2); AxField te11Field3 = new AxField(new AxReferenceKey(testEvent11.getKey(), "topology_template"), - linkedHashMapSchema.getKey()); + linkedHashMapSchema.getKey()); testEvent11.getParameterMap().put("topology_template", te11Field3); events.getEventMap().put(testEvent11.getKey(), testEvent11); @@ -249,7 +250,7 @@ public class YamlEventProtocolTest { * @throws IOException Signals that an I/O exception has occurred. */ private void testYamlDecodeEncode(final String eventName, final int eventCount, final int parCount, - final String fileName) throws ApexEventException, IOException { + final String fileName) throws ApexEventException, IOException { YamlEventProtocolParameters parameters = new YamlEventProtocolParameters(); parameters.setDelimiterAtStart(false); @@ -280,7 +281,7 @@ public class YamlEventProtocolTest { String eventYaml = (String) converter.fromApexEvent(eventList.get(eventNo)); String expectedYaml = TextFileUtils - .getTextFileAsString("src/test/resources/yaml_out/" + fileName + '_' + eventNo + ".yaml"); + .getTextFileAsString("src/test/resources/yaml_out/" + fileName + '_' + eventNo + ".yaml"); assertEquals(expectedYaml.replaceAll("\\s*", ""), eventYaml.replaceAll("\\s*", "")); } } |