aboutsummaryrefslogtreecommitdiffstats
path: root/model/basic-model/src/test/java/org
diff options
context:
space:
mode:
authorlapentafd <francesco.lapenta@est.tech>2021-06-02 12:02:46 +0100
committerlapentafd <francesco.lapenta@est.tech>2021-06-08 10:07:11 +0100
commit1418e7fcc3bba8980e1877c6576983583877ec1e (patch)
tree8537c66c29beea9c6f7a28b256ba846d880760d4 /model/basic-model/src/test/java/org
parent328fa34f8ac18d30fec00c7c5f59a05850f631a5 (diff)
Fix Sonar Issues in apex-pdp-model
Changes made into model/basic-model Renamed test classes to match the others Issue-ID: POLICY-3093 Change-Id: I7a0d6046ead42a9165aaf96b89511dd8d064d109 Signed-off-by: lapentafd <francesco.lapenta@est.tech>
Diffstat (limited to 'model/basic-model/src/test/java/org')
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyInfoTest.java17
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/SupportApexBasicModelConceptsTest.java (renamed from model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/SupportApexBasicModelConceptsTester.java)19
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/SupportApexBasicModelTest.java (renamed from model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/SupportApexBasicModelTester.java)4
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/SupportBasicModelTest.java (renamed from model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/SupportBasicModelTester.java)4
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/SupportConceptGetterTest.java (renamed from model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/SupportConceptGetterTester.java)241
5 files changed, 166 insertions, 119 deletions
diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyInfoTest.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyInfoTest.java
index 5a57ba3a6..ff7adcd26 100644
--- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyInfoTest.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyInfoTest.java
@@ -1,7 +1,7 @@
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix-2020 Foundation.
+ * Modifications Copyright (C) 2019-2021 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -70,6 +70,21 @@ public class AxKeyInfoTest {
assertEquals(0, testKeyInfo.compareTo(testKeyInfo));
assertEquals(0, testKeyInfo.compareTo(clonedReferenceKey));
+
+
+ }
+
+ @Test
+ public void testAxKeyValidation() {
+ AxKeyInfo testKeyInfo = new AxKeyInfo();
+
+ AxArtifactKey key = new AxArtifactKey("key", "0.0.1");
+ testKeyInfo.setKey(key);
+
+ UUID uuid = UUID.randomUUID();
+ testKeyInfo.setUuid(uuid);
+ testKeyInfo.setDescription("Key Description");
+
assertNotEquals(0, testKeyInfo.compareTo(null));
assertNotEquals(0, testKeyInfo.compareTo(new AxArtifactKey()));
assertNotEquals(0, testKeyInfo.compareTo(new AxKeyInfo(new AxArtifactKey())));
diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/SupportApexBasicModelConceptsTester.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/SupportApexBasicModelConceptsTest.java
index 8ce072c68..905a27f38 100644
--- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/SupportApexBasicModelConceptsTester.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/SupportApexBasicModelConceptsTest.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2019-2020 Nordix Foundation.
+ * Modifications Copyright (C) 2019-2021 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,7 +42,7 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult.Validat
import org.onap.policy.apex.model.basicmodel.service.ModelService;
import org.onap.policy.apex.model.basicmodel.test.TestApexModel;
-public class SupportApexBasicModelConceptsTester {
+public class SupportApexBasicModelConceptsTest {
TestApexModel<AxModel> testApexModel;
@Before
@@ -91,6 +91,12 @@ public class SupportApexBasicModelConceptsTester {
model.getKeyInformation().generateKeyInfo(model);
assertNotNull(model.getKeyInformation());
+ }
+
+ @Test
+ public void testKeyInformation() {
+
+ final AxModel model = testApexModel.getModel();
final AxKeyInformation keyI = model.getKeyInformation();
final AxKeyInformation clonedKeyI = new AxKeyInformation(keyI);
@@ -138,6 +144,14 @@ public class SupportApexBasicModelConceptsTester {
model.getKeyInformation().getKeyInfoMap().clear();
model.getKeyInformation().generateKeyInfo(model);
assertNotNull(model.getKeyInformation());
+ }
+
+ @Test
+ public void testClonedKey() {
+ final AxModel model = testApexModel.getModel();
+ final AxKeyInformation keyI = model.getKeyInformation();
+ final AxKeyInformation clonedKeyI = new AxKeyInformation(keyI);
+ AxValidationResult result = new AxValidationResult();
clonedKeyI.setKey(AxArtifactKey.getNullKey());
result = new AxValidationResult();
@@ -190,6 +204,7 @@ public class SupportApexBasicModelConceptsTester {
result = clonedKeyI.validate(result);
assertEquals(ValidationResult.VALID, result.getValidationResult());
+ final AxModel clonedModel = new AxModel(model);
clonedModel.setKey(AxArtifactKey.getNullKey());
result = new AxValidationResult();
result = clonedModel.validate(result);
diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/SupportApexBasicModelTester.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/SupportApexBasicModelTest.java
index 064a107e7..1c21b6c33 100644
--- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/SupportApexBasicModelTester.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/SupportApexBasicModelTest.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2020 Nordix Foundation.
+ * Modifications Copyright (C) 2020-2021 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,7 +31,7 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult;
import org.onap.policy.apex.model.basicmodel.dao.DaoParameters;
import org.onap.policy.apex.model.basicmodel.test.TestApexModel;
-public class SupportApexBasicModelTester {
+public class SupportApexBasicModelTest {
TestApexModel<AxModel> testApexModel;
/**
diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/SupportBasicModelTester.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/SupportBasicModelTest.java
index 2761d86da..5fc678ac0 100644
--- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/SupportBasicModelTester.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/SupportBasicModelTest.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2020 Nordix Foundation
+ * Modifications Copyright (C) 2020-2021 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,7 +28,7 @@ import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
import org.onap.policy.apex.model.basicmodel.concepts.AxModel;
import org.onap.policy.apex.model.basicmodel.test.TestApexModel;
-public class SupportBasicModelTester {
+public class SupportBasicModelTest {
@Test
public void testNormalModelCreator() throws ApexException {
diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/SupportConceptGetterTester.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/SupportConceptGetterTest.java
index 786df5258..006c583ec 100644
--- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/SupportConceptGetterTester.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/SupportConceptGetterTest.java
@@ -1,7 +1,7 @@
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2020 Nordix Foundation.
+ * Modifications Copyright (C) 2020-2021 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,119 +35,82 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
import org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo;
import org.onap.policy.apex.model.basicmodel.concepts.AxModel;
-public class SupportConceptGetterTester {
+public class SupportConceptGetterTest {
- @Test
- public void testConceptGetter() throws IOException, ApexException {
- AxModel basicModel = new DummyApexBasicModelCreator().getModel();
- assertNotNull(basicModel);
-
- AxKeyInfo intKI01 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey01", "0.0.1"), UUID.randomUUID(),
- "IntegerKIKey01 description");
- AxKeyInfo intKI11 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey11", "0.0.1"), UUID.randomUUID(),
- "IntegerKIKey11 description");
- AxKeyInfo intKI21 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey21", "0.0.1"), UUID.randomUUID(),
- "IntegerKIKey21 description");
- AxKeyInfo intKI22 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey22", "0.0.2"), UUID.randomUUID(),
- "IntegerKIKey22 description");
- AxKeyInfo intKI23 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey23", "0.0.3"), UUID.randomUUID(),
- "IntegerKIKey23 description");
- AxKeyInfo intKI24 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey24", "0.0.4"), UUID.randomUUID(),
- "IntegerKIKey24 description");
- AxKeyInfo intKI25 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey25", "0.0.5"), UUID.randomUUID(),
- "IntegerKIKey25 description");
- AxKeyInfo intKI26 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey26", "0.0.6"), UUID.randomUUID(),
- "IntegerKIKey26 description");
- AxKeyInfo intKI31 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey31", "0.0.1"), UUID.randomUUID(),
- "IntegerKIKey31 description");
- AxKeyInfo intKI41 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey41", "0.0.1"), UUID.randomUUID(),
- "IntegerKIKey41 description");
- AxKeyInfo intKI51 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey51", "0.0.1"), UUID.randomUUID(),
- "IntegerKIKey51 description");
- AxKeyInfo intKI52 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey52", "0.0.2"), UUID.randomUUID(),
- "IntegerKIKey52 description");
- AxKeyInfo intKI53 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey53", "0.0.3"), UUID.randomUUID(),
- "IntegerKIKey53 description");
- AxKeyInfo intKI54 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey54", "0.0.4"), UUID.randomUUID(),
- "IntegerKIKey54 description");
- AxKeyInfo intKI61 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey61", "0.0.1"), UUID.randomUUID(),
- "IntegerKIKey61 description");
- AxKeyInfo intKI62 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey62", "0.0.2"), UUID.randomUUID(),
- "IntegerKIKey62 description");
- AxKeyInfo intKI63 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey63", "0.0.3"), UUID.randomUUID(),
- "IntegerKIKey63 description");
- AxKeyInfo intKI64 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey64", "0.0.4"), UUID.randomUUID(),
- "IntegerKIKey64 description");
- AxKeyInfo intKI71 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey71", "0.0.1"), UUID.randomUUID(),
- "IntegerKIKey71 description");
- AxKeyInfo intKI81 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey81", "0.0.1"), UUID.randomUUID(),
- "IntegerKIKey81 description");
- AxKeyInfo intKI91 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey91", "0.0.1"), UUID.randomUUID(),
- "IntegerKIKey91 description");
- basicModel.getKeyInformation().getKeyInfoMap().put(intKI31.getKey(), intKI31);
- basicModel.getKeyInformation().getKeyInfoMap().put(intKI24.getKey(), intKI24);
- basicModel.getKeyInformation().getKeyInfoMap().put(intKI11.getKey(), intKI11);
- basicModel.getKeyInformation().getKeyInfoMap().put(intKI64.getKey(), intKI64);
- basicModel.getKeyInformation().getKeyInfoMap().put(intKI41.getKey(), intKI41);
- basicModel.getKeyInformation().getKeyInfoMap().put(intKI51.getKey(), intKI51);
- basicModel.getKeyInformation().getKeyInfoMap().put(intKI23.getKey(), intKI23);
- basicModel.getKeyInformation().getKeyInfoMap().put(intKI81.getKey(), intKI81);
- basicModel.getKeyInformation().getKeyInfoMap().put(intKI71.getKey(), intKI71);
- basicModel.getKeyInformation().getKeyInfoMap().put(intKI01.getKey(), intKI01);
- basicModel.getKeyInformation().getKeyInfoMap().put(intKI91.getKey(), intKI91);
- basicModel.getKeyInformation().getKeyInfoMap().put(intKI52.getKey(), intKI52);
- basicModel.getKeyInformation().getKeyInfoMap().put(intKI53.getKey(), intKI53);
- basicModel.getKeyInformation().getKeyInfoMap().put(intKI62.getKey(), intKI62);
- basicModel.getKeyInformation().getKeyInfoMap().put(intKI54.getKey(), intKI54);
- basicModel.getKeyInformation().getKeyInfoMap().put(intKI26.getKey(), intKI26);
- basicModel.getKeyInformation().getKeyInfoMap().put(intKI22.getKey(), intKI22);
- basicModel.getKeyInformation().getKeyInfoMap().put(intKI25.getKey(), intKI25);
- basicModel.getKeyInformation().getKeyInfoMap().put(intKI21.getKey(), intKI21);
- basicModel.getKeyInformation().getKeyInfoMap().put(intKI61.getKey(), intKI61);
- basicModel.getKeyInformation().getKeyInfoMap().put(intKI63.getKey(), intKI63);
+ private static final AxKeyInfo intKI01 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey01", "0.0.1"),
+ UUID.randomUUID(), "IntegerKIKey01 description");
+ private static final AxKeyInfo intKI11 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey11", "0.0.1"),
+ UUID.randomUUID(), "IntegerKIKey11 description");
+ private static final AxKeyInfo intKI21 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey21", "0.0.1"),
+ UUID.randomUUID(), "IntegerKIKey21 description");
+ private static final AxKeyInfo intKI22 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey22", "0.0.2"),
+ UUID.randomUUID(), "IntegerKIKey22 description");
+ private static final AxKeyInfo intKI23 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey23", "0.0.3"),
+ UUID.randomUUID(), "IntegerKIKey23 description");
+ private static final AxKeyInfo intKI24 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey24", "0.0.4"),
+ UUID.randomUUID(), "IntegerKIKey24 description");
+ private static final AxKeyInfo intKI25 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey25", "0.0.5"),
+ UUID.randomUUID(), "IntegerKIKey25 description");
+ private static final AxKeyInfo intKI26 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey26", "0.0.6"),
+ UUID.randomUUID(), "IntegerKIKey26 description");
+ private static final AxKeyInfo intKI31 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey31", "0.0.1"),
+ UUID.randomUUID(), "IntegerKIKey31 description");
+ private static final AxKeyInfo intKI41 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey41", "0.0.1"),
+ UUID.randomUUID(), "IntegerKIKey41 description");
+ private static final AxKeyInfo intKI51 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey51", "0.0.1"),
+ UUID.randomUUID(), "IntegerKIKey51 description");
+ private static final AxKeyInfo intKI52 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey52", "0.0.2"),
+ UUID.randomUUID(), "IntegerKIKey52 description");
+ private static final AxKeyInfo intKI53 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey53", "0.0.3"),
+ UUID.randomUUID(), "IntegerKIKey53 description");
+ private static final AxKeyInfo intKI54 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey54", "0.0.4"),
+ UUID.randomUUID(), "IntegerKIKey54 description");
+ private static final AxKeyInfo intKI61 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey61", "0.0.1"),
+ UUID.randomUUID(), "IntegerKIKey61 description");
+ private static final AxKeyInfo intKI62 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey62", "0.0.2"),
+ UUID.randomUUID(), "IntegerKIKey62 description");
+ private static final AxKeyInfo intKI63 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey63", "0.0.3"),
+ UUID.randomUUID(), "IntegerKIKey63 description");
+ private static final AxKeyInfo intKI64 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey64", "0.0.4"),
+ UUID.randomUUID(), "IntegerKIKey64 description");
+ private static final AxKeyInfo intKI71 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey71", "0.0.1"),
+ UUID.randomUUID(), "IntegerKIKey71 description");
+ private static final AxKeyInfo intKI81 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey81", "0.0.1"),
+ UUID.randomUUID(), "IntegerKIKey81 description");
+ private static final AxKeyInfo intKI91 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey91", "0.0.1"),
+ UUID.randomUUID(), "IntegerKIKey91 description");
+ private static final AxKeyInfo floatKI01 = new AxKeyInfo(new AxArtifactKey("FloatKIKey01", "0.0.1"),
+ UUID.randomUUID(), "IntegerKIKey01 description");
+ private static final AxKeyInfo floatKI11 = new AxKeyInfo(new AxArtifactKey("FloatKIKey11", "0.0.1"),
+ UUID.randomUUID(), "IntegerKIKey11 description");
+ private static final AxKeyInfo floatKI21 = new AxKeyInfo(new AxArtifactKey("FloatKIKey21", "0.0.1"),
+ UUID.randomUUID(), "IntegerKIKey21 description");
+ private static final AxKeyInfo floatKI31 = new AxKeyInfo(new AxArtifactKey("FloatKIKey31", "0.0.1"),
+ UUID.randomUUID(), "IntegerKIKey31 description");
+ private static final AxKeyInfo floatKI41 = new AxKeyInfo(new AxArtifactKey("FloatKIKey41", "0.0.1"),
+ UUID.randomUUID(), "IntegerKIKey41 description");
+ private static final AxKeyInfo floatKI51 = new AxKeyInfo(new AxArtifactKey("FloatKIKey51", "0.0.1"),
+ UUID.randomUUID(), "IntegerKIKey51 description");
+ private static final AxKeyInfo floatKI61 = new AxKeyInfo(new AxArtifactKey("FloatKIKey61", "0.0.1"),
+ UUID.randomUUID(), "IntegerKIKey61 description");
+ private static final AxKeyInfo floatKI71 = new AxKeyInfo(new AxArtifactKey("FloatKIKey71", "0.0.1"),
+ UUID.randomUUID(), "IntegerKIKey71 description");
+ private static final AxKeyInfo floatKI81 = new AxKeyInfo(new AxArtifactKey("FloatKIKey81", "0.0.1"),
+ UUID.randomUUID(), "IntegerKIKey81 description");
+ private static final AxKeyInfo floatKI82 = new AxKeyInfo(new AxArtifactKey("FloatKIKey82", "0.0.2"),
+ UUID.randomUUID(), "IntegerKIKey82 description");
+ private static final AxKeyInfo floatKI83 = new AxKeyInfo(new AxArtifactKey("FloatKIKey83", "0.0.3"),
+ UUID.randomUUID(), "IntegerKIKey83 description");
+ private static final AxKeyInfo floatKI91 = new AxKeyInfo(new AxArtifactKey("FloatKIKey91", "0.0.1"),
+ UUID.randomUUID(), "IntegerKIKey91 description");
+ private static final AxKeyInfo floatKI92 = new AxKeyInfo(new AxArtifactKey("FloatKIKey92", "0.0.2"),
+ UUID.randomUUID(), "IntegerKIKey92 description");
+ private static final AxKeyInfo floatKI93 = new AxKeyInfo(new AxArtifactKey("FloatKIKey93", "0.0.3"),
+ UUID.randomUUID(), "IntegerKIKey93 description");
- AxKeyInfo floatKI01 = new AxKeyInfo(new AxArtifactKey("FloatKIKey01", "0.0.1"), UUID.randomUUID(),
- "IntegerKIKey01 description");
- AxKeyInfo floatKI11 = new AxKeyInfo(new AxArtifactKey("FloatKIKey11", "0.0.1"), UUID.randomUUID(),
- "IntegerKIKey11 description");
- AxKeyInfo floatKI21 = new AxKeyInfo(new AxArtifactKey("FloatKIKey21", "0.0.1"), UUID.randomUUID(),
- "IntegerKIKey21 description");
- AxKeyInfo floatKI31 = new AxKeyInfo(new AxArtifactKey("FloatKIKey31", "0.0.1"), UUID.randomUUID(),
- "IntegerKIKey31 description");
- AxKeyInfo floatKI41 = new AxKeyInfo(new AxArtifactKey("FloatKIKey41", "0.0.1"), UUID.randomUUID(),
- "IntegerKIKey41 description");
- AxKeyInfo floatKI51 = new AxKeyInfo(new AxArtifactKey("FloatKIKey51", "0.0.1"), UUID.randomUUID(),
- "IntegerKIKey51 description");
- AxKeyInfo floatKI61 = new AxKeyInfo(new AxArtifactKey("FloatKIKey61", "0.0.1"), UUID.randomUUID(),
- "IntegerKIKey61 description");
- AxKeyInfo floatKI71 = new AxKeyInfo(new AxArtifactKey("FloatKIKey71", "0.0.1"), UUID.randomUUID(),
- "IntegerKIKey71 description");
- AxKeyInfo floatKI81 = new AxKeyInfo(new AxArtifactKey("FloatKIKey81", "0.0.1"), UUID.randomUUID(),
- "IntegerKIKey81 description");
- AxKeyInfo floatKI82 = new AxKeyInfo(new AxArtifactKey("FloatKIKey82", "0.0.2"), UUID.randomUUID(),
- "IntegerKIKey82 description");
- AxKeyInfo floatKI83 = new AxKeyInfo(new AxArtifactKey("FloatKIKey83", "0.0.3"), UUID.randomUUID(),
- "IntegerKIKey83 description");
- AxKeyInfo floatKI91 = new AxKeyInfo(new AxArtifactKey("FloatKIKey91", "0.0.1"), UUID.randomUUID(),
- "IntegerKIKey91 description");
- AxKeyInfo floatKI92 = new AxKeyInfo(new AxArtifactKey("FloatKIKey92", "0.0.2"), UUID.randomUUID(),
- "IntegerKIKey92 description");
- AxKeyInfo floatKI93 = new AxKeyInfo(new AxArtifactKey("FloatKIKey93", "0.0.3"), UUID.randomUUID(),
- "IntegerKIKey93 description");
- basicModel.getKeyInformation().getKeyInfoMap().put(floatKI11.getKey(), floatKI11);
- basicModel.getKeyInformation().getKeyInfoMap().put(floatKI83.getKey(), floatKI83);
- basicModel.getKeyInformation().getKeyInfoMap().put(floatKI51.getKey(), floatKI51);
- basicModel.getKeyInformation().getKeyInfoMap().put(floatKI71.getKey(), floatKI71);
- basicModel.getKeyInformation().getKeyInfoMap().put(floatKI21.getKey(), floatKI21);
- basicModel.getKeyInformation().getKeyInfoMap().put(floatKI81.getKey(), floatKI81);
- basicModel.getKeyInformation().getKeyInfoMap().put(floatKI92.getKey(), floatKI92);
- basicModel.getKeyInformation().getKeyInfoMap().put(floatKI91.getKey(), floatKI91);
- basicModel.getKeyInformation().getKeyInfoMap().put(floatKI01.getKey(), floatKI01);
- basicModel.getKeyInformation().getKeyInfoMap().put(floatKI82.getKey(), floatKI82);
- basicModel.getKeyInformation().getKeyInfoMap().put(floatKI61.getKey(), floatKI61);
- basicModel.getKeyInformation().getKeyInfoMap().put(floatKI41.getKey(), floatKI41);
- basicModel.getKeyInformation().getKeyInfoMap().put(floatKI31.getKey(), floatKI31);
- basicModel.getKeyInformation().getKeyInfoMap().put(floatKI93.getKey(), floatKI93);
+ @Test
+ public void testConceptGetterInteger() {
+ AxModel basicModel = setTestBasicModel();
assertNull(basicModel.getKeyInformation().get("NonExistantKey", "0.0.6"));
assertEquals(intKI26, basicModel.getKeyInformation().get("IntegerKIKey26", "0.0.6"));
@@ -167,6 +130,11 @@ public class SupportConceptGetterTester {
assertEquals(intKI71, basicModel.getKeyInformation().get("IntegerKIKey71"));
assertEquals(intKI81, basicModel.getKeyInformation().get("IntegerKIKey81"));
assertEquals(intKI91, basicModel.getKeyInformation().get("IntegerKIKey91"));
+ }
+
+ @Test
+ public void testConceptGetterFloat() {
+ AxModel basicModel = setTestBasicModel();
assertEquals(floatKI01, basicModel.getKeyInformation().get("FloatKIKey01"));
assertEquals(floatKI11, basicModel.getKeyInformation().get("FloatKIKey11"));
@@ -178,6 +146,11 @@ public class SupportConceptGetterTester {
assertEquals(floatKI71, basicModel.getKeyInformation().get("FloatKIKey71"));
assertEquals(floatKI83, basicModel.getKeyInformation().get("FloatKIKey83"));
assertEquals(floatKI93, basicModel.getKeyInformation().get("FloatKIKey93"));
+ }
+
+ @Test
+ public void testMarshalling() throws IOException, ApexException {
+ AxModel basicModel = setTestBasicModel();
// Ensure marshalling and unmarshalling is OK
ApexModelReader<AxModel> modelReader = new ApexModelReader<AxModel>(AxModel.class);
@@ -197,4 +170,48 @@ public class SupportConceptGetterTester {
assertNotNull(readXmlModel.getKeyInformation().get("FloatKIKey"));
tempXmlFile.delete();
}
+
+ private AxModel setTestBasicModel() {
+ AxModel basicModel = new DummyApexBasicModelCreator().getModel();
+ assertNotNull(basicModel);
+
+ basicModel.getKeyInformation().getKeyInfoMap().put(intKI31.getKey(), intKI31);
+ basicModel.getKeyInformation().getKeyInfoMap().put(intKI24.getKey(), intKI24);
+ basicModel.getKeyInformation().getKeyInfoMap().put(intKI11.getKey(), intKI11);
+ basicModel.getKeyInformation().getKeyInfoMap().put(intKI64.getKey(), intKI64);
+ basicModel.getKeyInformation().getKeyInfoMap().put(intKI41.getKey(), intKI41);
+ basicModel.getKeyInformation().getKeyInfoMap().put(intKI51.getKey(), intKI51);
+ basicModel.getKeyInformation().getKeyInfoMap().put(intKI23.getKey(), intKI23);
+ basicModel.getKeyInformation().getKeyInfoMap().put(intKI81.getKey(), intKI81);
+ basicModel.getKeyInformation().getKeyInfoMap().put(intKI71.getKey(), intKI71);
+ basicModel.getKeyInformation().getKeyInfoMap().put(intKI01.getKey(), intKI01);
+ basicModel.getKeyInformation().getKeyInfoMap().put(intKI91.getKey(), intKI91);
+ basicModel.getKeyInformation().getKeyInfoMap().put(intKI52.getKey(), intKI52);
+ basicModel.getKeyInformation().getKeyInfoMap().put(intKI53.getKey(), intKI53);
+ basicModel.getKeyInformation().getKeyInfoMap().put(intKI62.getKey(), intKI62);
+ basicModel.getKeyInformation().getKeyInfoMap().put(intKI54.getKey(), intKI54);
+ basicModel.getKeyInformation().getKeyInfoMap().put(intKI26.getKey(), intKI26);
+ basicModel.getKeyInformation().getKeyInfoMap().put(intKI22.getKey(), intKI22);
+ basicModel.getKeyInformation().getKeyInfoMap().put(intKI25.getKey(), intKI25);
+ basicModel.getKeyInformation().getKeyInfoMap().put(intKI21.getKey(), intKI21);
+ basicModel.getKeyInformation().getKeyInfoMap().put(intKI61.getKey(), intKI61);
+ basicModel.getKeyInformation().getKeyInfoMap().put(intKI63.getKey(), intKI63);
+
+ basicModel.getKeyInformation().getKeyInfoMap().put(floatKI11.getKey(), floatKI11);
+ basicModel.getKeyInformation().getKeyInfoMap().put(floatKI83.getKey(), floatKI83);
+ basicModel.getKeyInformation().getKeyInfoMap().put(floatKI51.getKey(), floatKI51);
+ basicModel.getKeyInformation().getKeyInfoMap().put(floatKI71.getKey(), floatKI71);
+ basicModel.getKeyInformation().getKeyInfoMap().put(floatKI21.getKey(), floatKI21);
+ basicModel.getKeyInformation().getKeyInfoMap().put(floatKI81.getKey(), floatKI81);
+ basicModel.getKeyInformation().getKeyInfoMap().put(floatKI92.getKey(), floatKI92);
+ basicModel.getKeyInformation().getKeyInfoMap().put(floatKI91.getKey(), floatKI91);
+ basicModel.getKeyInformation().getKeyInfoMap().put(floatKI01.getKey(), floatKI01);
+ basicModel.getKeyInformation().getKeyInfoMap().put(floatKI82.getKey(), floatKI82);
+ basicModel.getKeyInformation().getKeyInfoMap().put(floatKI61.getKey(), floatKI61);
+ basicModel.getKeyInformation().getKeyInfoMap().put(floatKI41.getKey(), floatKI41);
+ basicModel.getKeyInformation().getKeyInfoMap().put(floatKI31.getKey(), floatKI31);
+ basicModel.getKeyInformation().getKeyInfoMap().put(floatKI93.getKey(), floatKI93);
+
+ return basicModel;
+ }
}