From 4e3bb539cd8a678d8ea1e861c0cf04d472d50d9d Mon Sep 17 00:00:00 2001 From: Parshad Patel Date: Fri, 21 Dec 2018 15:36:35 +0900 Subject: Rename test classes in apex-pdp/model,core Make test classes name consitence by adding 'Test' at end of junit test classes and adding 'Support' or 'Dummy' at start of util or dummy type of test classes Issue-ID: POLICY-1263 Change-Id: I6cb8d09799d7abd1b50ead1edbc4986649ad4ba7 Signed-off-by: Parshad Patel --- .../eventmodel/handling/ApexEventModelTest.java | 2 +- .../handling/DummyTestApexEventModelCreator.java | 309 +++++++++++++++++++++ .../handling/TestApexEventModelCreator.java | 309 --------------------- 3 files changed, 310 insertions(+), 310 deletions(-) create mode 100644 model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/handling/DummyTestApexEventModelCreator.java delete mode 100644 model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/handling/TestApexEventModelCreator.java (limited to 'model/event-model/src/test') diff --git a/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/handling/ApexEventModelTest.java b/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/handling/ApexEventModelTest.java index aaed3cd7f..88736d1f0 100644 --- a/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/handling/ApexEventModelTest.java +++ b/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/handling/ApexEventModelTest.java @@ -48,7 +48,7 @@ public class ApexEventModelTest { Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance(); connection = DriverManager.getConnection("jdbc:derby:memory:apex_test;create=true"); - testApexModel = new TestApexModel(AxEventModel.class, new TestApexEventModelCreator()); + testApexModel = new TestApexModel(AxEventModel.class, new DummyTestApexEventModelCreator()); } @After diff --git a/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/handling/DummyTestApexEventModelCreator.java b/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/handling/DummyTestApexEventModelCreator.java new file mode 100644 index 000000000..11685a6b4 --- /dev/null +++ b/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/handling/DummyTestApexEventModelCreator.java @@ -0,0 +1,309 @@ +/*- + * ============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.model.eventmodel.handling; + +import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; +import org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation; +import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey; +import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult; +import org.onap.policy.apex.model.basicmodel.test.TestApexModelCreator; +import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema; +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.AxEventModel; +import org.onap.policy.apex.model.eventmodel.concepts.AxEvents; +import org.onap.policy.apex.model.eventmodel.concepts.AxField; + +public class DummyTestApexEventModelCreator implements TestApexModelCreator { + + @Override + public AxEventModel getModel() { + final AxContextSchema axSchema0 = + new AxContextSchema(new AxArtifactKey("BooleanType", "0.0.1"), "Java", "java.lang.Boolean"); + final AxContextSchema axSchema1 = + new AxContextSchema(new AxArtifactKey("IntType", "0.0.1"), "Java", "java.lang.Integer"); + final AxContextSchema axSchema2 = + new AxContextSchema(new AxArtifactKey("StringType", "0.0.1"), "Java", "java.lang.String"); + final AxContextSchema axSchema3 = new AxContextSchema(new AxArtifactKey("KeyType", "0.0.1"), "Java", + "org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey"); + final AxContextSchema axSchema4 = new AxContextSchema(new AxArtifactKey("MapType", "0.0.1"), "Java", + "org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation"); + final AxContextSchema axSchema5 = + new AxContextSchema(new AxArtifactKey("BigIntType", "0.0.1"), "Java", "java.math.BigInteger"); + final AxContextSchema axSchema6 = new AxContextSchema(new AxArtifactKey("ModelType", "0.0.1"), "Java", + "org.onap.policy.apex.model.basicmodel.concepts.AxModel"); + + final AxContextSchemas dataTypes = new AxContextSchemas(new AxArtifactKey("Schemas", "0.0.1")); + dataTypes.getSchemasMap().put(axSchema0.getKey(), axSchema0); + dataTypes.getSchemasMap().put(axSchema1.getKey(), axSchema1); + dataTypes.getSchemasMap().put(axSchema2.getKey(), axSchema2); + dataTypes.getSchemasMap().put(axSchema3.getKey(), axSchema3); + dataTypes.getSchemasMap().put(axSchema4.getKey(), axSchema4); + dataTypes.getSchemasMap().put(axSchema5.getKey(), axSchema5); + dataTypes.getSchemasMap().put(axSchema6.getKey(), axSchema6); + + final AxEvents eventMap = new AxEvents(new AxArtifactKey("smallEventMap", "0.0.1")); + + final AxEvent event0 = new AxEvent(new AxArtifactKey("event0", "0.0.1"), + "org.onap.policy.apex.model.eventmodel.events", "Source", "Target"); + event0.getParameterMap().put("par0", + new AxField(new AxReferenceKey(event0.getKey(), "par0"), axSchema0.getKey())); + event0.getParameterMap().put("par1", + new AxField(new AxReferenceKey(event0.getKey(), "par1"), axSchema1.getKey())); + event0.getParameterMap().put("par2", + new AxField(new AxReferenceKey(event0.getKey(), "par2"), axSchema2.getKey())); + event0.getParameterMap().put("par3", + new AxField(new AxReferenceKey(event0.getKey(), "par3"), axSchema6.getKey())); + event0.getParameterMap().put("par4", + new AxField(new AxReferenceKey(event0.getKey(), "par4"), axSchema4.getKey())); + event0.getParameterMap().put("par5", + new AxField(new AxReferenceKey(event0.getKey(), "par5"), axSchema5.getKey())); + event0.getParameterMap().put("par6", + new AxField(new AxReferenceKey(event0.getKey(), "par6"), axSchema5.getKey())); + eventMap.getEventMap().put(event0.getKey(), event0); + + final AxEvent event1 = new AxEvent(new AxArtifactKey("event1", "0.0.1"), + "org.onap.policy.apex.model.eventmodel.events", "Source", "Target"); + event1.getParameterMap().put("theOnlyPar", + new AxField(new AxReferenceKey(event1.getKey(), "theOnlyPar"), axSchema3.getKey())); + eventMap.getEventMap().put(event1.getKey(), event1); + + final AxEvent event2 = new AxEvent(new AxArtifactKey("event2", "0.0.1"), + "org.onap.policy.apex.model.eventmodel.events", "Source", "Target"); + eventMap.getEventMap().put(event2.getKey(), event2); + + final AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey("KeyInfoMapKey", "0.0.1")); + + final AxEventModel eventModel = + new AxEventModel(new AxArtifactKey("EventModel", "0.0.1"), dataTypes, keyInformation, eventMap); + keyInformation.generateKeyInfo(eventModel); + + eventModel.validate(new AxValidationResult()); + return eventModel; + } + + @Override + public AxEventModel getInvalidModel() { + final AxContextSchema axSchema0 = + new AxContextSchema(new AxArtifactKey("BooleanType", "0.0.1"), "Java", "java.lang.Zoolean"); + final AxContextSchema axSchema1 = + new AxContextSchema(new AxArtifactKey("IntType", "0.0.1"), "Java", "java.lang.Integer"); + final AxContextSchema axSchema2 = + new AxContextSchema(new AxArtifactKey("StringType", "0.0.1"), "Java", "java.lang.String"); + final AxContextSchema axSchema3 = + new AxContextSchema(new AxArtifactKey("SetType", "0.0.1"), "Java", "java.util.Set"); + final AxContextSchema axSchema4 = + new AxContextSchema(new AxArtifactKey("MapType", "0.0.1"), "Java", "java.util.Map"); + final AxContextSchema axSchema5 = + new AxContextSchema(new AxArtifactKey("BigIntType", "0.0.1"), "Java", "java.math.BigInteger"); + + final AxContextSchemas dataTypes = new AxContextSchemas(new AxArtifactKey("Schemas", "0.0.1")); + dataTypes.getSchemasMap().put(axSchema0.getKey(), axSchema0); + dataTypes.getSchemasMap().put(axSchema1.getKey(), axSchema1); + dataTypes.getSchemasMap().put(axSchema2.getKey(), axSchema2); + dataTypes.getSchemasMap().put(axSchema3.getKey(), axSchema3); + dataTypes.getSchemasMap().put(axSchema4.getKey(), axSchema4); + dataTypes.getSchemasMap().put(axSchema5.getKey(), axSchema5); + + final AxEvents eventMap = new AxEvents(new AxArtifactKey("smallEventMap", "0.0.1")); + + final AxEvent event0 = + new AxEvent(new AxArtifactKey("event0", "0.0.1"), "org.onap.policy.apex.model.eventmodel.events"); + event0.getParameterMap().put("par0", + new AxField(new AxReferenceKey(event0.getKey(), "par0"), axSchema0.getKey())); + event0.getParameterMap().put("par1", + new AxField(new AxReferenceKey(event0.getKey(), "par1"), axSchema1.getKey())); + event0.getParameterMap().put("par2", + new AxField(new AxReferenceKey(event0.getKey(), "par2"), axSchema2.getKey())); + event0.getParameterMap().put("par3", + new AxField(new AxReferenceKey(event0.getKey(), "par3"), axSchema3.getKey())); + event0.getParameterMap().put("par4", + new AxField(new AxReferenceKey(event0.getKey(), "par4"), axSchema4.getKey())); + event0.getParameterMap().put("par5", + new AxField(new AxReferenceKey(event0.getKey(), "par5"), axSchema5.getKey())); + event0.getParameterMap().put("par6", + new AxField(new AxReferenceKey(event0.getKey(), "par6"), axSchema5.getKey())); + eventMap.getEventMap().put(event0.getKey(), event0); + + final AxEvent event1 = + new AxEvent(new AxArtifactKey("event1", "0.0.1"), "org.onap.policy.apex.model.eventmodel.events"); + event1.getParameterMap().put("theOnlyPar", + new AxField(new AxReferenceKey(event0.getKey(), "theOnlyPar"), axSchema3.getKey())); + eventMap.getEventMap().put(event1.getKey(), event1); + + final AxEvent event2 = + new AxEvent(new AxArtifactKey("event2", "0.0.1"), "org.onap.policy.apex.model.eventmodel.events"); + eventMap.getEventMap().put(event2.getKey(), event1); + + final AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey("KeyInfoMapKey", "0.0.1")); + + final AxEventModel eventModel = + new AxEventModel(new AxArtifactKey("smallEventModel", "0.0.1"), dataTypes, keyInformation, eventMap); + + return eventModel; + } + + @Override + public AxEventModel getMalstructuredModel() { + final AxContextSchema axSchema3 = + new AxContextSchema(new AxArtifactKey("SetType", "0.0.1"), "Java", "java.util.Set"); + final AxContextSchemas dataTypes = new AxContextSchemas(new AxArtifactKey("Schemas", "0.0.1")); + dataTypes.getSchemasMap().put(axSchema3.getKey(), axSchema3); + + final AxEvents eventMap = new AxEvents(new AxArtifactKey("smallEventMap", "0.0.1")); + + final AxEvent event1 = + new AxEvent(new AxArtifactKey("event1", "0.0.1"), "org.onap.policy.apex.model.eventmodel.events"); + event1.getParameterMap().put("theOnlyPar", + new AxField(new AxReferenceKey(event1.getKey(), "theOnlyPar"), axSchema3.getKey())); + eventMap.getEventMap().put(event1.getKey(), event1); + + final AxEvent event2 = + new AxEvent(new AxArtifactKey("event2", "0.0.1"), "org.onap.policy.apex.model.eventmodel.events"); + eventMap.getEventMap().put(event2.getKey(), event1); + + final AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey("KeyInfoMapKey", "0.0.1")); + + final AxEventModel eventModel = + new AxEventModel(new AxArtifactKey("smallEventModel", "0.0.1"), dataTypes, keyInformation, eventMap); + + eventModel.validate(new AxValidationResult()); + + return eventModel; + } + + @Override + public AxEventModel getWarningModel() { + final AxContextSchema axSchema0 = + new AxContextSchema(new AxArtifactKey("BooleanType", "0.0.1"), "Java", "java.lang.Boolean"); + final AxContextSchema axSchema1 = + new AxContextSchema(new AxArtifactKey("IntType", "0.0.1"), "Java", "java.lang.Integer"); + final AxContextSchema axSchema2 = + new AxContextSchema(new AxArtifactKey("StringType", "0.0.1"), "Java", "java.lang.String"); + final AxContextSchema axSchema3 = + new AxContextSchema(new AxArtifactKey("SetType", "0.0.1"), "Java", "java.util.Set"); + final AxContextSchema axSchema4 = + new AxContextSchema(new AxArtifactKey("MapType", "0.0.1"), "Java", "java.util.Map"); + final AxContextSchema axSchema5 = + new AxContextSchema(new AxArtifactKey("BigIntType", "0.0.1"), "Java", "java.math.BigInteger"); + final AxContextSchemas dataTypes = new AxContextSchemas(new AxArtifactKey("Schemas", "0.0.1")); + dataTypes.getSchemasMap().put(axSchema0.getKey(), axSchema0); + dataTypes.getSchemasMap().put(axSchema1.getKey(), axSchema1); + dataTypes.getSchemasMap().put(axSchema2.getKey(), axSchema2); + dataTypes.getSchemasMap().put(axSchema3.getKey(), axSchema3); + dataTypes.getSchemasMap().put(axSchema4.getKey(), axSchema4); + dataTypes.getSchemasMap().put(axSchema5.getKey(), axSchema5); + + final AxEvents eventMap = new AxEvents(new AxArtifactKey("smallEventMap", "0.0.1")); + + final AxEvent event0 = new AxEvent(new AxArtifactKey("event0", "0.0.1"), ""); + event0.getParameterMap().put("par0", + new AxField(new AxReferenceKey(event0.getKey(), "par0"), axSchema0.getKey())); + event0.getParameterMap().put("par1", + new AxField(new AxReferenceKey(event0.getKey(), "par1"), axSchema1.getKey())); + event0.getParameterMap().put("par2", + new AxField(new AxReferenceKey(event0.getKey(), "par2"), axSchema2.getKey())); + event0.getParameterMap().put("par3", + new AxField(new AxReferenceKey(event0.getKey(), "par3"), axSchema3.getKey())); + event0.getParameterMap().put("par4", + new AxField(new AxReferenceKey(event0.getKey(), "par4"), axSchema4.getKey())); + event0.getParameterMap().put("par5", + new AxField(new AxReferenceKey(event0.getKey(), "par5"), axSchema5.getKey())); + eventMap.getEventMap().put(event0.getKey(), event0); + + final AxEvent event1 = new AxEvent(new AxArtifactKey("event1", "0.0.1"), ""); + event1.getParameterMap().put("theOnlyPar", + new AxField(new AxReferenceKey(event1.getKey(), "theOnlyPar"), axSchema3.getKey())); + eventMap.getEventMap().put(event1.getKey(), event1); + + final AxEvent event2 = new AxEvent(new AxArtifactKey("event2", "0.0.1"), ""); + eventMap.getEventMap().put(event2.getKey(), event2); + + final AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey("KeyInfoMapKey", "0.0.1")); + + final AxEventModel eventModel = + new AxEventModel(new AxArtifactKey("smallEventModel", "0.0.1"), dataTypes, keyInformation, eventMap); + eventModel.getKeyInformation().generateKeyInfo(eventModel); + eventModel.validate(new AxValidationResult()); + + return eventModel; + } + + @Override + public AxEventModel getObservationModel() { + final AxContextSchema axSchema0 = + new AxContextSchema(new AxArtifactKey("BooleanType", "0.0.1"), "Java", "java.lang.Boolean"); + final AxContextSchema axSchema1 = + new AxContextSchema(new AxArtifactKey("IntType", "0.0.1"), "Java", "java.lang.Integer"); + final AxContextSchema axSchema2 = + new AxContextSchema(new AxArtifactKey("StringType", "0.0.1"), "Java", "java.lang.String"); + final AxContextSchema axSchema3 = + new AxContextSchema(new AxArtifactKey("SetType", "0.0.1"), "Java", "java.util.Set"); + final AxContextSchema axSchema4 = + new AxContextSchema(new AxArtifactKey("MapType", "0.0.1"), "Java", "java.util.Map"); + final AxContextSchema axSchema5 = + new AxContextSchema(new AxArtifactKey("BigIntType", "0.0.1"), "Java", "java.math.BigInteger"); + final AxContextSchemas schemas = new AxContextSchemas(new AxArtifactKey("Schemas", "0.0.1")); + schemas.getSchemasMap().put(axSchema0.getKey(), axSchema0); + schemas.getSchemasMap().put(axSchema1.getKey(), axSchema1); + schemas.getSchemasMap().put(axSchema2.getKey(), axSchema2); + schemas.getSchemasMap().put(axSchema3.getKey(), axSchema3); + schemas.getSchemasMap().put(axSchema4.getKey(), axSchema4); + schemas.getSchemasMap().put(axSchema5.getKey(), axSchema5); + + final AxEvents eventMap = new AxEvents(new AxArtifactKey("smallEventMap", "0.0.1")); + + final AxEvent event0 = + new AxEvent(new AxArtifactKey("event0", "0.0.1"), "org.onap.policy.apex.model.eventmodel.events"); + event0.getParameterMap().put("par0", + new AxField(new AxReferenceKey(event0.getKey(), "par0"), axSchema0.getKey())); + event0.getParameterMap().put("par1", + new AxField(new AxReferenceKey(event0.getKey(), "par1"), axSchema1.getKey())); + event0.getParameterMap().put("par2", + new AxField(new AxReferenceKey(event0.getKey(), "par2"), axSchema2.getKey())); + event0.getParameterMap().put("par3", + new AxField(new AxReferenceKey(event0.getKey(), "par3"), axSchema3.getKey())); + event0.getParameterMap().put("par4", + new AxField(new AxReferenceKey(event0.getKey(), "par4"), axSchema4.getKey())); + event0.getParameterMap().put("par5", + new AxField(new AxReferenceKey(event0.getKey(), "par5"), axSchema5.getKey())); + eventMap.getEventMap().put(event0.getKey(), event0); + + final AxEvent event1 = + new AxEvent(new AxArtifactKey("event1", "0.0.1"), "org.onap.policy.apex.model.eventmodel.events"); + event1.getParameterMap().put("theOnlyPar", + new AxField(new AxReferenceKey(event1.getKey(), "theOnlyPar"), axSchema3.getKey())); + eventMap.getEventMap().put(event1.getKey(), event1); + + final AxEvent event2 = + new AxEvent(new AxArtifactKey("event2", "0.0.1"), "org.onap.policy.apex.model.eventmodel.events"); + eventMap.getEventMap().put(event2.getKey(), event2); + + final AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey("KeyInfoMapKey", "0.0.1")); + + final AxEventModel eventModel = + new AxEventModel(new AxArtifactKey("smallEventModel", "0.0.1"), schemas, keyInformation, eventMap); + eventModel.getKeyInformation().generateKeyInfo(eventModel); + eventModel.validate(new AxValidationResult()); + + return eventModel; + } +} diff --git a/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/handling/TestApexEventModelCreator.java b/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/handling/TestApexEventModelCreator.java deleted file mode 100644 index 039d2305b..000000000 --- a/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/handling/TestApexEventModelCreator.java +++ /dev/null @@ -1,309 +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.model.eventmodel.handling; - -import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; -import org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation; -import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey; -import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult; -import org.onap.policy.apex.model.basicmodel.test.TestApexModelCreator; -import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema; -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.AxEventModel; -import org.onap.policy.apex.model.eventmodel.concepts.AxEvents; -import org.onap.policy.apex.model.eventmodel.concepts.AxField; - -public class TestApexEventModelCreator implements TestApexModelCreator { - - @Override - public AxEventModel getModel() { - final AxContextSchema axSchema0 = - new AxContextSchema(new AxArtifactKey("BooleanType", "0.0.1"), "Java", "java.lang.Boolean"); - final AxContextSchema axSchema1 = - new AxContextSchema(new AxArtifactKey("IntType", "0.0.1"), "Java", "java.lang.Integer"); - final AxContextSchema axSchema2 = - new AxContextSchema(new AxArtifactKey("StringType", "0.0.1"), "Java", "java.lang.String"); - final AxContextSchema axSchema3 = new AxContextSchema(new AxArtifactKey("KeyType", "0.0.1"), "Java", - "org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey"); - final AxContextSchema axSchema4 = new AxContextSchema(new AxArtifactKey("MapType", "0.0.1"), "Java", - "org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation"); - final AxContextSchema axSchema5 = - new AxContextSchema(new AxArtifactKey("BigIntType", "0.0.1"), "Java", "java.math.BigInteger"); - final AxContextSchema axSchema6 = new AxContextSchema(new AxArtifactKey("ModelType", "0.0.1"), "Java", - "org.onap.policy.apex.model.basicmodel.concepts.AxModel"); - - final AxContextSchemas dataTypes = new AxContextSchemas(new AxArtifactKey("Schemas", "0.0.1")); - dataTypes.getSchemasMap().put(axSchema0.getKey(), axSchema0); - dataTypes.getSchemasMap().put(axSchema1.getKey(), axSchema1); - dataTypes.getSchemasMap().put(axSchema2.getKey(), axSchema2); - dataTypes.getSchemasMap().put(axSchema3.getKey(), axSchema3); - dataTypes.getSchemasMap().put(axSchema4.getKey(), axSchema4); - dataTypes.getSchemasMap().put(axSchema5.getKey(), axSchema5); - dataTypes.getSchemasMap().put(axSchema6.getKey(), axSchema6); - - final AxEvents eventMap = new AxEvents(new AxArtifactKey("smallEventMap", "0.0.1")); - - final AxEvent event0 = new AxEvent(new AxArtifactKey("event0", "0.0.1"), - "org.onap.policy.apex.model.eventmodel.events", "Source", "Target"); - event0.getParameterMap().put("par0", - new AxField(new AxReferenceKey(event0.getKey(), "par0"), axSchema0.getKey())); - event0.getParameterMap().put("par1", - new AxField(new AxReferenceKey(event0.getKey(), "par1"), axSchema1.getKey())); - event0.getParameterMap().put("par2", - new AxField(new AxReferenceKey(event0.getKey(), "par2"), axSchema2.getKey())); - event0.getParameterMap().put("par3", - new AxField(new AxReferenceKey(event0.getKey(), "par3"), axSchema6.getKey())); - event0.getParameterMap().put("par4", - new AxField(new AxReferenceKey(event0.getKey(), "par4"), axSchema4.getKey())); - event0.getParameterMap().put("par5", - new AxField(new AxReferenceKey(event0.getKey(), "par5"), axSchema5.getKey())); - event0.getParameterMap().put("par6", - new AxField(new AxReferenceKey(event0.getKey(), "par6"), axSchema5.getKey())); - eventMap.getEventMap().put(event0.getKey(), event0); - - final AxEvent event1 = new AxEvent(new AxArtifactKey("event1", "0.0.1"), - "org.onap.policy.apex.model.eventmodel.events", "Source", "Target"); - event1.getParameterMap().put("theOnlyPar", - new AxField(new AxReferenceKey(event1.getKey(), "theOnlyPar"), axSchema3.getKey())); - eventMap.getEventMap().put(event1.getKey(), event1); - - final AxEvent event2 = new AxEvent(new AxArtifactKey("event2", "0.0.1"), - "org.onap.policy.apex.model.eventmodel.events", "Source", "Target"); - eventMap.getEventMap().put(event2.getKey(), event2); - - final AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey("KeyInfoMapKey", "0.0.1")); - - final AxEventModel eventModel = - new AxEventModel(new AxArtifactKey("EventModel", "0.0.1"), dataTypes, keyInformation, eventMap); - keyInformation.generateKeyInfo(eventModel); - - eventModel.validate(new AxValidationResult()); - return eventModel; - } - - @Override - public AxEventModel getInvalidModel() { - final AxContextSchema axSchema0 = - new AxContextSchema(new AxArtifactKey("BooleanType", "0.0.1"), "Java", "java.lang.Zoolean"); - final AxContextSchema axSchema1 = - new AxContextSchema(new AxArtifactKey("IntType", "0.0.1"), "Java", "java.lang.Integer"); - final AxContextSchema axSchema2 = - new AxContextSchema(new AxArtifactKey("StringType", "0.0.1"), "Java", "java.lang.String"); - final AxContextSchema axSchema3 = - new AxContextSchema(new AxArtifactKey("SetType", "0.0.1"), "Java", "java.util.Set"); - final AxContextSchema axSchema4 = - new AxContextSchema(new AxArtifactKey("MapType", "0.0.1"), "Java", "java.util.Map"); - final AxContextSchema axSchema5 = - new AxContextSchema(new AxArtifactKey("BigIntType", "0.0.1"), "Java", "java.math.BigInteger"); - - final AxContextSchemas dataTypes = new AxContextSchemas(new AxArtifactKey("Schemas", "0.0.1")); - dataTypes.getSchemasMap().put(axSchema0.getKey(), axSchema0); - dataTypes.getSchemasMap().put(axSchema1.getKey(), axSchema1); - dataTypes.getSchemasMap().put(axSchema2.getKey(), axSchema2); - dataTypes.getSchemasMap().put(axSchema3.getKey(), axSchema3); - dataTypes.getSchemasMap().put(axSchema4.getKey(), axSchema4); - dataTypes.getSchemasMap().put(axSchema5.getKey(), axSchema5); - - final AxEvents eventMap = new AxEvents(new AxArtifactKey("smallEventMap", "0.0.1")); - - final AxEvent event0 = - new AxEvent(new AxArtifactKey("event0", "0.0.1"), "org.onap.policy.apex.model.eventmodel.events"); - event0.getParameterMap().put("par0", - new AxField(new AxReferenceKey(event0.getKey(), "par0"), axSchema0.getKey())); - event0.getParameterMap().put("par1", - new AxField(new AxReferenceKey(event0.getKey(), "par1"), axSchema1.getKey())); - event0.getParameterMap().put("par2", - new AxField(new AxReferenceKey(event0.getKey(), "par2"), axSchema2.getKey())); - event0.getParameterMap().put("par3", - new AxField(new AxReferenceKey(event0.getKey(), "par3"), axSchema3.getKey())); - event0.getParameterMap().put("par4", - new AxField(new AxReferenceKey(event0.getKey(), "par4"), axSchema4.getKey())); - event0.getParameterMap().put("par5", - new AxField(new AxReferenceKey(event0.getKey(), "par5"), axSchema5.getKey())); - event0.getParameterMap().put("par6", - new AxField(new AxReferenceKey(event0.getKey(), "par6"), axSchema5.getKey())); - eventMap.getEventMap().put(event0.getKey(), event0); - - final AxEvent event1 = - new AxEvent(new AxArtifactKey("event1", "0.0.1"), "org.onap.policy.apex.model.eventmodel.events"); - event1.getParameterMap().put("theOnlyPar", - new AxField(new AxReferenceKey(event0.getKey(), "theOnlyPar"), axSchema3.getKey())); - eventMap.getEventMap().put(event1.getKey(), event1); - - final AxEvent event2 = - new AxEvent(new AxArtifactKey("event2", "0.0.1"), "org.onap.policy.apex.model.eventmodel.events"); - eventMap.getEventMap().put(event2.getKey(), event1); - - final AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey("KeyInfoMapKey", "0.0.1")); - - final AxEventModel eventModel = - new AxEventModel(new AxArtifactKey("smallEventModel", "0.0.1"), dataTypes, keyInformation, eventMap); - - return eventModel; - } - - @Override - public AxEventModel getMalstructuredModel() { - final AxContextSchema axSchema3 = - new AxContextSchema(new AxArtifactKey("SetType", "0.0.1"), "Java", "java.util.Set"); - final AxContextSchemas dataTypes = new AxContextSchemas(new AxArtifactKey("Schemas", "0.0.1")); - dataTypes.getSchemasMap().put(axSchema3.getKey(), axSchema3); - - final AxEvents eventMap = new AxEvents(new AxArtifactKey("smallEventMap", "0.0.1")); - - final AxEvent event1 = - new AxEvent(new AxArtifactKey("event1", "0.0.1"), "org.onap.policy.apex.model.eventmodel.events"); - event1.getParameterMap().put("theOnlyPar", - new AxField(new AxReferenceKey(event1.getKey(), "theOnlyPar"), axSchema3.getKey())); - eventMap.getEventMap().put(event1.getKey(), event1); - - final AxEvent event2 = - new AxEvent(new AxArtifactKey("event2", "0.0.1"), "org.onap.policy.apex.model.eventmodel.events"); - eventMap.getEventMap().put(event2.getKey(), event1); - - final AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey("KeyInfoMapKey", "0.0.1")); - - final AxEventModel eventModel = - new AxEventModel(new AxArtifactKey("smallEventModel", "0.0.1"), dataTypes, keyInformation, eventMap); - - eventModel.validate(new AxValidationResult()); - - return eventModel; - } - - @Override - public AxEventModel getWarningModel() { - final AxContextSchema axSchema0 = - new AxContextSchema(new AxArtifactKey("BooleanType", "0.0.1"), "Java", "java.lang.Boolean"); - final AxContextSchema axSchema1 = - new AxContextSchema(new AxArtifactKey("IntType", "0.0.1"), "Java", "java.lang.Integer"); - final AxContextSchema axSchema2 = - new AxContextSchema(new AxArtifactKey("StringType", "0.0.1"), "Java", "java.lang.String"); - final AxContextSchema axSchema3 = - new AxContextSchema(new AxArtifactKey("SetType", "0.0.1"), "Java", "java.util.Set"); - final AxContextSchema axSchema4 = - new AxContextSchema(new AxArtifactKey("MapType", "0.0.1"), "Java", "java.util.Map"); - final AxContextSchema axSchema5 = - new AxContextSchema(new AxArtifactKey("BigIntType", "0.0.1"), "Java", "java.math.BigInteger"); - final AxContextSchemas dataTypes = new AxContextSchemas(new AxArtifactKey("Schemas", "0.0.1")); - dataTypes.getSchemasMap().put(axSchema0.getKey(), axSchema0); - dataTypes.getSchemasMap().put(axSchema1.getKey(), axSchema1); - dataTypes.getSchemasMap().put(axSchema2.getKey(), axSchema2); - dataTypes.getSchemasMap().put(axSchema3.getKey(), axSchema3); - dataTypes.getSchemasMap().put(axSchema4.getKey(), axSchema4); - dataTypes.getSchemasMap().put(axSchema5.getKey(), axSchema5); - - final AxEvents eventMap = new AxEvents(new AxArtifactKey("smallEventMap", "0.0.1")); - - final AxEvent event0 = new AxEvent(new AxArtifactKey("event0", "0.0.1"), ""); - event0.getParameterMap().put("par0", - new AxField(new AxReferenceKey(event0.getKey(), "par0"), axSchema0.getKey())); - event0.getParameterMap().put("par1", - new AxField(new AxReferenceKey(event0.getKey(), "par1"), axSchema1.getKey())); - event0.getParameterMap().put("par2", - new AxField(new AxReferenceKey(event0.getKey(), "par2"), axSchema2.getKey())); - event0.getParameterMap().put("par3", - new AxField(new AxReferenceKey(event0.getKey(), "par3"), axSchema3.getKey())); - event0.getParameterMap().put("par4", - new AxField(new AxReferenceKey(event0.getKey(), "par4"), axSchema4.getKey())); - event0.getParameterMap().put("par5", - new AxField(new AxReferenceKey(event0.getKey(), "par5"), axSchema5.getKey())); - eventMap.getEventMap().put(event0.getKey(), event0); - - final AxEvent event1 = new AxEvent(new AxArtifactKey("event1", "0.0.1"), ""); - event1.getParameterMap().put("theOnlyPar", - new AxField(new AxReferenceKey(event1.getKey(), "theOnlyPar"), axSchema3.getKey())); - eventMap.getEventMap().put(event1.getKey(), event1); - - final AxEvent event2 = new AxEvent(new AxArtifactKey("event2", "0.0.1"), ""); - eventMap.getEventMap().put(event2.getKey(), event2); - - final AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey("KeyInfoMapKey", "0.0.1")); - - final AxEventModel eventModel = - new AxEventModel(new AxArtifactKey("smallEventModel", "0.0.1"), dataTypes, keyInformation, eventMap); - eventModel.getKeyInformation().generateKeyInfo(eventModel); - eventModel.validate(new AxValidationResult()); - - return eventModel; - } - - @Override - public AxEventModel getObservationModel() { - final AxContextSchema axSchema0 = - new AxContextSchema(new AxArtifactKey("BooleanType", "0.0.1"), "Java", "java.lang.Boolean"); - final AxContextSchema axSchema1 = - new AxContextSchema(new AxArtifactKey("IntType", "0.0.1"), "Java", "java.lang.Integer"); - final AxContextSchema axSchema2 = - new AxContextSchema(new AxArtifactKey("StringType", "0.0.1"), "Java", "java.lang.String"); - final AxContextSchema axSchema3 = - new AxContextSchema(new AxArtifactKey("SetType", "0.0.1"), "Java", "java.util.Set"); - final AxContextSchema axSchema4 = - new AxContextSchema(new AxArtifactKey("MapType", "0.0.1"), "Java", "java.util.Map"); - final AxContextSchema axSchema5 = - new AxContextSchema(new AxArtifactKey("BigIntType", "0.0.1"), "Java", "java.math.BigInteger"); - final AxContextSchemas schemas = new AxContextSchemas(new AxArtifactKey("Schemas", "0.0.1")); - schemas.getSchemasMap().put(axSchema0.getKey(), axSchema0); - schemas.getSchemasMap().put(axSchema1.getKey(), axSchema1); - schemas.getSchemasMap().put(axSchema2.getKey(), axSchema2); - schemas.getSchemasMap().put(axSchema3.getKey(), axSchema3); - schemas.getSchemasMap().put(axSchema4.getKey(), axSchema4); - schemas.getSchemasMap().put(axSchema5.getKey(), axSchema5); - - final AxEvents eventMap = new AxEvents(new AxArtifactKey("smallEventMap", "0.0.1")); - - final AxEvent event0 = - new AxEvent(new AxArtifactKey("event0", "0.0.1"), "org.onap.policy.apex.model.eventmodel.events"); - event0.getParameterMap().put("par0", - new AxField(new AxReferenceKey(event0.getKey(), "par0"), axSchema0.getKey())); - event0.getParameterMap().put("par1", - new AxField(new AxReferenceKey(event0.getKey(), "par1"), axSchema1.getKey())); - event0.getParameterMap().put("par2", - new AxField(new AxReferenceKey(event0.getKey(), "par2"), axSchema2.getKey())); - event0.getParameterMap().put("par3", - new AxField(new AxReferenceKey(event0.getKey(), "par3"), axSchema3.getKey())); - event0.getParameterMap().put("par4", - new AxField(new AxReferenceKey(event0.getKey(), "par4"), axSchema4.getKey())); - event0.getParameterMap().put("par5", - new AxField(new AxReferenceKey(event0.getKey(), "par5"), axSchema5.getKey())); - eventMap.getEventMap().put(event0.getKey(), event0); - - final AxEvent event1 = - new AxEvent(new AxArtifactKey("event1", "0.0.1"), "org.onap.policy.apex.model.eventmodel.events"); - event1.getParameterMap().put("theOnlyPar", - new AxField(new AxReferenceKey(event1.getKey(), "theOnlyPar"), axSchema3.getKey())); - eventMap.getEventMap().put(event1.getKey(), event1); - - final AxEvent event2 = - new AxEvent(new AxArtifactKey("event2", "0.0.1"), "org.onap.policy.apex.model.eventmodel.events"); - eventMap.getEventMap().put(event2.getKey(), event2); - - final AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey("KeyInfoMapKey", "0.0.1")); - - final AxEventModel eventModel = - new AxEventModel(new AxArtifactKey("smallEventModel", "0.0.1"), schemas, keyInformation, eventMap); - eventModel.getKeyInformation().generateKeyInfo(eventModel); - eventModel.validate(new AxValidationResult()); - - return eventModel; - } -} -- cgit 1.2.3-korg