summaryrefslogtreecommitdiffstats
path: root/context/context-test-utils/src
diff options
context:
space:
mode:
Diffstat (limited to 'context/context-test-utils/src')
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextBooleanItem.java111
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextByteItem.java109
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateItem.java241
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateLocaleItem.java253
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateTzItem.java192
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDoubleItem.java112
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextFloatItem.java109
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextIntItem.java118
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextLongItem.java110
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextLongObjectItem.java116
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextStringItem.java116
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextTreeMapItem.java122
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextTreeSetItem.java132
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestExternalContextItem.java434
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestGlobalContextItem.java434
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestPolicyContextItem.java241
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/package-info.java27
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextAlbumUpdate.java120
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextInstantiation.java554
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextUpdate.java177
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/SequentialContextInstantiation.java385
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/package-info.java27
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/entities/ArtifactKeyTestEntity.java257
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/entities/ReferenceKeyTestEntity.java260
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/entities/package-info.java26
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/factory/TestContextAlbumFactory.java216
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/factory/package-info.java27
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/lock/modifier/AlbumModifier.java42
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/lock/modifier/LockType.java101
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/lock/modifier/NoLockAlbumModifier.java55
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/lock/modifier/ReadLockAlbumModifier.java70
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/lock/modifier/SingleValueWriteLockAlbumModifier.java74
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/lock/modifier/WriteLockAlbumModifier.java72
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/lock/modifier/package-info.java25
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContext.java165
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextJvm.java230
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextJvmThread.java135
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextThread.java101
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/package-info.java27
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/ConfigrationProvider.java145
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/ConfigrationProviderImpl.java264
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/Constants.java80
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/IntegrationThreadFactory.java59
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/NetworkUtils.java66
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/ZooKeeperServerServiceProvider.java105
-rwxr-xr-xcontext/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/package-info.java27
-rw-r--r--context/context-test-utils/src/site/css/site.css100
-rw-r--r--context/context-test-utils/src/site/images/logos.pngbin162383 -> 0 bytes
-rw-r--r--context/context-test-utils/src/site/site.xml28
-rw-r--r--context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/concepts/ConceptUncoveredTest.java715
-rw-r--r--context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/distribution/ContextAlbumUpdateTest.java100
-rw-r--r--context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/distribution/ContextInstantiationTest.java105
-rw-r--r--context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/distribution/ContextUpdateTest.java106
-rw-r--r--context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/distribution/SequentialContextInstantiationTest.java109
-rw-r--r--context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/entities/ArtifactKeyTestEntityTest.java113
-rw-r--r--context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/entities/ReferenceTestEntityTest.java114
-rw-r--r--context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/locking/ConcurrentContextTest.java181
-rw-r--r--context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/persistence/PersistentContextInstantiationTest.java224
-rw-r--r--context/context-test-utils/src/test/resources/META-INF/persistence.xml50
59 files changed, 0 insertions, 8814 deletions
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextBooleanItem.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextBooleanItem.java
deleted file mode 100644
index 436624b7d..000000000
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextBooleanItem.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.apex.context.test.concepts;
-
-import java.io.Serializable;
-
-/**
- * The Class TestContextItem000.
- */
-public class TestContextBooleanItem implements Serializable {
- private static final int HASH_PRIME_1 = 31;
- private static final int HASH_PRIME_2 = 1231;
- private static final int HASH_PRIME_3 = 1237;
-
- private static final long serialVersionUID = 7241008665286367796L;
-
- private boolean flag = false;
-
- /**
- * The Constructor.
- */
- public TestContextBooleanItem() {}
-
- /**
- * The Constructor.
- *
- * @param flag the flag
- */
- public TestContextBooleanItem(final Boolean flag) {
- this.flag = flag;
- }
-
- /**
- * Gets the flag.
- *
- * @return the flag
- */
- public boolean getFlag() {
- return flag;
- }
-
- /**
- * Sets the flag.
- *
- * @param flag the flag
- */
- public void setFlag(final boolean flag) {
- this.flag = flag;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- final int prime = HASH_PRIME_1;
- int result = 1;
- result = prime * result + (flag ? HASH_PRIME_2 : HASH_PRIME_3);
- return result;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals(final Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- final TestContextBooleanItem other = (TestContextBooleanItem) obj;
- return flag == other.flag;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return "TestContextItem000 [flag=" + flag + "]";
- }
-}
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextByteItem.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextByteItem.java
deleted file mode 100644
index eec5d2b47..000000000
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextByteItem.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.apex.context.test.concepts;
-
-import java.io.Serializable;
-
-/**
- * The Class TestContextItem001.
- */
-public class TestContextByteItem implements Serializable {
- private static final long serialVersionUID = 1361938145823720386L;
-
- private static final int HASH_PRIME_1 = 31;
-
- private byte byteValue = 0;
-
- /**
- * The Constructor.
- */
- public TestContextByteItem() {}
-
- /**
- * The Constructor.
- *
- * @param byteValue the byte value
- */
- public TestContextByteItem(final Byte byteValue) {
- this.byteValue = byteValue;
- }
-
- /**
- * Gets the byte value.
- *
- * @return the byte value
- */
- public byte getByteValue() {
- return byteValue;
- }
-
- /**
- * Sets the byte value.
- *
- * @param byteValue the byte value
- */
- public void setByteValue(final byte byteValue) {
- this.byteValue = byteValue;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- final int prime = HASH_PRIME_1;
- int result = 1;
- result = prime * result + byteValue;
- return result;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals(final Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- final TestContextByteItem other = (TestContextByteItem) obj;
- return byteValue == other.byteValue;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return "TestContextItem001 [byteValue=" + byteValue + "]";
- }
-}
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateItem.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateItem.java
deleted file mode 100644
index 89d2a428f..000000000
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateItem.java
+++ /dev/null
@@ -1,241 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.apex.context.test.concepts;
-
-import java.io.Serializable;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.TimeZone;
-
-/**
- * The Class TestContextItem008.
- */
-public class TestContextDateItem implements Serializable {
- private static final long serialVersionUID = -6984963129968805460L;
-
- private static final int HASH_PRIME_1 = 31;
- private static final int FOUR_BYTES = 32;
-
- private long time;
-
- private int year;
- private int month;
- private int day;
- private int hour;
- private int minute;
- private int second;
- private int milliSecond;
-
- /**
- * The Constructor.
- */
- public TestContextDateItem() {
- this(new Date(System.currentTimeMillis()));
- }
-
- /**
- * The Constructor.
- *
- * @param dateValue the date value
- */
- public TestContextDateItem(final Date dateValue) {
- if (dateValue != null) {
- setDateValue(dateValue.getTime());
- }
- else {
- new Date(0);
- }
- }
-
- /**
- * The Constructor.
- *
- * @param time the time
- */
- public TestContextDateItem(final long time) {
- setDateValue(time);
- }
-
- /**
- * Gets the time.
- *
- * @return the time
- */
- public long getTime() {
- return time;
- }
-
- /**
- * Gets the year.
- *
- * @return the year
- */
- public int getYear() {
- return year;
- }
-
- /**
- * Gets the month.
- *
- * @return the month
- */
- public int getMonth() {
- return month;
- }
-
- /**
- * Gets the day.
- *
- * @return the day
- */
- public int getDay() {
- return day;
- }
-
- /**
- * Gets the hour.
- *
- * @return the hour
- */
- public int getHour() {
- return hour;
- }
-
- /**
- * Gets the minute.
- *
- * @return the minute
- */
- public int getMinute() {
- return minute;
- }
-
- /**
- * Gets the second.
- *
- * @return the second
- */
- public int getSecond() {
- return second;
- }
-
- /**
- * Gets the milli second.
- *
- * @return the milli second
- */
- public int getMilliSecond() {
- return milliSecond;
- }
-
- /**
- * Gets the date value.
- *
- * @return the date value
- */
- public Date getDateValue() {
- return new Date(time);
- }
-
- /**
- * Sets the date value.
- *
- * @param dateValue the date value
- */
- public void setDateValue(final Date dateValue) {
- if (dateValue != null) {
- setDateValue(dateValue.getTime());
- }
- }
-
- /**
- * Sets the date value.
- *
- * @param dateValue the date value
- */
- public void setDateValue(final long dateValue) {
- this.time = dateValue;
-
- final Calendar calendar = Calendar.getInstance();
- calendar.setTimeZone(TimeZone.getTimeZone("UTC"));
- calendar.setTimeInMillis(time);
-
- year = calendar.get(Calendar.YEAR);
- month = calendar.get(Calendar.MONTH);
- day = calendar.get(Calendar.DAY_OF_MONTH);
- hour = calendar.get(Calendar.HOUR);
- minute = calendar.get(Calendar.MINUTE);
- second = calendar.get(Calendar.SECOND);
- milliSecond = calendar.get(Calendar.MILLISECOND);
- }
-
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- final int prime = HASH_PRIME_1;
- int result = 1;
- result = prime * result + day;
- result = prime * result + hour;
- result = prime * result + milliSecond;
- result = prime * result + minute;
- result = prime * result + month;
- result = prime * result + second;
- result = prime * result + (int) (time ^ (time >>> FOUR_BYTES));
- result = prime * result + year;
- return result;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals(final Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- final TestContextDateItem other = (TestContextDateItem) obj;
- return time == other.time;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return "TestContextItem008 [time=" + time + ", year=" + year + ", month=" + month + ", day=" + day + ", hour="
- + hour + ", minute=" + minute + ", second=" + second + ", milliSecond=" + milliSecond + "]";
- }
-}
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateLocaleItem.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateLocaleItem.java
deleted file mode 100644
index 4914a1bc5..000000000
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateLocaleItem.java
+++ /dev/null
@@ -1,253 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.apex.context.test.concepts;
-
-import java.io.Serializable;
-import java.util.Locale;
-import java.util.TimeZone;
-
-/**
- * The Class TestContextItem00A.
- */
-public class TestContextDateLocaleItem implements Serializable {
- private static final long serialVersionUID = -6579903685538233754L;
-
- private static final int HASH_PRIME_1 = 31;
- private static final int HASH_PRIME_2 = 1231;
- private static final int HASH_PRIME_3 = 1237;
-
- private TestContextDateItem dateValue = new TestContextDateItem(System.currentTimeMillis());
- private String timeZoneString = TimeZone.getTimeZone("Europe/Dublin").getDisplayName();
- private boolean dst = false;
- private int utcOffset = 0;
- private Locale locale = Locale.ENGLISH;
-
- /**
- * The Constructor.
- */
- public TestContextDateLocaleItem() {
- }
-
- /**
- * The Constructor.
- *
- * @param dateValue the date value
- * @param tzValue the tz value
- * @param dst the dst
- * @param utcOffset the utc offset
- * @param language the language
- * @param country the country
- */
- public TestContextDateLocaleItem(final TestContextDateItem dateValue, final String tzValue, final boolean dst,
- final int utcOffset, final String language, final String country) {
- this.dateValue = dateValue;
- this.timeZoneString = TimeZone.getTimeZone(tzValue).getDisplayName();
- this.dst = dst;
- this.utcOffset = utcOffset;
-
- this.locale = new Locale(language, country);
- }
-
- /**
- * The Constructor.
- *
- * @param original the original
- */
- public TestContextDateLocaleItem(final TestContextDateLocaleItem original) {
- this.dateValue = original.dateValue;
- this.timeZoneString = TimeZone.getTimeZone(original.timeZoneString).getDisplayName();
- this.dst = original.dst;
- this.utcOffset = original.utcOffset;
-
- this.locale = new Locale(original.getLocale().getCountry(), original.getLocale().getLanguage());
- }
-
- /**
- * Gets the date value.
- *
- * @return the date value
- */
- public TestContextDateItem getDateValue() {
- return dateValue;
- }
-
- /**
- * Sets the date value.
- *
- * @param dateValue the date value
- */
- public void setDateValue(final TestContextDateItem dateValue) {
- this.dateValue = dateValue;
- }
-
- /**
- * Gets the TZ value.
- *
- * @return the TZ value
- */
- public String getTzValue() {
- return timeZoneString;
- }
-
- /**
- * Sets the TZ value.
- *
- * @param tzValue the TZ value
- */
- public void setTzValue(final String tzValue) {
- if (tzValue != null) {
- this.timeZoneString = TimeZone.getTimeZone(tzValue).getDisplayName();
- } else {
- this.timeZoneString = null;
- }
- }
-
- /**
- * Gets the DST.
- *
- * @return the dst
- */
- public boolean getDst() {
- return dst;
- }
-
- /**
- * Sets the DST.
- *
- * @param newDst the dst
- */
- public void setDst(final boolean newDst) {
- this.dst = newDst;
- }
-
- /**
- * Gets the UTC offset.
- *
- * @return the UTC offset
- */
- public int getUtcOffset() {
- return utcOffset;
- }
-
- /**
- * Sets the UTC offset.
- *
- * @param newUtcOffset the UTC offset
- */
- public void setUtcOffset(final int newUtcOffset) {
- this.utcOffset = newUtcOffset;
- }
-
- /**
- * Gets the locale.
- *
- * @return the locale
- */
- public Locale getLocale() {
- return locale;
- }
-
- /**
- * Sets the locale.
- *
- * @param locale the locale
- */
- public void setLocale(final Locale locale) {
- if (locale != null) {
- this.locale = locale;
- }
- else {
- this.locale = null;
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- final int prime = HASH_PRIME_1;
- int result = 1;
- result = prime * result + ((dateValue == null) ? 0 : dateValue.hashCode());
- result = prime * result + (dst ? HASH_PRIME_2 : HASH_PRIME_3);
- result = prime * result + ((locale == null) ? 0 : locale.hashCode());
- result = prime * result + ((timeZoneString == null) ? 0 : timeZoneString.hashCode());
- result = prime * result + utcOffset;
- return result;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals(final Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- final TestContextDateLocaleItem other = (TestContextDateLocaleItem) obj;
- if (dateValue == null) {
- if (other.dateValue != null) {
- return false;
- }
- } else if (!dateValue.equals(other.dateValue)) {
- return false;
- }
- if (dst != other.dst) {
- return false;
- }
- if (locale == null) {
- if (other.locale != null) {
- return false;
- }
- } else if (!locale.equals(other.locale)) {
- return false;
- }
- if (timeZoneString == null) {
- if (other.timeZoneString != null) {
- return false;
- }
- } else if (!timeZoneString.equals(other.timeZoneString)) {
- return false;
- }
- return utcOffset == other.utcOffset;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return "TestContextItem00A [dateValue=" + dateValue + ", timeZoneString=" + timeZoneString + ", dst=" + dst
- + ", utcOffset=" + utcOffset + ", locale=" + locale + "]";
- }
-}
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateTzItem.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateTzItem.java
deleted file mode 100644
index 15bd0232f..000000000
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateTzItem.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.apex.context.test.concepts;
-
-import java.io.Serializable;
-import java.util.TimeZone;
-
-/**
- * The Class TestContextItem009.
- */
-public class TestContextDateTzItem implements Serializable {
- private static final long serialVersionUID = 5604426823170331706L;
-
- private static final int HASH_PRIME_1 = 31;
- private static final int HASH_PRIME_2 = 1231;
- private static final int HASH_PRIME_3 = 1237;
-
- private TestContextDateItem dateValue = new TestContextDateItem(System.currentTimeMillis());
- private String timeZoneString = TimeZone.getTimeZone("Europe/Dublin").getDisplayName();
- private boolean dst = false;
-
- /**
- * The Constructor.
- */
- public TestContextDateTzItem() {
- dst = true;
- }
-
- /**
- * The Constructor.
- *
- * @param dateValue the date value
- * @param tzValue the tz value
- * @param dst the dst
- */
- public TestContextDateTzItem(final TestContextDateItem dateValue, final String tzValue, final boolean dst) {
- this.dateValue = dateValue;
- this.timeZoneString = TimeZone.getTimeZone(tzValue).getDisplayName();
- this.dst = dst;
- }
-
- /**
- * The Constructor.
- *
- * @param original the original
- */
- public TestContextDateTzItem(final TestContextDateTzItem original) {
- this.dateValue = original.dateValue;
- this.timeZoneString = original.timeZoneString;
- this.dst = original.dst;
- }
-
- /**
- * Gets the date value.
- *
- * @return the date value
- */
- public TestContextDateItem getDateValue() {
- return dateValue;
- }
-
- /**
- * Sets the date value.
- *
- * @param dateValue the date value
- */
- public void setDateValue(final TestContextDateItem dateValue) {
- this.dateValue = dateValue;
- }
-
- /**
- * Gets the TZ value.
- *
- * @return the TZ value
- */
- public String getTzValue() {
- return timeZoneString;
- }
-
- /**
- * Sets the TZ value.
- *
- * @param tzValue the TZ value
- */
- public void setTzValue(final String tzValue) {
- if (tzValue != null) {
- this.timeZoneString = TimeZone.getTimeZone(tzValue).getDisplayName();
- }
- else {
- this.timeZoneString = null;
- }
- }
-
- /**
- * Gets the DST.
- *
- * @return the dst
- */
- public boolean getDst() {
- return dst;
- }
-
- /**
- * Sets the DST.
- *
- * @param newDst the dst
- */
- public void setDst(final boolean newDst) {
- this.dst = newDst;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- final int prime = HASH_PRIME_1;
- int result = 1;
- result = prime * result + ((dateValue == null) ? 0 : dateValue.hashCode());
- result = prime * result + (dst ? HASH_PRIME_2 : HASH_PRIME_3);
- result = prime * result + ((timeZoneString == null) ? 0 : timeZoneString.hashCode());
- return result;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals(final Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- final TestContextDateTzItem other = (TestContextDateTzItem) obj;
- if (dateValue == null) {
- if (other.dateValue != null) {
- return false;
- }
- } else if (!dateValue.equals(other.dateValue)) {
- return false;
- }
- if (dst != other.dst) {
- return false;
- }
- if (timeZoneString == null) {
- if (other.timeZoneString != null) {
- return false;
- }
- }
- else if (!timeZoneString.equals(other.timeZoneString)) {
- return false;
- }
- return true;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return "TestContextItem009 [dateValue=" + dateValue + ", tzValue=" + timeZoneString + ", dst=" + dst + "]";
- }
-}
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDoubleItem.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDoubleItem.java
deleted file mode 100644
index 26d98cdf4..000000000
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDoubleItem.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.apex.context.test.concepts;
-
-import java.io.Serializable;
-
-/**
- * The Class TestContextItem005.
- */
-public class TestContextDoubleItem implements Serializable {
- private static final long serialVersionUID = -2958758261076734821L;
-
- private static final int HASH_PRIME_1 = 31;
- private static final int FOUR_BYTES = 32;
-
- private double doubleValue = 0;
-
- /**
- * The Constructor.
- */
- public TestContextDoubleItem() {}
-
- /**
- * The Constructor.
- *
- * @param doubleValue the double value
- */
- public TestContextDoubleItem(final Double doubleValue) {
- this.doubleValue = doubleValue;
- }
-
- /**
- * Gets the double value.
- *
- * @return the double value
- */
- public double getDoubleValue() {
- return doubleValue;
- }
-
- /**
- * Sets the double value.
- *
- * @param doubleValue the double value
- */
- public void setDoubleValue(final double doubleValue) {
- this.doubleValue = doubleValue;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- final int prime = HASH_PRIME_1;
- int result = 1;
- long temp;
- temp = Double.doubleToLongBits(doubleValue);
- result = prime * result + (int) (temp ^ (temp >>> FOUR_BYTES));
- return result;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals(final Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- final TestContextDoubleItem other = (TestContextDoubleItem) obj;
- return Double.doubleToLongBits(doubleValue) == Double.doubleToLongBits(other.doubleValue);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return "TestContextItem005 [doubleValue=" + doubleValue + "]";
- }
-}
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextFloatItem.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextFloatItem.java
deleted file mode 100644
index 294cf5b55..000000000
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextFloatItem.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.apex.context.test.concepts;
-
-import java.io.Serializable;
-
-/**
- * The Class TestContextItem004.
- */
-public class TestContextFloatItem implements Serializable {
- private static final long serialVersionUID = -3359180576903272400L;
-
- private static final int HASH_PRIME_1 = 31;
-
- private float floatValue = 0;
-
- /**
- * The Constructor.
- */
- public TestContextFloatItem() {}
-
- /**
- * The Constructor.
- *
- * @param floatValue the float value
- */
- public TestContextFloatItem(final Float floatValue) {
- this.floatValue = floatValue;
- }
-
- /**
- * Gets the float value.
- *
- * @return the float value
- */
- public float getFloatValue() {
- return floatValue;
- }
-
- /**
- * Sets the float value.
- *
- * @param floatValue the float value
- */
- public void setFloatValue(final float floatValue) {
- this.floatValue = floatValue;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- final int prime = HASH_PRIME_1;
- int result = 1;
- result = prime * result + Float.floatToIntBits(floatValue);
- return result;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals(final Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- final TestContextFloatItem other = (TestContextFloatItem) obj;
- return Float.floatToIntBits(floatValue) == Float.floatToIntBits(other.floatValue);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return "TestContextItem004 [floatValue=" + floatValue + "]";
- }
-}
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextIntItem.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextIntItem.java
deleted file mode 100644
index 24cfebbc5..000000000
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextIntItem.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.apex.context.test.concepts;
-
-import java.io.Serializable;
-
-/**
- * The Class TestContextItem002.
- */
-public class TestContextIntItem implements Serializable {
- private static final long serialVersionUID = -8978435658277900984L;
-
- private static final int HASH_PRIME_1 = 31;
-
- private int intValue = 0;
-
- /**
- * The Constructor.
- */
- public TestContextIntItem() {}
-
- /**
- * The Constructor.
- *
- * @param intValue the int value
- */
- public TestContextIntItem(final Integer intValue) {
- this.intValue = intValue;
- }
-
- /**
- * The Constructor.
- *
- * @param original the original
- */
- public TestContextIntItem(final TestContextIntItem original) {
- this.intValue = original.intValue;
- }
-
- /**
- * Gets the int value.
- *
- * @return the int value
- */
- public int getIntValue() {
- return intValue;
- }
-
- /**
- * Sets the int value.
- *
- * @param intValue the int value
- */
- public void setIntValue(final int intValue) {
- this.intValue = intValue;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- final int prime = HASH_PRIME_1;
- int result = 1;
- result = prime * result + intValue;
- return result;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals(final Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- final TestContextIntItem other = (TestContextIntItem) obj;
- return intValue == other.intValue;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return "TestContextItem002 [intValue=" + intValue + "]";
- }
-}
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextLongItem.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextLongItem.java
deleted file mode 100644
index 025cde657..000000000
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextLongItem.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.apex.context.test.concepts;
-
-import java.io.Serializable;
-
-/**
- * The Class TestContextItem003.
- */
-public class TestContextLongItem implements Serializable {
- private static final long serialVersionUID = 3599267534512489386L;
-
- private static final int HASH_PRIME_1 = 31;
- private static final int FOUR_BYTES = 33;
-
- private long longValue = 0;
-
- /**
- * The Constructor.
- */
- public TestContextLongItem() {}
-
- /**
- * The Constructor.
- *
- * @param longValue the long value
- */
- public TestContextLongItem(final Long longValue) {
- this.longValue = longValue;
- }
-
- /**
- * Gets the long value.
- *
- * @return the long value
- */
- public long getLongValue() {
- return longValue;
- }
-
- /**
- * Sets the long value.
- *
- * @param longValue the long value
- */
- public void setLongValue(final long longValue) {
- this.longValue = longValue;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- final int prime = HASH_PRIME_1;
- int result = 1;
- result = prime * result + (int) (longValue ^ (longValue >>> FOUR_BYTES));
- return result;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals(final Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- final TestContextLongItem other = (TestContextLongItem) obj;
- return longValue == other.longValue;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return "TestContextItem003 [longValue=" + longValue + "]";
- }
-}
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextLongObjectItem.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextLongObjectItem.java
deleted file mode 100644
index 9027bfcbf..000000000
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextLongObjectItem.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.apex.context.test.concepts;
-
-import java.io.Serializable;
-
-/**
- * The Class TestContextItem007.
- */
-public class TestContextLongObjectItem implements Serializable {
- private static final long serialVersionUID = -1029406737866392421L;
-
- private static final int HASH_PRIME_1 = 31;
-
- private Long longValue = 0L;
-
- /**
- * The Constructor.
- */
- public TestContextLongObjectItem() {}
-
- /**
- * The Constructor.
- *
- * @param longValue the long value
- */
- public TestContextLongObjectItem(final Long longValue) {
- this.longValue = longValue;
- }
-
- /**
- * Gets the long value.
- *
- * @return the long value
- */
- public Long getLongValue() {
- return longValue;
- }
-
- /**
- * Sets the long value.
- *
- * @param longValue the long value
- */
- public void setLongValue(final Long longValue) {
- this.longValue = longValue;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- final int prime = HASH_PRIME_1;
- int result = 1;
- result = prime * result + ((longValue == null) ? 0 : longValue.hashCode());
- return result;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals(final Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- final TestContextLongObjectItem other = (TestContextLongObjectItem) obj;
- if (longValue == null) {
- if (other.longValue != null) {
- return false;
- }
- } else if (!longValue.equals(other.longValue)) {
- return false;
- }
- return true;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return "TestContextItem007 [longValue=" + longValue + "]";
- }
-}
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextStringItem.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextStringItem.java
deleted file mode 100644
index 6c9fcb412..000000000
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextStringItem.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.apex.context.test.concepts;
-
-import java.io.Serializable;
-
-/**
- * The Class TestContextItem006.
- */
-public class TestContextStringItem implements Serializable {
- private static final long serialVersionUID = -1074772190611125121L;
-
- private static final int HASH_PRIME_1 = 31;
-
- private String stringValue = "";
-
- /**
- * The Constructor.
- */
- public TestContextStringItem() {}
-
- /**
- * The Constructor.
- *
- * @param stringValue the string value
- */
- public TestContextStringItem(final String stringValue) {
- this.stringValue = stringValue;
- }
-
- /**
- * Gets the string value.
- *
- * @return the string value
- */
- public String getStringValue() {
- return stringValue;
- }
-
- /**
- * Sets the string value.
- *
- * @param stringValue the string value
- */
- public void setStringValue(final String stringValue) {
- this.stringValue = stringValue;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- final int prime = HASH_PRIME_1;
- int result = 1;
- result = prime * result + ((stringValue == null) ? 0 : stringValue.hashCode());
- return result;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals(final Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- final TestContextStringItem other = (TestContextStringItem) obj;
- if (stringValue == null) {
- if (other.stringValue != null) {
- return false;
- }
- } else if (!stringValue.equals(other.stringValue)) {
- return false;
- }
- return true;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return "TestContextItem006 [stringValue=" + stringValue + "]";
- }
-}
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextTreeMapItem.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextTreeMapItem.java
deleted file mode 100644
index 538a5433e..000000000
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextTreeMapItem.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.apex.context.test.concepts;
-
-import java.io.Serializable;
-import java.util.Map;
-import java.util.TreeMap;
-
-/**
- * The Class TestContextItem00C.
- */
-public class TestContextTreeMapItem implements Serializable {
- private static final long serialVersionUID = -7497746259264651884L;
-
- private static final int HASH_PRIME_1 = 31;
-
- private Map<String, String> mapValue = new TreeMap<>();
-
- /**
- * The Constructor.
- */
- public TestContextTreeMapItem() {}
-
- /**
- * The Constructor.
- *
- * @param mapValue the map value
- */
- public TestContextTreeMapItem(final Map<String, String> mapValue) {
- this.mapValue = mapValue;
- }
-
- /**
- * Gets the map value.
- *
- * @return the map value
- */
- public Map<String, String> getMapValue() {
- if (mapValue == null) {
- mapValue = new TreeMap<>();
- }
- return mapValue;
- }
-
- /**
- * Sets the map value.
- *
- * @param mapValue the map value
- */
- public void setMapValue(final Map<String, String> mapValue) {
- this.mapValue = mapValue;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- final int prime = HASH_PRIME_1;
- int result = 1;
- result = prime * result + ((mapValue == null) ? 0 : mapValue.hashCode());
- return result;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals(final Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- final TestContextTreeMapItem other = (TestContextTreeMapItem) obj;
- if (mapValue == null) {
- if (other.mapValue != null) {
- return false;
- }
- } else if (!mapValue.equals(other.mapValue)) {
- return false;
- }
- return true;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return "TestContextItem00C [mapValue=" + mapValue + "]";
- }
-
-}
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextTreeSetItem.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextTreeSetItem.java
deleted file mode 100644
index 22056db34..000000000
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextTreeSetItem.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.apex.context.test.concepts;
-
-import java.io.Serializable;
-import java.util.Arrays;
-import java.util.Set;
-import java.util.SortedSet;
-import java.util.TreeSet;
-
-/**
- * The Class TestContextItem00B.
- */
-public class TestContextTreeSetItem implements Serializable {
- private static final long serialVersionUID = 1254589722957250388L;
-
- private static final int HASH_PRIME_1 = 31;
-
- private SortedSet<String> setValue = new TreeSet<>();
-
- /**
- * The Constructor.
- */
- public TestContextTreeSetItem() {}
-
- /**
- * The Constructor.
- *
- * @param setArray the set array
- */
- public TestContextTreeSetItem(final String[] setArray) {
- this.setValue = new TreeSet<>(Arrays.asList(setArray));
- }
-
- /**
- * The Constructor.
- *
- * @param setValue the set value
- */
- public TestContextTreeSetItem(final SortedSet<String> setValue) {
- this.setValue = setValue;
- }
-
- /**
- * Gets the set value.
- *
- * @return the sets the value
- */
- public Set<String> getSetValue() {
- if (setValue == null) {
- setValue = new TreeSet<>();
- }
- return setValue;
- }
-
- /**
- * Sets the set value.
- *
- * @param setValue the sets the value
- */
- public void setSetValue(final SortedSet<String> setValue) {
- this.setValue = setValue;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- final int prime = HASH_PRIME_1;
- int result = 1;
- result = prime * result + ((setValue == null) ? 0 : setValue.hashCode());
- return result;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals(final Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- final TestContextTreeSetItem other = (TestContextTreeSetItem) obj;
- if (setValue == null) {
- if (other.setValue != null) {
- return false;
- }
- } else if (!setValue.equals(other.setValue)) {
- return false;
- }
- return true;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return "TestContextItem00B [setValue=" + setValue + "]";
- }
-}
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestExternalContextItem.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestExternalContextItem.java
deleted file mode 100644
index 5c63c2ecb..000000000
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestExternalContextItem.java
+++ /dev/null
@@ -1,434 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.apex.context.test.concepts;
-
-import java.io.Serializable;
-
-/**
- * The Class TestExternalContextItem.
- */
-public class TestExternalContextItem implements Serializable {
- private static final long serialVersionUID = 3512435733818672173L;
-
- private static final int HASH_PRIME_1 = 31;
-
- private TestContextBooleanItem testExternalContextItem000;
- private TestContextByteItem testExternalContextItem001;
- private TestContextIntItem testExternalContextItem002;
- private TestContextLongItem testExternalContextItem003;
- private TestContextFloatItem testExternalContextItem004;
- private TestContextDoubleItem testExternalContextItem005;
- private TestContextStringItem testExternalContextItem006;
- private TestContextLongObjectItem testExternalContextItem007;
- private TestContextDateItem testExternalContextItem008;
- private TestContextDateTzItem testExternalContextItem009;
- private TestContextDateLocaleItem testExternalContextItem00A;
- private TestContextTreeSetItem testExternalContextItem00B;
- private TestContextTreeMapItem testExternalContextItem00C;
-
- /**
- * Gets the test external context item 000.
- *
- * @return the test external context item 000
- */
- public TestContextBooleanItem getTestExternalContextItem000() {
- return testExternalContextItem000;
- }
-
- /**
- * Sets the test external context item 000.
- *
- * @param testExternalContextItem000 the test external context item 000
- */
- public void setTestExternalContextItem000(final TestContextBooleanItem testExternalContextItem000) {
- this.testExternalContextItem000 = testExternalContextItem000;
- }
-
- /**
- * Gets the test external context item 001.
- *
- * @return the test external context item 001
- */
- public TestContextByteItem getTestExternalContextItem001() {
- return testExternalContextItem001;
- }
-
- /**
- * Sets the test external context item 001.
- *
- * @param testExternalContextItem001 the test external context item 001
- */
- public void setTestExternalContextItem001(final TestContextByteItem testExternalContextItem001) {
- this.testExternalContextItem001 = testExternalContextItem001;
- }
-
- /**
- * Gets the test external context item 002.
- *
- * @return the test external context item 002
- */
- public TestContextIntItem getTestExternalContextItem002() {
- return testExternalContextItem002;
- }
-
- /**
- * Sets the test external context item 002.
- *
- * @param testExternalContextItem002 the test external context item 002
- */
- public void setTestExternalContextItem002(final TestContextIntItem testExternalContextItem002) {
- this.testExternalContextItem002 = testExternalContextItem002;
- }
-
- /**
- * Gets the test external context item 003.
- *
- * @return the test external context item 003
- */
- public TestContextLongItem getTestExternalContextItem003() {
- return testExternalContextItem003;
- }
-
- /**
- * Sets the test external context item 003.
- *
- * @param testExternalContextItem003 the test external context item 003
- */
- public void setTestExternalContextItem003(final TestContextLongItem testExternalContextItem003) {
- this.testExternalContextItem003 = testExternalContextItem003;
- }
-
- /**
- * Gets the test external context item 004.
- *
- * @return the test external context item 004
- */
- public TestContextFloatItem getTestExternalContextItem004() {
- return testExternalContextItem004;
- }
-
- /**
- * Sets the test external context item 004.
- *
- * @param testExternalContextItem004 the test external context item 004
- */
- public void setTestExternalContextItem004(final TestContextFloatItem testExternalContextItem004) {
- this.testExternalContextItem004 = testExternalContextItem004;
- }
-
- /**
- * Gets the test external context item 005.
- *
- * @return the test external context item 005
- */
- public TestContextDoubleItem getTestExternalContextItem005() {
- return testExternalContextItem005;
- }
-
- /**
- * Sets the test external context item 005.
- *
- * @param testExternalContextItem005 the test external context item 005
- */
- public void setTestExternalContextItem005(final TestContextDoubleItem testExternalContextItem005) {
- this.testExternalContextItem005 = testExternalContextItem005;
- }
-
- /**
- * Gets the test external context item 006.
- *
- * @return the test external context item 006
- */
- public TestContextStringItem getTestExternalContextItem006() {
- return testExternalContextItem006;
- }
-
- /**
- * Sets the test external context item 006.
- *
- * @param testExternalContextItem006 the test external context item 006
- */
- public void setTestExternalContextItem006(final TestContextStringItem testExternalContextItem006) {
- this.testExternalContextItem006 = testExternalContextItem006;
- }
-
- /**
- * Gets the test external context item 007.
- *
- * @return the test external context item 007
- */
- public TestContextLongObjectItem getTestExternalContextItem007() {
- return testExternalContextItem007;
- }
-
- /**
- * Sets the test external context item 007.
- *
- * @param testExternalContextItem007 the test external context item 007
- */
- public void setTestExternalContextItem007(final TestContextLongObjectItem testExternalContextItem007) {
- this.testExternalContextItem007 = testExternalContextItem007;
- }
-
- /**
- * Gets the test external context item 008.
- *
- * @return the test external context item 008
- */
- public TestContextDateItem getTestExternalContextItem008() {
- return testExternalContextItem008;
- }
-
- /**
- * Sets the test external context item 008.
- *
- * @param testExternalContextItem008 the test external context item 008
- */
- public void setTestExternalContextItem008(final TestContextDateItem testExternalContextItem008) {
- this.testExternalContextItem008 = testExternalContextItem008;
- }
-
- /**
- * Gets the test external context item 009.
- *
- * @return the test external context item 009
- */
- public TestContextDateTzItem getTestExternalContextItem009() {
- return testExternalContextItem009;
- }
-
- /**
- * Sets the test external context item 009.
- *
- * @param testExternalContextItem009 the test external context item 009
- */
- public void setTestExternalContextItem009(final TestContextDateTzItem testExternalContextItem009) {
- this.testExternalContextItem009 = testExternalContextItem009;
- }
-
- /**
- * Gets the test external context item 00 A.
- *
- * @return the test external context item 00 A
- */
- public TestContextDateLocaleItem getTestExternalContextItem00A() {
- return testExternalContextItem00A;
- }
-
- /**
- * Sets the test external context item 00 A.
- *
- * @param testExternalContextItem00A the test external context item 00 A
- */
- public void setTestExternalContextItem00A(final TestContextDateLocaleItem testExternalContextItem00A) {
- this.testExternalContextItem00A = testExternalContextItem00A;
- }
-
- /**
- * Gets the test external context item 00 B.
- *
- * @return the test external context item 00 B
- */
- public TestContextTreeSetItem getTestExternalContextItem00B() {
- return testExternalContextItem00B;
- }
-
- /**
- * Sets the test external context item 00 B.
- *
- * @param testExternalContextItem00B the test external context item 00 B
- */
- public void setTestExternalContextItem00B(final TestContextTreeSetItem testExternalContextItem00B) {
- this.testExternalContextItem00B = testExternalContextItem00B;
- }
-
- /**
- * Gets the test external context item 00 C.
- *
- * @return the test external context item 00 C
- */
- public TestContextTreeMapItem getTestExternalContextItem00C() {
- return testExternalContextItem00C;
- }
-
- /**
- * Sets the test external context item 00 C.
- *
- * @param testExternalContextItem00C the test external context item 00 C
- */
- public void setTestExternalContextItem00C(final TestContextTreeMapItem testExternalContextItem00C) {
- this.testExternalContextItem00C = testExternalContextItem00C;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- final int prime = HASH_PRIME_1;
- int result = 1;
- result = prime * result + ((testExternalContextItem000 == null) ? 0 : testExternalContextItem000.hashCode());
- result = prime * result + ((testExternalContextItem001 == null) ? 0 : testExternalContextItem001.hashCode());
- result = prime * result + ((testExternalContextItem002 == null) ? 0 : testExternalContextItem002.hashCode());
- result = prime * result + ((testExternalContextItem003 == null) ? 0 : testExternalContextItem003.hashCode());
- result = prime * result + ((testExternalContextItem004 == null) ? 0 : testExternalContextItem004.hashCode());
- result = prime * result + ((testExternalContextItem005 == null) ? 0 : testExternalContextItem005.hashCode());
- result = prime * result + ((testExternalContextItem006 == null) ? 0 : testExternalContextItem006.hashCode());
- result = prime * result + ((testExternalContextItem007 == null) ? 0 : testExternalContextItem007.hashCode());
- result = prime * result + ((testExternalContextItem008 == null) ? 0 : testExternalContextItem008.hashCode());
- result = prime * result + ((testExternalContextItem009 == null) ? 0 : testExternalContextItem009.hashCode());
- result = prime * result + ((testExternalContextItem00A == null) ? 0 : testExternalContextItem00A.hashCode());
- result = prime * result + ((testExternalContextItem00B == null) ? 0 : testExternalContextItem00B.hashCode());
- result = prime * result + ((testExternalContextItem00C == null) ? 0 : testExternalContextItem00C.hashCode());
- return result;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals(final Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- final TestExternalContextItem other = (TestExternalContextItem) obj;
- if (testExternalContextItem000 == null) {
- if (other.testExternalContextItem000 != null) {
- return false;
- }
- } else if (!testExternalContextItem000.equals(other.testExternalContextItem000)) {
- return false;
- }
- if (testExternalContextItem001 == null) {
- if (other.testExternalContextItem001 != null) {
- return false;
- }
- } else if (!testExternalContextItem001.equals(other.testExternalContextItem001)) {
- return false;
- }
- if (testExternalContextItem002 == null) {
- if (other.testExternalContextItem002 != null) {
- return false;
- }
- } else if (!testExternalContextItem002.equals(other.testExternalContextItem002)) {
- return false;
- }
- if (testExternalContextItem003 == null) {
- if (other.testExternalContextItem003 != null) {
- return false;
- }
- } else if (!testExternalContextItem003.equals(other.testExternalContextItem003)) {
- return false;
- }
- if (testExternalContextItem004 == null) {
- if (other.testExternalContextItem004 != null) {
- return false;
- }
- } else if (!testExternalContextItem004.equals(other.testExternalContextItem004)) {
- return false;
- }
- if (testExternalContextItem005 == null) {
- if (other.testExternalContextItem005 != null) {
- return false;
- }
- } else if (!testExternalContextItem005.equals(other.testExternalContextItem005)) {
- return false;
- }
- if (testExternalContextItem006 == null) {
- if (other.testExternalContextItem006 != null) {
- return false;
- }
- } else if (!testExternalContextItem006.equals(other.testExternalContextItem006)) {
- return false;
- }
- if (testExternalContextItem007 == null) {
- if (other.testExternalContextItem007 != null) {
- return false;
- }
- } else if (!testExternalContextItem007.equals(other.testExternalContextItem007)) {
- return false;
- }
- if (testExternalContextItem008 == null) {
- if (other.testExternalContextItem008 != null) {
- return false;
- }
- } else if (!testExternalContextItem008.equals(other.testExternalContextItem008)) {
- return false;
- }
- if (testExternalContextItem009 == null) {
- if (other.testExternalContextItem009 != null) {
- return false;
- }
- } else if (!testExternalContextItem009.equals(other.testExternalContextItem009)) {
- return false;
- }
- if (testExternalContextItem00A == null) {
- if (other.testExternalContextItem00A != null) {
- return false;
- }
- } else if (!testExternalContextItem00A.equals(other.testExternalContextItem00A)) {
- return false;
- }
- if (testExternalContextItem00B == null) {
- if (other.testExternalContextItem00B != null) {
- return false;
- }
- } else if (!testExternalContextItem00B.equals(other.testExternalContextItem00B)) {
- return false;
- }
- if (testExternalContextItem00C == null) {
- if (other.testExternalContextItem00C != null) {
- return false;
- }
- } else if (!testExternalContextItem00C.equals(other.testExternalContextItem00C)) {
- return false;
- }
- return true;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return "TestExternalContextItem [testExternalContextItem000=" + testExternalContextItem000
- + ", testExternalContextItem001=" + testExternalContextItem001 + ", testExternalContextItem002="
- + testExternalContextItem002 + ", testExternalContextItem003=" + testExternalContextItem003
- + ", testExternalContextItem004=" + testExternalContextItem004 + ", testExternalContextItem005="
- + testExternalContextItem005 + ", testExternalContextItem006=" + testExternalContextItem006
- + ", testExternalContextItem007=" + testExternalContextItem007 + ", testExternalContextItem008="
- + testExternalContextItem008 + ", testExternalContextItem009=" + testExternalContextItem009
- + ", testExternalContextItem00A=" + testExternalContextItem00A + ", testExternalContextItem00B="
- + testExternalContextItem00B + ", testExternalContextItem00C=" + testExternalContextItem00C + "]";
- }
-}
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestGlobalContextItem.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestGlobalContextItem.java
deleted file mode 100644
index 9953a1a95..000000000
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestGlobalContextItem.java
+++ /dev/null
@@ -1,434 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.apex.context.test.concepts;
-
-import java.io.Serializable;
-
-/**
- * The Class TestGlobalContextItem.
- */
-public class TestGlobalContextItem implements Serializable {
- private static final long serialVersionUID = 3348445332683174361L;
-
- private static final int HASH_PRIME_1 = 31;
-
- private TestContextBooleanItem testGlobalContextItem000;
- private TestContextByteItem testGlobalContextItem001;
- private TestContextIntItem testGlobalContextItem002;
- private TestContextLongItem testGlobalContextItem003;
- private TestContextFloatItem testGlobalContextItem004;
- private TestContextDoubleItem testGlobalContextItem005;
- private TestContextStringItem testGlobalContextItem006;
- private TestContextLongObjectItem testGlobalContextItem007;
- private TestContextDateItem testGlobalContextItem008;
- private TestContextDateTzItem testGlobalContextItem009;
- private TestContextDateLocaleItem testGlobalContextItem00A;
- private TestContextTreeSetItem testGlobalContextItem00B;
- private TestContextTreeMapItem testGlobalContextItem00C;
-
- /**
- * Gets the test global context item 000.
- *
- * @return the test global context item 000
- */
- public TestContextBooleanItem getTestGlobalContextItem000() {
- return testGlobalContextItem000;
- }
-
- /**
- * Sets the test global context item 000.
- *
- * @param testGlobalContextItem000 the test global context item 000
- */
- public void setTestGlobalContextItem000(final TestContextBooleanItem testGlobalContextItem000) {
- this.testGlobalContextItem000 = testGlobalContextItem000;
- }
-
- /**
- * Gets the test global context item 001.
- *
- * @return the test global context item 001
- */
- public TestContextByteItem getTestGlobalContextItem001() {
- return testGlobalContextItem001;
- }
-
- /**
- * Sets the test global context item 001.
- *
- * @param testGlobalContextItem001 the test global context item 001
- */
- public void setTestGlobalContextItem001(final TestContextByteItem testGlobalContextItem001) {
- this.testGlobalContextItem001 = testGlobalContextItem001;
- }
-
- /**
- * Gets the test global context item 002.
- *
- * @return the test global context item 002
- */
- public TestContextIntItem getTestGlobalContextItem002() {
- return testGlobalContextItem002;
- }
-
- /**
- * Sets the test global context item 002.
- *
- * @param testGlobalContextItem002 the test global context item 002
- */
- public void setTestGlobalContextItem002(final TestContextIntItem testGlobalContextItem002) {
- this.testGlobalContextItem002 = testGlobalContextItem002;
- }
-
- /**
- * Gets the test global context item 003.
- *
- * @return the test global context item 003
- */
- public TestContextLongItem getTestGlobalContextItem003() {
- return testGlobalContextItem003;
- }
-
- /**
- * Sets the test global context item 003.
- *
- * @param testGlobalContextItem003 the test global context item 003
- */
- public void setTestGlobalContextItem003(final TestContextLongItem testGlobalContextItem003) {
- this.testGlobalContextItem003 = testGlobalContextItem003;
- }
-
- /**
- * Gets the test global context item 004.
- *
- * @return the test global context item 004
- */
- public TestContextFloatItem getTestGlobalContextItem004() {
- return testGlobalContextItem004;
- }
-
- /**
- * Sets the test global context item 004.
- *
- * @param testGlobalContextItem004 the test global context item 004
- */
- public void setTestGlobalContextItem004(final TestContextFloatItem testGlobalContextItem004) {
- this.testGlobalContextItem004 = testGlobalContextItem004;
- }
-
- /**
- * Gets the test global context item 005.
- *
- * @return the test global context item 005
- */
- public TestContextDoubleItem getTestGlobalContextItem005() {
- return testGlobalContextItem005;
- }
-
- /**
- * Sets the test global context item 005.
- *
- * @param testGlobalContextItem005 the test global context item 005
- */
- public void setTestGlobalContextItem005(final TestContextDoubleItem testGlobalContextItem005) {
- this.testGlobalContextItem005 = testGlobalContextItem005;
- }
-
- /**
- * Gets the test global context item 006.
- *
- * @return the test global context item 006
- */
- public TestContextStringItem getTestGlobalContextItem006() {
- return testGlobalContextItem006;
- }
-
- /**
- * Sets the test global context item 006.
- *
- * @param testGlobalContextItem006 the test global context item 006
- */
- public void setTestGlobalContextItem006(final TestContextStringItem testGlobalContextItem006) {
- this.testGlobalContextItem006 = testGlobalContextItem006;
- }
-
- /**
- * Gets the test global context item 007.
- *
- * @return the test global context item 007
- */
- public TestContextLongObjectItem getTestGlobalContextItem007() {
- return testGlobalContextItem007;
- }
-
- /**
- * Sets the test global context item 007.
- *
- * @param testGlobalContextItem007 the test global context item 007
- */
- public void setTestGlobalContextItem007(final TestContextLongObjectItem testGlobalContextItem007) {
- this.testGlobalContextItem007 = testGlobalContextItem007;
- }
-
- /**
- * Gets the test global context item 008.
- *
- * @return the test global context item 008
- */
- public TestContextDateItem getTestGlobalContextItem008() {
- return testGlobalContextItem008;
- }
-
- /**
- * Sets the test global context item 008.
- *
- * @param testGlobalContextItem008 the test global context item 008
- */
- public void setTestGlobalContextItem008(final TestContextDateItem testGlobalContextItem008) {
- this.testGlobalContextItem008 = testGlobalContextItem008;
- }
-
- /**
- * Gets the test global context item 009.
- *
- * @return the test global context item 009
- */
- public TestContextDateTzItem getTestGlobalContextItem009() {
- return testGlobalContextItem009;
- }
-
- /**
- * Sets the test global context item 009.
- *
- * @param testGlobalContextItem009 the test global context item 009
- */
- public void setTestGlobalContextItem009(final TestContextDateTzItem testGlobalContextItem009) {
- this.testGlobalContextItem009 = testGlobalContextItem009;
- }
-
- /**
- * Gets the test global context item 00 A.
- *
- * @return the test global context item 00 A
- */
- public TestContextDateLocaleItem getTestGlobalContextItem00A() {
- return testGlobalContextItem00A;
- }
-
- /**
- * Sets the test global context item 00 A.
- *
- * @param testGlobalContextItem00A the test global context item 00 A
- */
- public void setTestGlobalContextItem00A(final TestContextDateLocaleItem testGlobalContextItem00A) {
- this.testGlobalContextItem00A = testGlobalContextItem00A;
- }
-
- /**
- * Gets the test global context item 00 B.
- *
- * @return the test global context item 00 B
- */
- public TestContextTreeSetItem getTestGlobalContextItem00B() {
- return testGlobalContextItem00B;
- }
-
- /**
- * Sets the test global context item 00 B.
- *
- * @param testGlobalContextItem00B the test global context item 00 B
- */
- public void setTestGlobalContextItem00B(final TestContextTreeSetItem testGlobalContextItem00B) {
- this.testGlobalContextItem00B = testGlobalContextItem00B;
- }
-
- /**
- * Gets the test global context item 00 C.
- *
- * @return the test global context item 00 C
- */
- public TestContextTreeMapItem getTestGlobalContextItem00C() {
- return testGlobalContextItem00C;
- }
-
- /**
- * Sets the test global context item 00 C.
- *
- * @param testGlobalContextItem00C the test global context item 00 C
- */
- public void setTestGlobalContextItem00C(final TestContextTreeMapItem testGlobalContextItem00C) {
- this.testGlobalContextItem00C = testGlobalContextItem00C;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- final int prime = HASH_PRIME_1;
- int result = 1;
- result = prime * result + ((testGlobalContextItem000 == null) ? 0 : testGlobalContextItem000.hashCode());
- result = prime * result + ((testGlobalContextItem001 == null) ? 0 : testGlobalContextItem001.hashCode());
- result = prime * result + ((testGlobalContextItem002 == null) ? 0 : testGlobalContextItem002.hashCode());
- result = prime * result + ((testGlobalContextItem003 == null) ? 0 : testGlobalContextItem003.hashCode());
- result = prime * result + ((testGlobalContextItem004 == null) ? 0 : testGlobalContextItem004.hashCode());
- result = prime * result + ((testGlobalContextItem005 == null) ? 0 : testGlobalContextItem005.hashCode());
- result = prime * result + ((testGlobalContextItem006 == null) ? 0 : testGlobalContextItem006.hashCode());
- result = prime * result + ((testGlobalContextItem007 == null) ? 0 : testGlobalContextItem007.hashCode());
- result = prime * result + ((testGlobalContextItem008 == null) ? 0 : testGlobalContextItem008.hashCode());
- result = prime * result + ((testGlobalContextItem009 == null) ? 0 : testGlobalContextItem009.hashCode());
- result = prime * result + ((testGlobalContextItem00A == null) ? 0 : testGlobalContextItem00A.hashCode());
- result = prime * result + ((testGlobalContextItem00B == null) ? 0 : testGlobalContextItem00B.hashCode());
- result = prime * result + ((testGlobalContextItem00C == null) ? 0 : testGlobalContextItem00C.hashCode());
- return result;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals(final Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- final TestGlobalContextItem other = (TestGlobalContextItem) obj;
- if (testGlobalContextItem000 == null) {
- if (other.testGlobalContextItem000 != null) {
- return false;
- }
- } else if (!testGlobalContextItem000.equals(other.testGlobalContextItem000)) {
- return false;
- }
- if (testGlobalContextItem001 == null) {
- if (other.testGlobalContextItem001 != null) {
- return false;
- }
- } else if (!testGlobalContextItem001.equals(other.testGlobalContextItem001)) {
- return false;
- }
- if (testGlobalContextItem002 == null) {
- if (other.testGlobalContextItem002 != null) {
- return false;
- }
- } else if (!testGlobalContextItem002.equals(other.testGlobalContextItem002)) {
- return false;
- }
- if (testGlobalContextItem003 == null) {
- if (other.testGlobalContextItem003 != null) {
- return false;
- }
- } else if (!testGlobalContextItem003.equals(other.testGlobalContextItem003)) {
- return false;
- }
- if (testGlobalContextItem004 == null) {
- if (other.testGlobalContextItem004 != null) {
- return false;
- }
- } else if (!testGlobalContextItem004.equals(other.testGlobalContextItem004)) {
- return false;
- }
- if (testGlobalContextItem005 == null) {
- if (other.testGlobalContextItem005 != null) {
- return false;
- }
- } else if (!testGlobalContextItem005.equals(other.testGlobalContextItem005)) {
- return false;
- }
- if (testGlobalContextItem006 == null) {
- if (other.testGlobalContextItem006 != null) {
- return false;
- }
- } else if (!testGlobalContextItem006.equals(other.testGlobalContextItem006)) {
- return false;
- }
- if (testGlobalContextItem007 == null) {
- if (other.testGlobalContextItem007 != null) {
- return false;
- }
- } else if (!testGlobalContextItem007.equals(other.testGlobalContextItem007)) {
- return false;
- }
- if (testGlobalContextItem008 == null) {
- if (other.testGlobalContextItem008 != null) {
- return false;
- }
- } else if (!testGlobalContextItem008.equals(other.testGlobalContextItem008)) {
- return false;
- }
- if (testGlobalContextItem009 == null) {
- if (other.testGlobalContextItem009 != null) {
- return false;
- }
- } else if (!testGlobalContextItem009.equals(other.testGlobalContextItem009)) {
- return false;
- }
- if (testGlobalContextItem00A == null) {
- if (other.testGlobalContextItem00A != null) {
- return false;
- }
- } else if (!testGlobalContextItem00A.equals(other.testGlobalContextItem00A)) {
- return false;
- }
- if (testGlobalContextItem00B == null) {
- if (other.testGlobalContextItem00B != null) {
- return false;
- }
- } else if (!testGlobalContextItem00B.equals(other.testGlobalContextItem00B)) {
- return false;
- }
- if (testGlobalContextItem00C == null) {
- if (other.testGlobalContextItem00C != null) {
- return false;
- }
- } else if (!testGlobalContextItem00C.equals(other.testGlobalContextItem00C)) {
- return false;
- }
- return true;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return "TestGlobalContextItem [testGlobalContextItem000=" + testGlobalContextItem000
- + ", testGlobalContextItem001=" + testGlobalContextItem001 + ", testGlobalContextItem002="
- + testGlobalContextItem002 + ", testGlobalContextItem003=" + testGlobalContextItem003
- + ", testGlobalContextItem004=" + testGlobalContextItem004 + ", testGlobalContextItem005="
- + testGlobalContextItem005 + ", testGlobalContextItem006=" + testGlobalContextItem006
- + ", testGlobalContextItem007=" + testGlobalContextItem007 + ", testGlobalContextItem008="
- + testGlobalContextItem008 + ", testGlobalContextItem009=" + testGlobalContextItem009
- + ", testGlobalContextItem00A=" + testGlobalContextItem00A + ", testGlobalContextItem00B="
- + testGlobalContextItem00B + ", testGlobalContextItem00C=" + testGlobalContextItem00C + "]";
- }
-}
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestPolicyContextItem.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestPolicyContextItem.java
deleted file mode 100644
index fc728a7ae..000000000
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestPolicyContextItem.java
+++ /dev/null
@@ -1,241 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.apex.context.test.concepts;
-
-import java.io.Serializable;
-
-/**
- * The Class TestPolicyContextItem.
- */
-public class TestPolicyContextItem implements Serializable {
- private static final long serialVersionUID = 6336372857646152910L;
-
- private static final int HASH_PRIME_1 = 31;
-
- private TestContextStringItem testPolicyContextItem000;
- private TestContextLongItem testPolicyContextItem001;
- private TestContextDoubleItem testPolicyContextItem002;
- private TestContextBooleanItem testPolicyContextItem003;
- private TestContextLongItem testPolicyContextItem004;
- private TestContextTreeMapItem testPolicyContextItem005;
-
- /**
- * Gets the test policy context item 000.
- *
- * @return the test policy context item 000
- */
- public TestContextStringItem getTestPolicyContextItem000() {
- return testPolicyContextItem000;
- }
-
- /**
- * Sets the test policy context item 000.
- *
- * @param testPolicyContextItem000 the test policy context item 000
- */
- public void setTestPolicyContextItem000(final TestContextStringItem testPolicyContextItem000) {
- this.testPolicyContextItem000 = testPolicyContextItem000;
- }
-
- /**
- * Gets the test policy context item 001.
- *
- * @return the test policy context item 001
- */
- public TestContextLongItem getTestPolicyContextItem001() {
- return testPolicyContextItem001;
- }
-
- /**
- * Sets the test policy context item 001.
- *
- * @param testPolicyContextItem001 the test policy context item 001
- */
- public void setTestPolicyContextItem001(final TestContextLongItem testPolicyContextItem001) {
- this.testPolicyContextItem001 = testPolicyContextItem001;
- }
-
- /**
- * Gets the test policy context item 002.
- *
- * @return the test policy context item 002
- */
- public TestContextDoubleItem getTestPolicyContextItem002() {
- return testPolicyContextItem002;
- }
-
- /**
- * Sets the test policy context item 002.
- *
- * @param testPolicyContextItem002 the test policy context item 002
- */
- public void setTestPolicyContextItem002(final TestContextDoubleItem testPolicyContextItem002) {
- this.testPolicyContextItem002 = testPolicyContextItem002;
- }
-
- /**
- * Gets the test policy context item 003.
- *
- * @return the test policy context item 003
- */
- public TestContextBooleanItem getTestPolicyContextItem003() {
- return testPolicyContextItem003;
- }
-
- /**
- * Sets the test policy context item 003.
- *
- * @param testPolicyContextItem003 the test policy context item 003
- */
- public void setTestPolicyContextItem003(final TestContextBooleanItem testPolicyContextItem003) {
- this.testPolicyContextItem003 = testPolicyContextItem003;
- }
-
- /**
- * Gets the test policy context item 004.
- *
- * @return the test policy context item 004
- */
- public TestContextLongItem getTestPolicyContextItem004() {
- return testPolicyContextItem004;
- }
-
- /**
- * Sets the test policy context item 004.
- *
- * @param testPolicyContextItem004 the test policy context item 004
- */
- public void setTestPolicyContextItem004(final TestContextLongItem testPolicyContextItem004) {
- this.testPolicyContextItem004 = testPolicyContextItem004;
- }
-
- /**
- * Gets the test policy context item 005.
- *
- * @return the test policy context item 005
- */
- public TestContextTreeMapItem getTestPolicyContextItem005() {
- return testPolicyContextItem005;
- }
-
- /**
- * Sets the test policy context item 005.
- *
- * @param testPolicyContextItem005 the test policy context item 005
- */
- public void setTestPolicyContextItem005(final TestContextTreeMapItem testPolicyContextItem005) {
- this.testPolicyContextItem005 = testPolicyContextItem005;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- final int prime = HASH_PRIME_1;
- int result = 1;
- result = prime * result + ((testPolicyContextItem000 == null) ? 0 : testPolicyContextItem000.hashCode());
- result = prime * result + ((testPolicyContextItem001 == null) ? 0 : testPolicyContextItem001.hashCode());
- result = prime * result + ((testPolicyContextItem002 == null) ? 0 : testPolicyContextItem002.hashCode());
- result = prime * result + ((testPolicyContextItem003 == null) ? 0 : testPolicyContextItem003.hashCode());
- result = prime * result + ((testPolicyContextItem004 == null) ? 0 : testPolicyContextItem004.hashCode());
- result = prime * result + ((testPolicyContextItem005 == null) ? 0 : testPolicyContextItem005.hashCode());
- return result;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals(final Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- final TestPolicyContextItem other = (TestPolicyContextItem) obj;
- if (testPolicyContextItem000 == null) {
- if (other.testPolicyContextItem000 != null) {
- return false;
- }
- } else if (!testPolicyContextItem000.equals(other.testPolicyContextItem000)) {
- return false;
- }
- if (testPolicyContextItem001 == null) {
- if (other.testPolicyContextItem001 != null) {
- return false;
- }
- } else if (!testPolicyContextItem001.equals(other.testPolicyContextItem001)) {
- return false;
- }
- if (testPolicyContextItem002 == null) {
- if (other.testPolicyContextItem002 != null) {
- return false;
- }
- } else if (!testPolicyContextItem002.equals(other.testPolicyContextItem002)) {
- return false;
- }
- if (testPolicyContextItem003 == null) {
- if (other.testPolicyContextItem003 != null) {
- return false;
- }
- } else if (!testPolicyContextItem003.equals(other.testPolicyContextItem003)) {
- return false;
- }
- if (testPolicyContextItem004 == null) {
- if (other.testPolicyContextItem004 != null) {
- return false;
- }
- } else if (!testPolicyContextItem004.equals(other.testPolicyContextItem004)) {
- return false;
- }
- if (testPolicyContextItem005 == null) {
- if (other.testPolicyContextItem005 != null) {
- return false;
- }
- } else if (!testPolicyContextItem005.equals(other.testPolicyContextItem005)) {
- return false;
- }
- return true;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return "TestPolicyContextItem [testPolicyContextItem000=" + testPolicyContextItem000
- + ", testPolicyContextItem001=" + testPolicyContextItem001 + ", testPolicyContextItem002="
- + testPolicyContextItem002 + ", testPolicyContextItem003=" + testPolicyContextItem003
- + ", testPolicyContextItem004=" + testPolicyContextItem004 + ", testPolicyContextItem005="
- + testPolicyContextItem005 + "]";
- }
-}
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/package-info.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/package-info.java
deleted file mode 100644
index d57b3fda3..000000000
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/package-info.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-/**
- * Defines test Java context classes.
- *
- * @author Liam Fallon (liam.fallon@ericsson.com)
- */
-
-package org.onap.policy.apex.context.test.concepts;
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextAlbumUpdate.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextAlbumUpdate.java
deleted file mode 100644
index eb6904a04..000000000
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextAlbumUpdate.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.apex.context.test.distribution;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.onap.policy.apex.context.test.utils.Constants.APEX_DISTRIBUTOR;
-import static org.onap.policy.apex.context.test.utils.Constants.VERSION;
-
-import org.onap.policy.apex.context.ContextAlbum;
-import org.onap.policy.apex.context.Distributor;
-import org.onap.policy.apex.context.impl.distribution.DistributorFactory;
-import org.onap.policy.apex.context.test.factory.TestContextAlbumFactory;
-import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
-import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
-import org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum;
-import org.onap.policy.apex.model.contextmodel.concepts.AxContextModel;
-import org.onap.policy.apex.model.utilities.comparison.KeyedMapComparer;
-import org.onap.policy.apex.model.utilities.comparison.KeyedMapDifference;
-import org.slf4j.ext.XLogger;
-import org.slf4j.ext.XLoggerFactory;
-
-/**
- * The Class ContextAlbumUpdate is used to test Context Album updates.
- */
-public class ContextAlbumUpdate {
- private static final XLogger LOGGER = XLoggerFactory.getXLogger(ContextAlbumUpdate.class);
-
- /**
- * Test context album update.
- *
- * @throws ApexException the apex exception
- */
- public void testContextAlbumUpdate() throws ApexException {
- LOGGER.debug("Running TestContextAlbumUpdate test . . .");
-
- final AxArtifactKey distributorKey = new AxArtifactKey(APEX_DISTRIBUTOR, VERSION);
- final Distributor contextDistributor = new DistributorFactory().getDistributor(distributorKey);
-
- final AxContextModel longModel = TestContextAlbumFactory.createLongContextModel();
- contextDistributor.registerModel(longModel);
-
- final AxContextAlbum longAlbum1Def = longModel.getAlbums().get(new AxArtifactKey("LongContextAlbum1", VERSION));
- final ContextAlbum longAlbum1 = contextDistributor.createContextAlbum(longAlbum1Def.getKey());
-
- assertNotNull(longAlbum1);
-
- final AxContextAlbum longAlbum2Def = longModel.getAlbums().get(new AxArtifactKey("LongContextAlbum2", VERSION));
- final ContextAlbum longAlbum2 = contextDistributor.createContextAlbum(longAlbum2Def.getKey());
-
- assertNotNull(longAlbum2);
-
- longAlbum1.put("0", (long) 0);
- longAlbum1.put("1", (long) 1);
- longAlbum1.put("2", (long) 2);
- longAlbum1.put("3", (long) 3);
-
- final KeyedMapDifference<String, Object> result0 =
- new KeyedMapComparer<String, Object>().compareMaps(longAlbum1, longAlbum2);
-
- assertEquals(0, result0.getDifferentValues().size());
- assertEquals(0, result0.getIdenticalValues().size());
- assertEquals(0, result0.getRightOnly().size());
- assertEquals(4, result0.getLeftOnly().size());
-
- longAlbum2.putAll(longAlbum1);
-
- final KeyedMapDifference<String, Object> result1 =
- new KeyedMapComparer<String, Object>().compareMaps(longAlbum1, longAlbum2);
-
-
- assertEquals(0, result1.getDifferentValues().size());
- assertEquals(4, result1.getIdenticalValues().size());
- assertEquals(0, result1.getRightOnly().size());
- assertEquals(0, result1.getLeftOnly().size());
-
- longAlbum1.put("4", (long) 4);
- longAlbum2.put("5", (long) 5);
- longAlbum1.put("67", (long) 6);
- longAlbum2.put("67", (long) 7);
-
- final KeyedMapDifference<String, Object> result2 =
- new KeyedMapComparer<String, Object>().compareMaps(longAlbum1, longAlbum2);
-
- assertEquals(1, result2.getDifferentValues().size());
- assertEquals(4, result2.getIdenticalValues().size());
- assertEquals(1, result2.getRightOnly().size());
- assertEquals(1, result2.getLeftOnly().size());
-
- longAlbum1.remove("0");
- longAlbum2.remove("3");
-
- final KeyedMapDifference<String, Object> result3 =
- new KeyedMapComparer<String, Object>().compareMaps(longAlbum1, longAlbum2);
-
- assertEquals(1, result3.getDifferentValues().size());
- assertEquals(2, result3.getIdenticalValues().size());
- assertEquals(2, result3.getRightOnly().size());
- assertEquals(2, result3.getLeftOnly().size());
- contextDistributor.clear();
- }
-}
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextInstantiation.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextInstantiation.java
deleted file mode 100644
index 8c4f40a5a..000000000
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextInstantiation.java
+++ /dev/null
@@ -1,554 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.apex.context.test.distribution;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.onap.policy.apex.context.test.factory.TestContextAlbumFactory.createPolicyContextModel;
-import static org.onap.policy.apex.context.test.utils.Constants.BYTE_VAL;
-import static org.onap.policy.apex.context.test.utils.Constants.EXCEPTION_MESSAGE;
-import static org.onap.policy.apex.context.test.utils.Constants.EXTERNAL_CONTEXT;
-import static org.onap.policy.apex.context.test.utils.Constants.EXTERNAL_CONTEXT_ALBUM;
-import static org.onap.policy.apex.context.test.utils.Constants.FLOAT_VAL;
-import static org.onap.policy.apex.context.test.utils.Constants.GLOBAL_CONTEXT_ALBUM;
-import static org.onap.policy.apex.context.test.utils.Constants.GLOBAL_CONTEXT_KEY;
-import static org.onap.policy.apex.context.test.utils.Constants.INT_VAL;
-import static org.onap.policy.apex.context.test.utils.Constants.INT_VAL_2;
-import static org.onap.policy.apex.context.test.utils.Constants.INT_VAL_3;
-import static org.onap.policy.apex.context.test.utils.Constants.LONG_VAL;
-import static org.onap.policy.apex.context.test.utils.Constants.PI_VAL;
-import static org.onap.policy.apex.context.test.utils.Constants.POLICY_CONTEXT_ALBUM;
-import static org.onap.policy.apex.context.test.utils.Constants.STRING_EXT_VAL;
-import static org.onap.policy.apex.context.test.utils.Constants.STRING_GLOBAL_VAL;
-import static org.onap.policy.apex.context.test.utils.Constants.STRING_VAL;
-import static org.onap.policy.apex.context.test.utils.Constants.TEST_POLICY_CONTEXT_ITEM;
-import static org.onap.policy.apex.context.test.utils.Constants.TIME_ZONE;
-import static org.onap.policy.apex.context.test.utils.Constants.VERSION;
-
-import java.util.Collection;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-import java.util.TreeSet;
-
-import org.onap.policy.apex.context.ContextAlbum;
-import org.onap.policy.apex.context.ContextException;
-import org.onap.policy.apex.context.ContextRuntimeException;
-import org.onap.policy.apex.context.Distributor;
-import org.onap.policy.apex.context.impl.distribution.DistributorFactory;
-import org.onap.policy.apex.context.test.concepts.TestContextBooleanItem;
-import org.onap.policy.apex.context.test.concepts.TestContextByteItem;
-import org.onap.policy.apex.context.test.concepts.TestContextDateItem;
-import org.onap.policy.apex.context.test.concepts.TestContextDateLocaleItem;
-import org.onap.policy.apex.context.test.concepts.TestContextDateTzItem;
-import org.onap.policy.apex.context.test.concepts.TestContextDoubleItem;
-import org.onap.policy.apex.context.test.concepts.TestContextFloatItem;
-import org.onap.policy.apex.context.test.concepts.TestContextIntItem;
-import org.onap.policy.apex.context.test.concepts.TestContextLongItem;
-import org.onap.policy.apex.context.test.concepts.TestContextLongObjectItem;
-import org.onap.policy.apex.context.test.concepts.TestContextStringItem;
-import org.onap.policy.apex.context.test.concepts.TestContextTreeMapItem;
-import org.onap.policy.apex.context.test.concepts.TestContextTreeSetItem;
-import org.onap.policy.apex.context.test.concepts.TestExternalContextItem;
-import org.onap.policy.apex.context.test.concepts.TestGlobalContextItem;
-import org.onap.policy.apex.context.test.concepts.TestPolicyContextItem;
-import org.onap.policy.apex.context.test.factory.TestContextAlbumFactory;
-import org.onap.policy.apex.context.test.utils.Constants;
-import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
-import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult;
-import org.onap.policy.apex.model.contextmodel.concepts.AxContextModel;
-import org.slf4j.ext.XLogger;
-import org.slf4j.ext.XLoggerFactory;
-
-/**
- * The Class TestContextInstantiation is used to test Apex context insitiation is correct.
- *
- * @author Sergey Sachkov (sergey.sachkov@ericsson.com)
- */
-public class ContextInstantiation {
- // Logger for this class
- private static final XLogger LOGGER = XLoggerFactory.getXLogger(ContextInstantiation.class);
-
- // Recurring string constants
- private static final String TEST_POLICY_CONTEXT_ITEM000 = "TestPolicyContextItem000";
- private static final String TEST_POLICY_CONTEXT_ITEM005 = "TestPolicyContextItem005";
- private static final String TEST_POLICY_CONTEXT_ITEM004 = "TestPolicyContextItem004";
- private static final String TEST_POLICY_CONTEXT_ITEM003 = "TestPolicyContextItem003";
- private static final String TEST_POLICY_CONTEXT_ITEM002 = "TestPolicyContextItem002";
- private static final String TEST_POLICY_CONTEXT_ITEM001 = "TestPolicyContextItem001";
- private static final String NORMAL_TEST_EXCEPTION = "normal test exception";
- private static final String NULL_VALUES_ILLEGAL_TAG =
- "album \"ExternalContextAlbum:0.0.1\" null values are illegal on key ";
-
- private static final TreeSet<String> TEST_TREE_SET = new TreeSet<>();
- private static final Map<String, String> TEST_HASH_MAP = new HashMap<>();
-
- static {
- TEST_TREE_SET.add("one hundred");
- TEST_TREE_SET.add("one hundred and one");
- TEST_TREE_SET.add("one hundred and two");
- TEST_TREE_SET.add("one hundred and three");
- TEST_TREE_SET.add("one hundred and four");
-
- TEST_HASH_MAP.put("0", "zero");
- TEST_HASH_MAP.put("1", "one");
- TEST_HASH_MAP.put("2", "two");
- TEST_HASH_MAP.put("3", "three");
- TEST_HASH_MAP.put("4", "four");
-
- }
-
- /**
- * Test context instantiation.
- *
- * @throws ContextException the context exception
- */
- public void testContextInstantiation() throws ContextException {
- LOGGER.debug("Running TestContextInstantiation test . . .");
-
- final Distributor contextDistributor = getDistributor();
-
- final ContextAlbum policyContextAlbum = contextDistributor
- .createContextAlbum(new AxArtifactKey(POLICY_CONTEXT_ALBUM, VERSION));
-
- assertNotNull(policyContextAlbum);
- policyContextAlbum.setUserArtifactStack(Constants.getAxArtifactKeyArray());
-
- final Date testDate = new Date();
-
- final TestContextDateTzItem tci9 = getTestContextDateTzItem(testDate);
- final TestContextDateLocaleItem tciA = getTestContextDateLocaleItem(testDate);
-
- final TestPolicyContextItem policyContext = getTestPolicyContextItem(policyContextAlbum, testDate);
-
- final Map<String, Object> valueMap0 = new HashMap<>();
- valueMap0.put(TEST_POLICY_CONTEXT_ITEM, policyContext);
-
- policyContextAlbum.putAll(valueMap0);
-
- final TestPolicyContextItem contextItem = (TestPolicyContextItem) policyContextAlbum
- .get(TEST_POLICY_CONTEXT_ITEM);
- assertEquals(STRING_VAL, contextItem.getTestPolicyContextItem000().getStringValue());
-
- assertEquals(LONG_VAL, contextItem.getTestPolicyContextItem001().getLongValue());
- assertDouble(contextItem.getTestPolicyContextItem002().getDoubleValue(), PI_VAL);
- assertTrue(contextItem.getTestPolicyContextItem003().getFlag());
- assertEquals(contextItem.getTestPolicyContextItem004().getLongValue(), testDate.getTime());
- assertEquals(TEST_HASH_MAP, contextItem.getTestPolicyContextItem005().getMapValue());
-
- final TestGlobalContextItem globalContext = getTestGlobalContextItem(contextDistributor, testDate, tci9,
- tciA);
-
- final Map<String, Object> valueMap1 = new HashMap<>();
- valueMap1.put(GLOBAL_CONTEXT_KEY, globalContext);
-
- final ContextAlbum globalContextAlbum = getContextAlbum(contextDistributor);
-
- globalContextAlbum.putAll(valueMap1);
-
- final TestGlobalContextItem globalContextItem = (TestGlobalContextItem) globalContextAlbum
- .get(GLOBAL_CONTEXT_KEY);
-
- assertFalse(globalContextItem.getTestGlobalContextItem000().getFlag());
-
- assertEquals(BYTE_VAL, globalContextItem.getTestGlobalContextItem001().getByteValue());
-
- assertEquals(INT_VAL, globalContextItem.getTestGlobalContextItem002().getIntValue());
- assertEquals(LONG_VAL, globalContextItem.getTestGlobalContextItem003().getLongValue());
- assertFloat(FLOAT_VAL, globalContextItem.getTestGlobalContextItem004().getFloatValue());
-
- assertDouble(PI_VAL, globalContextItem.getTestGlobalContextItem005().getDoubleValue());
- assertEquals(STRING_GLOBAL_VAL, globalContextItem.getTestGlobalContextItem006().getStringValue());
-
- assertEquals((Long) testDate.getTime(), globalContextItem.getTestGlobalContextItem007().getLongValue());
- assertEquals(testDate, globalContextItem.getTestGlobalContextItem008().getDateValue());
- assertEquals(tci9.getDateValue().getTime(),
- globalContextItem.getTestGlobalContextItem009().getDateValue().getTime());
-
- assertEquals(tciA.getDateValue().getTime(),
- globalContextItem.getTestGlobalContextItem00A().getDateValue().getTime());
-
- assertEquals(TEST_TREE_SET, globalContextItem.getTestGlobalContextItem00B().getSetValue());
- assertEquals(TEST_HASH_MAP, globalContextItem.getTestGlobalContextItem00C().getMapValue());
-
- final AxContextModel externalContextModel = TestContextAlbumFactory.createExternalContextModel();
-
- final TestContextDateTzItem tci9A = new TestContextDateTzItem(tci9);
- final TestContextDateLocaleItem tciAa = new TestContextDateLocaleItem(tciA);
- final TestExternalContextItem externalContext = getTestExternalContextItem(testDate, tci9A, tciAa);
-
- final Map<String, Object> valueMap2 = new HashMap<>();
- valueMap2.put(EXTERNAL_CONTEXT, externalContext);
-
- contextDistributor.clear();
- contextDistributor.init(new AxArtifactKey("ClearedandInittedDistributor", VERSION));
- contextDistributor.registerModel(externalContextModel);
-
- final AxArtifactKey axContextAlbumKey = new AxArtifactKey(EXTERNAL_CONTEXT_ALBUM, VERSION);
- final ContextAlbum externalContextAlbum = contextDistributor.createContextAlbum(axContextAlbumKey);
- assertNotNull(externalContextAlbum);
- externalContextAlbum.setUserArtifactStack(Constants.getAxArtifactKeyArray());
-
- externalContextAlbum.putAll(valueMap2);
- externalContextAlbum.getAlbumDefinition().setWritable(false);
-
- TestExternalContextItem externalContextItem = (TestExternalContextItem) externalContextAlbum
- .get(EXTERNAL_CONTEXT);
-
- assertFalse(externalContextItem.getTestExternalContextItem000().getFlag());
- assertEquals(BYTE_VAL, externalContextItem.getTestExternalContextItem001().getByteValue());
- assertEquals(INT_VAL, externalContextItem.getTestExternalContextItem002().getIntValue());
-
- assertFloat(LONG_VAL, externalContextItem.getTestExternalContextItem003().getLongValue());
- assertFloat(FLOAT_VAL, externalContextItem.getTestExternalContextItem004().getFloatValue());
-
- assertDouble(PI_VAL, externalContextItem.getTestExternalContextItem005().getDoubleValue());
- assertEquals(STRING_EXT_VAL, externalContextItem.getTestExternalContextItem006().getStringValue());
- assertEquals((Long) testDate.getTime(), externalContextItem.getTestExternalContextItem007().getLongValue());
- assertEquals(testDate, externalContextItem.getTestExternalContextItem008().getDateValue());
- assertEquals(tci9A.getDateValue().getTime(),
- externalContextItem.getTestExternalContextItem009().getDateValue().getTime());
-
- assertEquals(tciAa.getDateValue().getTime(),
- externalContextItem.getTestExternalContextItem00A().getDateValue().getTime());
- assertEquals(TEST_TREE_SET, externalContextItem.getTestExternalContextItem00B().getSetValue());
- assertEquals(TEST_HASH_MAP, externalContextItem.getTestExternalContextItem00C().getMapValue());
-
- final Collection<Object> mapValues = externalContextAlbum.values();
- assertTrue(externalContextAlbum.values().containsAll(mapValues));
-
- // Check that clearing does not work
- try {
- externalContextAlbum.clear();
- fail(EXCEPTION_MESSAGE);
- } catch (final ContextRuntimeException e) {
- assertEquals("album \"ExternalContextAlbum:0.0.1\" clear() not allowed on read only albums",
- e.getMessage());
- LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
- }
-
- assertEquals(1, externalContextAlbum.size());
-
- assertContextAlbumContains(externalContext, externalContextAlbum);
-
- final Set<Entry<String, Object>> entrySet = externalContextAlbum.entrySet();
- assertEquals(1, entrySet.size());
-
- try {
- externalContextAlbum.get(null);
- } catch (final ContextRuntimeException e) {
- assertEquals("album \"ExternalContextAlbum:0.0.1\" null keys are illegal on keys for get()",
- e.getMessage());
- LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
- }
-
- final Object aObject = externalContextAlbum.get(EXTERNAL_CONTEXT);
- assertEquals(aObject, externalContext);
-
- // put null keys should fail, throws a runtime exception
- try {
- externalContextAlbum.put(null, null);
- } catch (final ContextRuntimeException e) {
- assertEquals("album \"ExternalContextAlbum:0.0.1\" null keys are illegal on keys for put()",
- e.getMessage());
- LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
- }
-
- try {
- externalContextAlbum.put("TestExternalContextItem00A", null);
- } catch (final ContextRuntimeException e) {
- assertEquals(NULL_VALUES_ILLEGAL_TAG + "\"TestExternalContextItem00A\" for put()", e.getMessage());
- LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
- }
- assertEquals(tciAa, externalContextItem.getTestExternalContextItem00A());
-
- // Should return the hash set
- assertEquals(TEST_TREE_SET, externalContextItem.getTestExternalContextItem00B().getSetValue());
-
- assertTrue(externalContextAlbum.values().containsAll(mapValues));
-
- // Set the write flag back as it should be
- externalContextAlbum.getAlbumDefinition().setWritable(true);
-
- // Put should return the previous contextItem
- final TestExternalContextItem externalContextOther = new TestExternalContextItem();
- externalContextOther.setTestExternalContextItem002(new TestContextIntItem());
- externalContextOther.getTestExternalContextItem002().setIntValue(INT_VAL_2);
-
- assertTrue(externalContextAlbum.put(EXTERNAL_CONTEXT, externalContextOther).equals(externalContext));
- externalContextItem = (TestExternalContextItem) externalContextAlbum.get(EXTERNAL_CONTEXT);
- assertEquals(INT_VAL_2, externalContextItem.getTestExternalContextItem002().getIntValue());
- assertTrue(externalContextAlbum.put(EXTERNAL_CONTEXT, externalContext).equals(externalContextOther));
- externalContextItem = (TestExternalContextItem) externalContextAlbum.get(EXTERNAL_CONTEXT);
- assertEquals(INT_VAL_3, externalContextItem.getTestExternalContextItem002().getIntValue());
-
- try {
- externalContextAlbum.put("TestExternalContextItem00A", null);
- } catch (final ContextRuntimeException e) {
- assert (e.getMessage().equals(NULL_VALUES_ILLEGAL_TAG + "\"TestExternalContextItem00A\" for put()"));
- LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
- }
- assertTrue(externalContextAlbum.get(EXTERNAL_CONTEXT).equals(externalContext));
-
- try {
- externalContextAlbum.put("TestExternalContextItemFFF", null);
- } catch (final ContextRuntimeException e) {
- assert (e.getMessage().equals(NULL_VALUES_ILLEGAL_TAG + "\"TestExternalContextItemFFF\" for put()"));
- LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
- }
- assertEquals(1, externalContextAlbum.size());
-
- try {
- externalContextAlbum.put("TestExternalContextItemFFF", null);
- } catch (final ContextRuntimeException e) {
- assertEquals(NULL_VALUES_ILLEGAL_TAG + "\"TestExternalContextItemFFF\" for put()", e.getMessage());
- LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
- }
- assertEquals(1, externalContextAlbum.size());
-
- // Should ignore remove
- externalContextAlbum.remove("TestExternalContextItem017");
- assertEquals(1, externalContextAlbum.size());
- assertEquals(1, externalContextAlbum.values().size());
- assertTrue(externalContextAlbum.values().containsAll(mapValues));
-
- contextDistributor.clear();
- }
-
- private void assertContextAlbumContains(final TestExternalContextItem externalContext,
- final ContextAlbum externalContextAlbum) {
- try {
- externalContextAlbum.containsKey(null);
- } catch (final ContextRuntimeException e) {
- assertEquals("null values are illegal on method parameter \"key\"", e.getMessage());
- LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
- }
-
- assertTrue(externalContextAlbum.containsKey(EXTERNAL_CONTEXT));
- assertTrue(!externalContextAlbum.containsKey(GLOBAL_CONTEXT_KEY));
-
- try {
- externalContextAlbum.containsValue(null);
- } catch (final ContextRuntimeException e) {
- assertEquals("null values are illegal on method parameter \"value\"", e.getMessage());
- LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
- }
-
- assertTrue(externalContextAlbum.containsValue(externalContext));
- assertFalse(externalContextAlbum.containsValue("Hello"));
- }
-
- private ContextAlbum getContextAlbum(final Distributor contextDistributor) throws ContextException {
- final ContextAlbum globalContextAlbum = contextDistributor
- .createContextAlbum(new AxArtifactKey(GLOBAL_CONTEXT_ALBUM, VERSION));
- assertNotNull(globalContextAlbum);
- globalContextAlbum.setUserArtifactStack(Constants.getAxArtifactKeyArray());
- return globalContextAlbum;
- }
-
- private TestGlobalContextItem getTestGlobalContextItem(final Distributor contextDistributor, final Date testDate,
- final TestContextDateTzItem tci9, final TestContextDateLocaleItem tciA) throws ContextException {
- final AxContextModel globalContextModel = TestContextAlbumFactory.createGlobalContextModel();
- final TestGlobalContextItem globalContext = getTestGlobalContextItem(testDate, tci9, tciA);
- contextDistributor.registerModel(globalContextModel);
- return globalContext;
- }
-
- private TestGlobalContextItem getTestGlobalContextItem(final Date testDate, final TestContextDateTzItem tci9,
- final TestContextDateLocaleItem tciA) {
- final TestGlobalContextItem globalContext = new TestGlobalContextItem();
-
- final TestContextBooleanItem testGlobalContextItem000 = new TestContextBooleanItem(false);
- final TestContextByteItem testGlobalContextItem001 = new TestContextByteItem(BYTE_VAL);
- final TestContextIntItem testGlobalContextItem002 = new TestContextIntItem(INT_VAL);
- final TestContextLongItem testGlobalContextItem003 = new TestContextLongItem(LONG_VAL);
- final TestContextFloatItem testGlobalContextItem004 = new TestContextFloatItem(FLOAT_VAL);
- final TestContextDoubleItem testGlobalContextItem005 = new TestContextDoubleItem(PI_VAL);
- final TestContextStringItem testGlobalContextItem006 = new TestContextStringItem(STRING_GLOBAL_VAL);
- final TestContextLongObjectItem testGlobalContextItem007 = new TestContextLongObjectItem(testDate.getTime());
-
- final TestContextDateItem testGlobalContextItem008 = new TestContextDateItem(testDate);
- final TestContextTreeSetItem testGlobalContextItem00B = new TestContextTreeSetItem(TEST_TREE_SET);
- final TestContextTreeMapItem testGlobalContextItem00C = new TestContextTreeMapItem(TEST_HASH_MAP);
-
- globalContext.setTestGlobalContextItem000(testGlobalContextItem000);
- globalContext.setTestGlobalContextItem001(testGlobalContextItem001);
- globalContext.setTestGlobalContextItem002(testGlobalContextItem002);
- globalContext.setTestGlobalContextItem003(testGlobalContextItem003);
- globalContext.setTestGlobalContextItem004(testGlobalContextItem004);
- globalContext.setTestGlobalContextItem005(testGlobalContextItem005);
- globalContext.setTestGlobalContextItem006(testGlobalContextItem006);
- globalContext.setTestGlobalContextItem007(testGlobalContextItem007);
- globalContext.setTestGlobalContextItem008(testGlobalContextItem008);
- globalContext.setTestGlobalContextItem009(tci9);
- globalContext.setTestGlobalContextItem00A(tciA);
- globalContext.setTestGlobalContextItem00B(testGlobalContextItem00B);
- globalContext.setTestGlobalContextItem00C(testGlobalContextItem00C);
- return globalContext;
- }
-
- private TestPolicyContextItem getTestPolicyContextItem(final ContextAlbum policyContextAlbum, final Date testDate) {
- final TestContextStringItem contextStringItem = new TestContextStringItem(STRING_VAL);
- final TestContextLongItem contextLongItem = new TestContextLongItem(LONG_VAL);
- final TestContextDoubleItem contextDoubleItem = new TestContextDoubleItem(PI_VAL);
- final TestContextBooleanItem contextBooleanItem = new TestContextBooleanItem(true);
- final TestContextLongItem contextLongItem2 = new TestContextLongItem(testDate.getTime());
- final TestContextTreeMapItem contextTreeMapItem = new TestContextTreeMapItem(TEST_HASH_MAP);
-
- final Map<String, Object> valueMapA = new LinkedHashMap<>();
- valueMapA.put(TEST_POLICY_CONTEXT_ITEM001, contextLongItem);
- valueMapA.put(TEST_POLICY_CONTEXT_ITEM002, contextDoubleItem);
- valueMapA.put(TEST_POLICY_CONTEXT_ITEM003, contextBooleanItem);
- valueMapA.put(TEST_POLICY_CONTEXT_ITEM004, contextLongItem2);
- valueMapA.put(TEST_POLICY_CONTEXT_ITEM005, contextTreeMapItem);
- valueMapA.put(TEST_POLICY_CONTEXT_ITEM000, contextStringItem);
-
- assertPutMethods(policyContextAlbum, contextStringItem, valueMapA);
-
- final TestPolicyContextItem policyContext = new TestPolicyContextItem();
-
- LOGGER.debug(policyContextAlbum.toString());
-
- policyContext.setTestPolicyContextItem000(contextStringItem);
- policyContext.setTestPolicyContextItem001(contextLongItem);
- policyContext.setTestPolicyContextItem002(contextDoubleItem);
- policyContext.setTestPolicyContextItem003(contextBooleanItem);
- policyContext.setTestPolicyContextItem004(contextLongItem2);
- policyContext.setTestPolicyContextItem005(contextTreeMapItem);
- return policyContext;
- }
-
- private void assertPutMethods(final ContextAlbum policyContextAlbum, final TestContextStringItem contextStringItem,
- final Map<String, Object> valueMapA) {
- try {
- policyContextAlbum.put(TEST_POLICY_CONTEXT_ITEM000, contextStringItem);
- fail(EXCEPTION_MESSAGE);
- } catch (final ContextRuntimeException e) {
- assertEquals(getMessage(TEST_POLICY_CONTEXT_ITEM000, "TestContextItem006",
- TestContextStringItem.class.getCanonicalName(), "stringValue=" + STRING_VAL),
- e.getMessage());
- LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
- }
-
- try {
- policyContextAlbum.putAll(valueMapA);
- fail(EXCEPTION_MESSAGE);
- } catch (final ContextRuntimeException e) {
- assertEquals(getMessage(TEST_POLICY_CONTEXT_ITEM001, "TestContextItem003",
- TestContextLongItem.class.getCanonicalName(), "longValue=" + INT_VAL_3), e.getMessage());
- LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
- }
- }
-
- private AxContextModel getAxContextModel() {
- final AxContextModel policyContextModel = createPolicyContextModel();
- final AxValidationResult result = new AxValidationResult();
- policyContextModel.validate(result);
- LOGGER.debug(result.toString());
-
- assertTrue(result.isValid());
- return policyContextModel;
- }
-
- private TestContextDateLocaleItem getTestContextDateLocaleItem(final Date testDate) {
- final TestContextDateLocaleItem tciA = new TestContextDateLocaleItem();
- tciA.setDateValue(new TestContextDateItem(testDate));
- tciA.setTzValue(TIME_ZONE.getDisplayName());
- tciA.setDst(true);
- tciA.setUtcOffset(-600);
- tciA.setLocale(Locale.ENGLISH);
- return tciA;
- }
-
- private TestContextDateTzItem getTestContextDateTzItem(final Date testDate) {
- final TestContextDateTzItem tci9 = new TestContextDateTzItem();
- tci9.setDateValue(new TestContextDateItem(testDate));
- tci9.setTzValue(TIME_ZONE.getDisplayName());
- tci9.setDst(true);
- return tci9;
- }
-
- private TestExternalContextItem getTestExternalContextItem(final Date testDate, final TestContextDateTzItem tci9A,
- final TestContextDateLocaleItem tciAa) {
- final TestExternalContextItem externalContext = new TestExternalContextItem();
-
- final TestContextBooleanItem testExternalContextItem000 = new TestContextBooleanItem(false);
- final TestContextByteItem testExternalContextItem001 = new TestContextByteItem(BYTE_VAL);
- final TestContextIntItem testExternalContextItem002 = new TestContextIntItem(INT_VAL);
- final TestContextLongItem testExternalContextItem003 = new TestContextLongItem(LONG_VAL);
- final TestContextFloatItem testExternalContextItem004 = new TestContextFloatItem(new Float(3.14159265359));
- final TestContextDoubleItem testExternalContextItem005 = new TestContextDoubleItem(PI_VAL);
- final TestContextStringItem testExternalContextItem006 = new TestContextStringItem(STRING_EXT_VAL);
- final TestContextLongObjectItem testExternalContextItem007 = new TestContextLongObjectItem(testDate.getTime());
- final TestContextDateItem testExternalContextItem008 = new TestContextDateItem(testDate);
- final TestContextTreeSetItem testExternalContextItem00B = new TestContextTreeSetItem(TEST_TREE_SET);
- final TestContextTreeMapItem testExternalContextItem00C = new TestContextTreeMapItem(TEST_HASH_MAP);
-
- externalContext.setTestExternalContextItem000(testExternalContextItem000);
- externalContext.setTestExternalContextItem001(testExternalContextItem001);
- externalContext.setTestExternalContextItem002(testExternalContextItem002);
- externalContext.setTestExternalContextItem003(testExternalContextItem003);
- externalContext.setTestExternalContextItem004(testExternalContextItem004);
- externalContext.setTestExternalContextItem005(testExternalContextItem005);
- externalContext.setTestExternalContextItem006(testExternalContextItem006);
- externalContext.setTestExternalContextItem007(testExternalContextItem007);
- externalContext.setTestExternalContextItem008(testExternalContextItem008);
- externalContext.setTestExternalContextItem009(tci9A);
- externalContext.setTestExternalContextItem00A(tciAa);
- externalContext.setTestExternalContextItem00B(testExternalContextItem00B);
- externalContext.setTestExternalContextItem00C(testExternalContextItem00C);
- return externalContext;
- }
-
- private String getMessage(final String key, final String objName, final String clazzName, final String valString) {
- return getMessage(key, objName, clazzName, valString, TestPolicyContextItem.class.getCanonicalName());
- }
-
- private String getMessage(final String key, final String objName, final String clazzName, final String valString,
- final String compatibleClazzName) {
- return "Failed to set context value for key \"" + key + "\" in album \"PolicyContextAlbum:0.0.1\": "
- + "PolicyContextAlbum:0.0.1: object \"" + objName + " [" + valString + "]\" " + "of class \""
- + clazzName + "\"" + " not compatible with class \"" + compatibleClazzName + "\"";
- }
-
- private void assertFloat(final float actual, final float expected) {
- assertTrue(Float.compare(actual, expected) == 0);
- }
-
- private void assertDouble(final double actual, final double expected) {
- assertTrue(Double.compare(actual, expected) == 0);
- }
-
- private Distributor getDistributor() throws ContextException {
- final AxArtifactKey distributorKey = new AxArtifactKey("ApexDistributorInit", VERSION);
- final Distributor distributor = new DistributorFactory().getDistributor(distributorKey);
- final AxContextModel policyContextModel = getAxContextModel();
- distributor.registerModel(policyContextModel);
- return distributor;
- }
-}
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextUpdate.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextUpdate.java
deleted file mode 100644
index f8370ec6c..000000000
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextUpdate.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.apex.context.test.distribution;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.onap.policy.apex.context.test.utils.Constants.APEX_DISTRIBUTOR;
-import static org.onap.policy.apex.context.test.utils.Constants.DATE_CONTEXT_ALBUM;
-import static org.onap.policy.apex.context.test.utils.Constants.EXCEPTION_MESSAGE;
-import static org.onap.policy.apex.context.test.utils.Constants.LONG_CONTEXT_ALBUM;
-import static org.onap.policy.apex.context.test.utils.Constants.MAP_CONTEXT_ALBUM;
-import static org.onap.policy.apex.context.test.utils.Constants.TIME_ZONE;
-import static org.onap.policy.apex.context.test.utils.Constants.VERSION;
-import static org.onap.policy.apex.context.test.utils.Constants.getAxArtifactKeyArray;
-
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map;
-
-import org.onap.policy.apex.context.ContextAlbum;
-import org.onap.policy.apex.context.ContextException;
-import org.onap.policy.apex.context.ContextRuntimeException;
-import org.onap.policy.apex.context.Distributor;
-import org.onap.policy.apex.context.impl.distribution.DistributorFactory;
-import org.onap.policy.apex.context.test.concepts.TestContextDateItem;
-import org.onap.policy.apex.context.test.concepts.TestContextDateLocaleItem;
-import org.onap.policy.apex.context.test.concepts.TestContextTreeMapItem;
-import org.onap.policy.apex.context.test.factory.TestContextAlbumFactory;
-import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
-import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
-import org.onap.policy.apex.model.contextmodel.concepts.AxContextModel;
-import org.slf4j.ext.XLogger;
-import org.slf4j.ext.XLoggerFactory;
-
-/**
- * The Class TestContextUpdate checks context updates.
- *
- * @author Sergey Sachkov (sergey.sachkov@ericsson.com)
- */
-public class ContextUpdate {
- // Recurring string constants.
- private static final String NORMAL_TEST_EXCEPTION = "normal test exception";
-
- private static final String ZERO = "zero";
- private static final String NUMBER_ZERO = "0";
- // Logger for this class
- private static final XLogger LOGGER = XLoggerFactory.getXLogger(ContextUpdate.class);
-
- /**
- * Test context update.
- *
- * @throws ApexException the apex exception
- */
- public void testContextUpdate() throws ApexException {
- LOGGER.debug("Running TestContextUpdate test . . .");
-
- final Distributor contextDistributor = getDistributor();
-
- final ContextAlbum longContextAlbum = getContextAlbum(LONG_CONTEXT_ALBUM, contextDistributor);
- final ContextAlbum dateContextAlbum = getContextAlbum(DATE_CONTEXT_ALBUM, contextDistributor);
- final ContextAlbum mapContextAlbum = getContextAlbum(MAP_CONTEXT_ALBUM, contextDistributor);
-
- final TestContextDateLocaleItem tciA = getTestContextDateLocaleItem();
- final TestContextTreeMapItem tciC = getTestContextTreeMapItem();
-
- longContextAlbum.put(NUMBER_ZERO, (long) 0);
- longContextAlbum.put(NUMBER_ZERO, 0);
- longContextAlbum.put(NUMBER_ZERO, NUMBER_ZERO);
-
- try {
- longContextAlbum.put(NUMBER_ZERO, ZERO);
- fail(EXCEPTION_MESSAGE);
- } catch (final ContextRuntimeException e) {
- assertEquals("Failed to set context value for key \"0\" in album \"LongContextAlbum:0.0.1\":"
- + " LongContextAlbum:0.0.1: object \"zero\" of class \"java.lang.String\" not compatible with"
- + " class \"java.lang.Long\"", e.getMessage());
- LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
- }
-
- try {
- longContextAlbum.put(NUMBER_ZERO, "");
- fail(EXCEPTION_MESSAGE);
- } catch (final ContextRuntimeException e) {
- assertEquals(
- "Failed to set context value for key \"0\" in album \"LongContextAlbum:0.0.1\": LongContextAlbum"
- + ":0.0.1: object \"\" of class \"java.lang.String\" not compatible with class \"java.lang.Long\"",
- e.getMessage());
- LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
- }
-
- try {
- longContextAlbum.put(NUMBER_ZERO, null);
- fail(EXCEPTION_MESSAGE);
- } catch (final ContextRuntimeException e) {
- assertEquals("album \"LongContextAlbum:0.0.1\" null values are illegal on key \"0\" for put()",
- e.getMessage());
- LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
- }
-
- try {
- longContextAlbum.put(null, null);
- fail(EXCEPTION_MESSAGE);
- } catch (final ContextRuntimeException e) {
- assertEquals("album \"LongContextAlbum:0.0.1\" null keys are illegal on keys for put()", e.getMessage());
- LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
- }
-
- assertNull(dateContextAlbum.put("date0", tciA));
- assertTrue(dateContextAlbum.put("date0", tciA).equals(tciA));
-
- assertNull(mapContextAlbum.put("map0", tciC));
- assertTrue(mapContextAlbum.put("map0", tciC).equals(tciC));
-
- contextDistributor.clear();
- }
-
- private TestContextTreeMapItem getTestContextTreeMapItem() {
- final Map<String, String> testHashMap = new HashMap<>();
- testHashMap.put(NUMBER_ZERO, ZERO);
- testHashMap.put("1", "one");
- testHashMap.put("2", "two");
- testHashMap.put("3", "three");
- testHashMap.put("4", "four");
-
- return new TestContextTreeMapItem(testHashMap);
- }
-
- private TestContextDateLocaleItem getTestContextDateLocaleItem() {
- final TestContextDateLocaleItem tciA = new TestContextDateLocaleItem();
- tciA.setDateValue(new TestContextDateItem(new Date()));
- tciA.setTzValue(TIME_ZONE.getDisplayName());
- tciA.setDst(true);
- tciA.setUtcOffset(-600);
- tciA.setLocale(Locale.ENGLISH);
- return tciA;
- }
-
- private ContextAlbum getContextAlbum(final String albumKey, final Distributor contextDistributor)
- throws ContextException {
- final ContextAlbum longContextAlbum = contextDistributor
- .createContextAlbum(new AxArtifactKey(albumKey, VERSION));
- assertNotNull(longContextAlbum);
- longContextAlbum.setUserArtifactStack(getAxArtifactKeyArray());
- return longContextAlbum;
- }
-
- private Distributor getDistributor() throws ContextException {
- final AxArtifactKey distributorKey = new AxArtifactKey(APEX_DISTRIBUTOR, VERSION);
- final Distributor contextDistributor = new DistributorFactory().getDistributor(distributorKey);
-
- final AxContextModel multiModel = TestContextAlbumFactory.createMultiAlbumsContextModel();
- contextDistributor.registerModel(multiModel);
- return contextDistributor;
- }
-}
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/SequentialContextInstantiation.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/SequentialContextInstantiation.java
deleted file mode 100644
index 293ef9205..000000000
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/SequentialContextInstantiation.java
+++ /dev/null
@@ -1,385 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.apex.context.test.distribution;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.onap.policy.apex.context.test.factory.TestContextAlbumFactory.createMultiAlbumsContextModel;
-import static org.onap.policy.apex.context.test.utils.Constants.APEX_DISTRIBUTOR;
-import static org.onap.policy.apex.context.test.utils.Constants.BYTE_VAL;
-import static org.onap.policy.apex.context.test.utils.Constants.DATE_CONTEXT_ALBUM;
-import static org.onap.policy.apex.context.test.utils.Constants.EXCEPTION_MESSAGE;
-import static org.onap.policy.apex.context.test.utils.Constants.FLOAT_VAL;
-import static org.onap.policy.apex.context.test.utils.Constants.INT_VAL;
-import static org.onap.policy.apex.context.test.utils.Constants.LONG_VAL;
-import static org.onap.policy.apex.context.test.utils.Constants.PI_VAL;
-import static org.onap.policy.apex.context.test.utils.Constants.STRING_GLOBAL_VAL;
-import static org.onap.policy.apex.context.test.utils.Constants.TIME_ZONE;
-import static org.onap.policy.apex.context.test.utils.Constants.VERSION;
-
-import java.util.Collection;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-import java.util.TimeZone;
-
-import org.onap.policy.apex.context.ContextAlbum;
-import org.onap.policy.apex.context.ContextException;
-import org.onap.policy.apex.context.Distributor;
-import org.onap.policy.apex.context.impl.distribution.DistributorFactory;
-import org.onap.policy.apex.context.test.concepts.TestContextBooleanItem;
-import org.onap.policy.apex.context.test.concepts.TestContextByteItem;
-import org.onap.policy.apex.context.test.concepts.TestContextDateItem;
-import org.onap.policy.apex.context.test.concepts.TestContextDateLocaleItem;
-import org.onap.policy.apex.context.test.concepts.TestContextDateTzItem;
-import org.onap.policy.apex.context.test.concepts.TestContextDoubleItem;
-import org.onap.policy.apex.context.test.concepts.TestContextFloatItem;
-import org.onap.policy.apex.context.test.concepts.TestContextIntItem;
-import org.onap.policy.apex.context.test.concepts.TestContextLongItem;
-import org.onap.policy.apex.context.test.concepts.TestContextLongObjectItem;
-import org.onap.policy.apex.context.test.concepts.TestContextStringItem;
-import org.onap.policy.apex.context.test.utils.Constants;
-import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
-import org.slf4j.ext.XLogger;
-import org.slf4j.ext.XLoggerFactory;
-
-/**
- * The Class SequentialContextInstantiation checks sequential initiation of context.
- *
- * @author Sergey Sachkov (sergey.sachkov@ericsson.com)
- */
-public class SequentialContextInstantiation {
- // Logger for this class
- private static final XLogger LOGGER = XLoggerFactory.getXLogger(SequentialContextInstantiation.class);
-
- // Recurring string constants.
- private static final String TEST_AB = "TestAB";
- private static final String TEST_AA = "TestAA";
- private static final String ITEM_NULL = "ItemNull";
- private static final String ITEM06 = "Item06";
- private static final String ITEM05 = "Item05";
- private static final String ITEM03 = "Item03";
- private static final String ITEM02 = "Item02";
- private static final String ITEM01 = "Item01";
- private static final String ITEM00_2 = "Item00_2";
-
- // Recurring string constants.
- private static final String NORMAL_TEST_EXCEPTION = "normal test exception";
- private static final String DV1 = "dv1";
- private static final String DV0 = "dv0";
-
- /**
- * Test sequential context instantiation.
- *
- * @throws ContextException the context exception
- */
- public void testSequentialContextInstantiation() throws ContextException {
- LOGGER.debug("Running TestContextInstantiation test . . .");
-
- final Distributor contextDistributor = getDistributor();
-
- try {
- final ContextAlbum dateAlbum = getContextAlbum(DATE_CONTEXT_ALBUM, contextDistributor);
- final Date testDate = new Date();
- final TestContextDateLocaleItem tciA00 = getTestContextDateLocaleItem();
-
- dateAlbum.put(DV0, tciA00);
- assertEquals(tciA00, dateAlbum.get(DV0));
-
- dateAlbum.put(DV1, tciA00);
- assertEquals(tciA00, dateAlbum.get(DV1));
-
- final TestContextDateTzItem tci9 = getTestContextDateTzItem(testDate);
-
- try {
- dateAlbum.put("tci9", tci9);
- } catch (final Exception e) {
- final String message = "class \"" + TestContextDateTzItem.class.getCanonicalName()
- + "\" not compatible with class \"" + TestContextDateLocaleItem.class.getCanonicalName()
- + "\"";
- assertTrue(e.getMessage().contains(message));
- LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
- }
-
- final TestContextDateLocaleItem tciA01 = new TestContextDateLocaleItem(tciA00);
- final TestContextDateLocaleItem tciA02 = new TestContextDateLocaleItem(tciA00);
- final TestContextDateLocaleItem tciA03 = new TestContextDateLocaleItem(tciA00);
-
- final Map<String, Object> valueMap0 = new HashMap<>();
- valueMap0.put(ITEM01, tciA01);
- valueMap0.put(ITEM02, tciA02);
- valueMap0.put(ITEM03, tciA03);
-
- dateAlbum.putAll(valueMap0);
- assertEquals(5, dateAlbum.size());
- assertEquals(tciA01, dateAlbum.get(ITEM01));
- assertEquals(tciA02, dateAlbum.get(ITEM02));
- assertEquals(tciA03, dateAlbum.get(ITEM03));
-
- final Map<String, Object> valueMap1 = getMap(testDate, tciA00, tci9);
-
- // Get another reference to the album
- final ContextAlbum dateAlbum1 = getContextAlbum(DATE_CONTEXT_ALBUM, contextDistributor);
-
- try {
- dateAlbum1.putAll(valueMap1);
- fail(EXCEPTION_MESSAGE);
- } catch (final Exception e) {
- assertTrue(e.getMessage().endsWith("not compatible with class \""
- + TestContextDateLocaleItem.class.getCanonicalName() + "\""));
- LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
- }
- assertEquals(5, dateAlbum1.size());
-
- valueMap1.clear();
- valueMap1.put(ITEM00_2, tciA00);
- dateAlbum1.putAll(valueMap1);
- assertEquals(6, dateAlbum1.size());
-
- assertEquals(tciA00, dateAlbum1.get(ITEM00_2));
- dateAlbum.remove(ITEM00_2);
- assertEquals(5, dateAlbum1.size());
-
- final ContextAlbum dateAlbumCopy = getContextAlbum(DATE_CONTEXT_ALBUM, contextDistributor);
-
- final Map<String, Object> valueMap2 = new HashMap<>();
- valueMap2.put("Item04", tciA01);
- valueMap2.put(ITEM05, tciA02);
- valueMap2.put(ITEM06, tciA03);
-
- dateAlbumCopy.putAll(valueMap2);
- assertEquals(8, dateAlbumCopy.size());
-
- assertEquals(tciA03, dateAlbumCopy.get(ITEM06));
-
- final Collection<Object> mapValues = dateAlbum.values();
- assertTrue(dateAlbumCopy.values().containsAll(mapValues));
-
- // Check that clearing works
- dateAlbum1.clear();
- assertTrue(dateAlbum1.isEmpty());
-
- dateAlbum.put("Item00", tciA00);
- final Map<String, Object> valueMap3 = new HashMap<>();
- valueMap3.put(ITEM01, tciA01);
- valueMap3.put(ITEM02, tciA02);
- valueMap3.put(ITEM03, tciA03);
- dateAlbum.putAll(valueMap3);
-
- final Map<String, Object> valueMap4 = new HashMap<>();
- valueMap4.put("Item04", tciA01);
- valueMap4.put(ITEM05, tciA02);
- valueMap4.put(ITEM06, tciA03);
-
- dateAlbumCopy.putAll(valueMap4);
-
- assertContains(dateAlbum, tciA01);
-
- final Set<Entry<String, Object>> entrySet = dateAlbum.entrySet();
- assertEquals(7, entrySet.size());
-
- assertAlbumGetAndPutMethods(dateAlbum, tciA03, tciA00);
-
- // Should do removes
- dateAlbum.remove(TEST_AA);
- dateAlbum.remove(TEST_AB);
- dateAlbum.remove(ITEM_NULL);
- assertEquals(7, entrySet.size());
- assertTrue(dateAlbumCopy.values().containsAll(mapValues));
- // CHECKSTYLE:ON: checkstyle:magicNumber
- } finally {
- contextDistributor.clear();
- }
- }
-
- private void assertContains(final ContextAlbum dateAlbum, final TestContextDateLocaleItem tciA01) {
- try {
- dateAlbum.containsKey(null);
- fail(EXCEPTION_MESSAGE);
- } catch (final Exception e) {
- assertEquals("null values are illegal on method parameter \"key\"", e.getMessage());
- LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
- }
-
- assertTrue(dateAlbum.containsKey(ITEM05));
- assertTrue(!dateAlbum.containsKey("Item07"));
-
- try {
- dateAlbum.containsValue(null);
- } catch (final Exception e) {
- assertEquals("null values are illegal on method parameter \"value\"", e.getMessage());
- LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
- }
-
- assertTrue(dateAlbum.containsValue(tciA01));
- assertTrue(!dateAlbum.containsValue("Hello"));
- }
-
- private void assertAlbumGetAndPutMethods(final ContextAlbum dateAlbum, final TestContextDateLocaleItem tciA03,
- final TestContextDateLocaleItem tciA00) {
- try {
- dateAlbum.get(null);
- fail(EXCEPTION_MESSAGE);
- } catch (final Exception e) {
- assertEquals("album \"DateContextAlbum:0.0.1\" null keys are illegal on keys for get()", e.getMessage());
- LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
- }
-
- final Object aObject = dateAlbum.get(ITEM03);
- assertEquals(tciA03, aObject);
- try {
- dateAlbum.put(null, null);
- fail(EXCEPTION_MESSAGE);
- } catch (final Exception e) {
- assertEquals("album \"DateContextAlbum:0.0.1\" null keys are illegal on keys for put()", e.getMessage());
- LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
- }
-
- // Put null ContextItem should work (return null)
- try {
- dateAlbum.put(ITEM_NULL, null);
- } catch (final Exception e) {
- assertEquals("album \"DateContextAlbum:0.0.1\" null values are illegal on key \"ItemNull\" for put()",
- e.getMessage());
- LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
- }
-
- // Should return null
- assertNull(dateAlbum.get(ITEM_NULL));
- // Put should return the previous contextItem
- tciA00.setDst(false);
- final TestContextDateLocaleItem tciA03Clone = new TestContextDateLocaleItem(tciA03);
- tciA03Clone.setDst(true);
- TestContextDateLocaleItem retItem = (TestContextDateLocaleItem) dateAlbum.put(ITEM03, tciA03Clone);
- assertEquals(tciA03, retItem);
- retItem = (TestContextDateLocaleItem) dateAlbum.put(ITEM03, tciA03);
- assertEquals(tciA03Clone, retItem);
-
- try {
- dateAlbum.put(ITEM_NULL, null);
- fail(EXCEPTION_MESSAGE);
-
- } catch (final Exception e) {
- assert ("album \"DateContextAlbum:0.0.1\" null values are illegal on key \"ItemNull\" for put()"
- .equals(e.getMessage()));
- LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
- }
-
- dateAlbum.put(TEST_AA, tciA00);
- assertEquals(tciA00, dateAlbum.get(TEST_AA));
-
- // Should print warning
- try {
- dateAlbum.put(TEST_AA, null);
- fail(EXCEPTION_MESSAGE);
- } catch (final Exception e) {
- assertEquals("album \"DateContextAlbum:0.0.1\" null values are illegal on key \"TestAA\" for put()",
- e.getMessage());
- LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
- }
- assertEquals(8, dateAlbum.size());
- try {
- dateAlbum.put(TEST_AB, null);
- fail(EXCEPTION_MESSAGE);
- } catch (final Exception e) {
- assertEquals("album \"DateContextAlbum:0.0.1\" null values are illegal on key \"TestAB\" for put()",
- e.getMessage());
- LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
- }
- assertEquals(8, dateAlbum.size());
- }
-
- private Map<String, Object> getMap(final Date testDate, final TestContextDateLocaleItem tciA00,
- final TestContextDateTzItem tci9) {
- final TestContextBooleanItem testBadItem000 = new TestContextBooleanItem();
- final TestContextByteItem testBadItem001 = new TestContextByteItem();
- final TestContextIntItem testBadItem002 = new TestContextIntItem();
- final TestContextLongItem testBadItem003 = new TestContextLongItem();
- final TestContextFloatItem testBadItem004 = new TestContextFloatItem();
- final TestContextDoubleItem testBadItem005 = new TestContextDoubleItem();
- final TestContextStringItem testBadItem006 = new TestContextStringItem();
- final TestContextLongObjectItem testBadItem007 = new TestContextLongObjectItem();
- final TestContextDateItem testBadItem008 = new TestContextDateItem();
-
- testBadItem000.setFlag(false);
- testBadItem001.setByteValue(BYTE_VAL);
- testBadItem002.setIntValue(INT_VAL);
- testBadItem003.setLongValue(LONG_VAL);
- testBadItem004.setFloatValue(FLOAT_VAL);
- testBadItem005.setDoubleValue(PI_VAL);
- testBadItem006.setStringValue(STRING_GLOBAL_VAL);
- testBadItem007.setLongValue(testDate.getTime());
- testBadItem008.setDateValue(testDate);
-
- final Map<String, Object> values = new HashMap<>();
- values.put("TestBadItem000", testBadItem000);
- values.put("TestBadItem001", testBadItem001);
- values.put("TestBadItem002", testBadItem002);
- values.put("TestBadItem003", testBadItem003);
- values.put("TestBadItem004", testBadItem004);
- values.put("TestBadItem005", testBadItem005);
- values.put("TestBadItem006", testBadItem006);
- values.put("TestBadItem007", testBadItem007);
- values.put("TestBadItem008", testBadItem008);
- values.put("TestBadItem009", tci9);
- values.put(ITEM00_2, tciA00);
- return values;
- }
-
- private TestContextDateTzItem getTestContextDateTzItem(final Date testDate) {
- final TestContextDateTzItem tci9 = new TestContextDateTzItem();
- tci9.setDateValue(new TestContextDateItem(testDate));
- tci9.setTzValue(TimeZone.getTimeZone("Europe/Dublin").getDisplayName());
- tci9.setDst(true);
- return tci9;
- }
-
- private TestContextDateLocaleItem getTestContextDateLocaleItem() {
- final TestContextDateLocaleItem tciA00 = new TestContextDateLocaleItem();
- tciA00.setDateValue(new TestContextDateItem(new Date()));
- tciA00.setTzValue(TIME_ZONE.getDisplayName());
- tciA00.setDst(true);
- tciA00.setUtcOffset(-600);
- tciA00.setLocale(Locale.ENGLISH);
- return tciA00;
- }
-
- private ContextAlbum getContextAlbum(final String albumName, final Distributor contextDistributor)
- throws ContextException {
- final ContextAlbum dateAlbum = contextDistributor.createContextAlbum(new AxArtifactKey(albumName, VERSION));
- assertNotNull(dateAlbum);
- dateAlbum.setUserArtifactStack(Constants.getAxArtifactKeyArray());
- return dateAlbum;
- }
-
- private Distributor getDistributor() throws ContextException {
- final AxArtifactKey distributorKey = new AxArtifactKey(APEX_DISTRIBUTOR, VERSION);
- final Distributor contextDistributor = new DistributorFactory().getDistributor(distributorKey);
- contextDistributor.registerModel(createMultiAlbumsContextModel());
- return contextDistributor;
- }
-}
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/package-info.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/package-info.java
deleted file mode 100644
index 148c8cac4..000000000
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/package-info.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-/**
- * Runs context distribution tests in APEX.
- *
- * @author Liam Fallon (liam.fallon@ericsson.com)
- */
-
-package org.onap.policy.apex.context.test.distribution;
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/entities/ArtifactKeyTestEntity.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/entities/ArtifactKeyTestEntity.java
deleted file mode 100644
index c40eeba98..000000000
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/entities/ArtifactKeyTestEntity.java
+++ /dev/null
@@ -1,257 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.apex.context.test.entities;
-
-import java.util.Arrays;
-import java.util.List;
-
-import javax.persistence.EmbeddedId;
-import javax.persistence.Entity;
-import javax.persistence.Table;
-import javax.xml.bind.annotation.XmlElement;
-
-import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
-import org.onap.policy.apex.model.basicmodel.concepts.AxConcept;
-import org.onap.policy.apex.model.basicmodel.concepts.AxKey;
-import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult;
-
-/**
- * The Class ArtifactKeyTestEntity is an entity for testing artifact keys.
- */
-@Entity
-@Table(name = "ArtifactKeyTestEntity")
-public class ArtifactKeyTestEntity extends AxConcept {
- private static final long serialVersionUID = -2962570563281067896L;
-
- @EmbeddedId()
- @XmlElement(name = "key", required = true)
- protected AxArtifactKey key;
-
- private double doubleValue;
-
- /**
- * Instantiates a new artifact key test entity.
- */
- public ArtifactKeyTestEntity() {
- this.key = new AxArtifactKey();
- this.doubleValue = 0;
- }
-
- /**
- * Instantiates a new artifact key test entity.
- *
- * @param doubleValue the double value
- */
- public ArtifactKeyTestEntity(final Double doubleValue) {
- this.key = new AxArtifactKey();
- this.doubleValue = doubleValue;
- }
-
- /**
- * Instantiates a new artifact key test entity.
- *
- * @param key the key
- * @param doubleValue the double value
- */
- public ArtifactKeyTestEntity(final AxArtifactKey key, final Double doubleValue) {
- this.key = key;
- this.doubleValue = doubleValue;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#getKey()
- */
- @Override
- public AxArtifactKey getKey() {
- return key;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#getKeys()
- */
- @Override
- public List<AxKey> getKeys() {
- return Arrays.asList((AxKey) getKey());
- }
-
- /**
- * Sets the key.
- *
- * @param key the new key
- */
- public void setKey(final AxArtifactKey key) {
- this.key = key;
- }
-
- /**
- * Check set key.
- *
- * @return true, if successful
- */
- public boolean checkSetKey() {
- return (this.key != null);
- }
-
- /**
- * Gets the double value.
- *
- * @return the double value
- */
- public double getDoubleValue() {
- return doubleValue;
- }
-
- /**
- * Sets the double value.
- *
- * @param doubleValue the new double value
- */
- public void setDoubleValue(final double doubleValue) {
- this.doubleValue = doubleValue;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.onap.policy.apex.model.basicmodel.concepts.AxConcept#validate(org.onap.policy.apex.model.basicmodel.concepts.
- * AxValidationResult)
- */
- @Override
- public AxValidationResult validate(final AxValidationResult result) {
- return key.validate(result);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#clean()
- */
- @Override
- public void clean() {
- key.clean();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#toString()
- */
- @Override
- public String toString() {
- return "ArtifactKeyTestEntity [key=" + key + ", doubleValue=" + doubleValue + "]";
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.onap.policy.apex.model.basicmodel.concepts.AxConcept#copyTo(org.onap.policy.apex.model.basicmodel.concepts.
- * AxConcept)
- */
- @Override
- public AxConcept copyTo(final AxConcept target) {
- final Object copyObject = ((target == null) ? new ArtifactKeyTestEntity() : target);
- if (copyObject instanceof ArtifactKeyTestEntity) {
- final ArtifactKeyTestEntity copy = ((ArtifactKeyTestEntity) copyObject);
- if (this.checkSetKey()) {
- copy.setKey(new AxArtifactKey(key));
- } else {
- copy.key = null;
- }
- copy.doubleValue = doubleValue;
- return copy;
- } else {
- return null;
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#hashCode()
- */
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((key == null) ? 0 : key.hashCode());
- return result;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#equals(java.lang.Object)
- */
- @Override
- public boolean equals(final Object obj) {
- if (obj == null) {
- return false;
- }
- if (this == obj) {
- return true;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- final ArtifactKeyTestEntity other = (ArtifactKeyTestEntity) obj;
- if (key == null) {
- if (other.key != null) {
- return false;
- }
- } else if (!key.equals(other.key)) {
- return false;
- }
- return (Double.compare(doubleValue, other.doubleValue) == 0);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Comparable#compareTo(java.lang.Object)
- */
- @Override
- public int compareTo(final AxConcept otherObj) {
- if (otherObj == null) {
- return -1;
- }
- if (this == otherObj) {
- return 0;
- }
- if (getClass() != otherObj.getClass()) {
- return -1;
- }
- final ArtifactKeyTestEntity other = (ArtifactKeyTestEntity) otherObj;
- if (key == null) {
- if (other.key != null) {
- return 1;
- }
- } else if (!key.equals(other.key)) {
- return key.compareTo(other.key);
- }
- return Double.compare(doubleValue, other.doubleValue);
- }
-}
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/entities/ReferenceKeyTestEntity.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/entities/ReferenceKeyTestEntity.java
deleted file mode 100644
index 3c421a7a9..000000000
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/entities/ReferenceKeyTestEntity.java
+++ /dev/null
@@ -1,260 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.apex.context.test.entities;
-
-import java.util.Arrays;
-import java.util.List;
-
-import javax.persistence.EmbeddedId;
-import javax.persistence.Entity;
-import javax.persistence.Table;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-
-import org.onap.policy.apex.model.basicmodel.concepts.AxConcept;
-import org.onap.policy.apex.model.basicmodel.concepts.AxKey;
-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.xml.AxReferenceKeyAdapter;
-
-/**
- * The Class ReferenceKeyTestEntity provides a reference key test concept.
- */
-@Entity
-@Table(name = "ReferenceKeyTestEntity")
-public class ReferenceKeyTestEntity extends AxConcept {
- private static final long serialVersionUID = -2962570563281067895L;
-
- @EmbeddedId()
- @XmlElement(name = "key", required = true)
- @XmlJavaTypeAdapter(AxReferenceKeyAdapter.class)
- protected AxReferenceKey key;
-
- private double doubleValue;
-
- /**
- * Instantiates a new reference key test entity.
- */
- public ReferenceKeyTestEntity() {
- this.key = new AxReferenceKey();
- this.doubleValue = 0;
- }
-
- /**
- * Instantiates a new reference key test entity.
- *
- * @param doubleValue the double value
- */
- public ReferenceKeyTestEntity(final Double doubleValue) {
- this.key = new AxReferenceKey();
- this.doubleValue = doubleValue;
- }
-
- /**
- * Instantiates a new reference key test entity.
- *
- * @param key the key
- * @param doubleValue the double value
- */
- public ReferenceKeyTestEntity(final AxReferenceKey key, final Double doubleValue) {
- this.key = key;
- this.doubleValue = doubleValue;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#getKey()
- */
- @Override
- public AxReferenceKey getKey() {
- return key;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#getKeys()
- */
- @Override
- public List<AxKey> getKeys() {
- return Arrays.asList((AxKey) getKey());
- }
-
- /**
- * Sets the key.
- *
- * @param key the new key
- */
- public void setKey(final AxReferenceKey key) {
- this.key = key;
- }
-
- /**
- * Check set key.
- *
- * @return true, if successful
- */
- public boolean checkSetKey() {
- return (this.key != null);
- }
-
- /**
- * Gets the double value.
- *
- * @return the double value
- */
- public double getDoubleValue() {
- return doubleValue;
- }
-
- /**
- * Sets the double value.
- *
- * @param doubleValue the new double value
- */
- public void setDoubleValue(final double doubleValue) {
- this.doubleValue = doubleValue;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.onap.policy.apex.model.basicmodel.concepts.AxConcept#validate(org.onap.policy.apex.model.basicmodel.concepts.
- * AxValidationResult)
- */
- @Override
- public AxValidationResult validate(final AxValidationResult result) {
- return key.validate(result);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#clean()
- */
- @Override
- public void clean() {
- key.clean();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#toString()
- */
- @Override
- public String toString() {
- return "ReferenceKeyTestEntity [key=" + key + ", doubleValue=" + doubleValue + "]";
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.onap.policy.apex.model.basicmodel.concepts.AxConcept#copyTo(org.onap.policy.apex.model.basicmodel.concepts.
- * AxConcept)
- */
- @Override
- public AxConcept copyTo(final AxConcept target) {
- final Object copyObject = ((target == null) ? new ReferenceKeyTestEntity() : target);
- if (copyObject instanceof ReferenceKeyTestEntity) {
- final ReferenceKeyTestEntity copy = ((ReferenceKeyTestEntity) copyObject);
- if (this.checkSetKey()) {
- copy.setKey(new AxReferenceKey(key));
- } else {
- copy.key = null;
- }
- copy.doubleValue = doubleValue;
- return copy;
- } else {
- return null;
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#hashCode()
- */
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((key == null) ? 0 : key.hashCode());
- return result;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#equals(java.lang.Object)
- */
- @Override
- public boolean equals(final Object obj) {
- if (obj == null) {
- return false;
- }
- if (this == obj) {
- return true;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- final ReferenceKeyTestEntity other = (ReferenceKeyTestEntity) obj;
- if (key == null) {
- if (other.key != null) {
- return false;
- }
- } else if (!key.equals(other.key)) {
- return false;
- }
- return (Double.compare(doubleValue, other.doubleValue) == 0);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Comparable#compareTo(java.lang.Object)
- */
- @Override
- public int compareTo(final AxConcept otherObj) {
- if (otherObj == null) {
- return -1;
- }
- if (this == otherObj) {
- return 0;
- }
- if (getClass() != otherObj.getClass()) {
- return -1;
- }
- final ReferenceKeyTestEntity other = (ReferenceKeyTestEntity) otherObj;
- if (key == null) {
- if (other.key != null) {
- return 1;
- }
- } else if (!key.equals(other.key)) {
- return key.compareTo(other.key);
- }
- return Double.compare(doubleValue, other.doubleValue);
- }
-}
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/entities/package-info.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/entities/package-info.java
deleted file mode 100644
index be51a4e7e..000000000
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/entities/package-info.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-/**
- * Contains common test entities.
- * @author Dinh Danh Le (dinh.danh.le@ericsson.com)
- *
- */
-package org.onap.policy.apex.context.test.entities;
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/factory/TestContextAlbumFactory.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/factory/TestContextAlbumFactory.java
deleted file mode 100644
index 9689acb3d..000000000
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/factory/TestContextAlbumFactory.java
+++ /dev/null
@@ -1,216 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.apex.context.test.factory;
-
-import static org.onap.policy.apex.context.test.utils.Constants.DATE_CONTEXT_ALBUM;
-import static org.onap.policy.apex.context.test.utils.Constants.EXTERNAL_CONTEXT_ALBUM;
-import static org.onap.policy.apex.context.test.utils.Constants.GLOBAL_CONTEXT_ALBUM;
-import static org.onap.policy.apex.context.test.utils.Constants.LONG_CONTEXT_ALBUM;
-import static org.onap.policy.apex.context.test.utils.Constants.MAP_CONTEXT_ALBUM;
-import static org.onap.policy.apex.context.test.utils.Constants.POLICY_CONTEXT_ALBUM;
-import static org.onap.policy.apex.context.test.utils.Constants.VERSION;
-
-import org.onap.policy.apex.context.test.concepts.TestContextDateLocaleItem;
-import org.onap.policy.apex.context.test.concepts.TestContextLongItem;
-import org.onap.policy.apex.context.test.concepts.TestContextTreeMapItem;
-import org.onap.policy.apex.context.test.concepts.TestExternalContextItem;
-import org.onap.policy.apex.context.test.concepts.TestGlobalContextItem;
-import org.onap.policy.apex.context.test.concepts.TestPolicyContextItem;
-import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
-import org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation;
-import org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum;
-import org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbums;
-import org.onap.policy.apex.model.contextmodel.concepts.AxContextModel;
-import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema;
-import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas;
-
-/**
- * The Class TestContextAlbumFactory creates test context albums.
- *
- * @author Liam Fallon (liam.fallon@ericsson.com)
- */
-public final class TestContextAlbumFactory {
- // Recurring string constants.
- private static final String CONTEXT = "context";
- private static final String SCHEMAS2 = "Schemas";
- private static final String KEY_INFO_MAP_KEY = "KeyInfoMapKey";
- private static final String APPLICATION = "APPLICATION";
- private static final String JAVA_LONG = Long.class.getCanonicalName();
- private static final String JAVA_FLAVOUR = "Java";
-
- /**
- * Default constructor to prevent sub-classing.
- */
- private TestContextAlbumFactory() {}
-
- /**
- * Creates the policy context model.
- *
- * @return the ax context model
- */
- public static AxContextModel createPolicyContextModel() {
- final AxContextSchema policySchema = new AxContextSchema(new AxArtifactKey("PolicySchema", VERSION),
- JAVA_FLAVOUR, TestPolicyContextItem.class.getCanonicalName());
- final AxContextAlbum albumDefinition = new AxContextAlbum(new AxArtifactKey(POLICY_CONTEXT_ALBUM, VERSION),
- APPLICATION, true, policySchema.getKey());
-
- final AxContextSchemas schemas = new AxContextSchemas(new AxArtifactKey(SCHEMAS2, VERSION));
- schemas.getSchemasMap().put(policySchema.getKey(), policySchema);
- final AxContextAlbums albums = new AxContextAlbums(new AxArtifactKey(CONTEXT, VERSION));
- albums.getAlbumsMap().put(albumDefinition.getKey(), albumDefinition);
-
- final AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey(KEY_INFO_MAP_KEY, VERSION));
- final AxContextModel contextModel =
- new AxContextModel(new AxArtifactKey("PolicyContextModel", VERSION), schemas, albums, keyInformation);
- contextModel.setKeyInformation(keyInformation);
- keyInformation.generateKeyInfo(contextModel);
-
- return contextModel;
- }
-
- /**
- * Creates the global context model.
- *
- * @return the ax context model
- */
- public static AxContextModel createGlobalContextModel() {
- final AxContextSchema globalSchema = new AxContextSchema(new AxArtifactKey("GlobalSchema", VERSION),
- JAVA_FLAVOUR, TestGlobalContextItem.class.getCanonicalName());
- final AxContextAlbum albumDefinition = new AxContextAlbum(new AxArtifactKey(GLOBAL_CONTEXT_ALBUM, VERSION),
- "GLOBAL", true, globalSchema.getKey());
-
- final AxContextSchemas schemas = new AxContextSchemas(new AxArtifactKey(SCHEMAS2, VERSION));
- schemas.getSchemasMap().put(globalSchema.getKey(), globalSchema);
- final AxContextAlbums albums = new AxContextAlbums(new AxArtifactKey(CONTEXT, VERSION));
- albums.getAlbumsMap().put(albumDefinition.getKey(), albumDefinition);
-
- final AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey(KEY_INFO_MAP_KEY, VERSION));
- final AxContextModel contextModel =
- new AxContextModel(new AxArtifactKey("GlobalContextModel", VERSION), schemas, albums, keyInformation);
- contextModel.setKeyInformation(keyInformation);
- keyInformation.generateKeyInfo(contextModel);
-
- return contextModel;
- }
-
- /**
- * Creates the external context model.
- *
- * @return the ax context model
- */
- public static AxContextModel createExternalContextModel() {
- final AxContextSchema externalSchema = new AxContextSchema(new AxArtifactKey("ExternalSchema", VERSION),
- JAVA_FLAVOUR, TestExternalContextItem.class.getCanonicalName());
- final AxContextAlbum albumDefinition = new AxContextAlbum(new AxArtifactKey(EXTERNAL_CONTEXT_ALBUM, VERSION),
- "EXTERNAL", true, externalSchema.getKey());
-
- final AxContextSchemas schemas = new AxContextSchemas(new AxArtifactKey(SCHEMAS2, VERSION));
- schemas.getSchemasMap().put(externalSchema.getKey(), externalSchema);
- final AxContextAlbums albums = new AxContextAlbums(new AxArtifactKey(CONTEXT, VERSION));
- albums.getAlbumsMap().put(albumDefinition.getKey(), albumDefinition);
-
- final AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey(KEY_INFO_MAP_KEY, VERSION));
- final AxContextModel contextModel =
- new AxContextModel(new AxArtifactKey("ExternalContextModel", VERSION), schemas, albums, keyInformation);
- contextModel.setKeyInformation(keyInformation);
- keyInformation.generateKeyInfo(contextModel);
-
- return contextModel;
- }
-
- /**
- * Creates the long context model.
- *
- * @return the ax context model
- */
- public static AxContextModel createLongContextModel() {
- final AxArtifactKey longSchemaKey = new AxArtifactKey("LongSchema", VERSION);
- final AxContextSchema longSchema = new AxContextSchema(longSchemaKey, JAVA_FLAVOUR, JAVA_LONG);
-
- final AxArtifactKey longContextAlbumKey = new AxArtifactKey("LongContextAlbum1", VERSION);
- final AxContextAlbum albumDefinition1 =
- new AxContextAlbum(longContextAlbumKey, APPLICATION, true, longSchema.getKey());
-
- final AxArtifactKey longContextAlbumKey2 = new AxArtifactKey("LongContextAlbum2", VERSION);
- final AxContextAlbum albumDefinition2 =
- new AxContextAlbum(longContextAlbumKey2, APPLICATION, true, longSchema.getKey());
-
- final AxContextSchemas schemas = new AxContextSchemas(new AxArtifactKey(SCHEMAS2, VERSION));
- schemas.getSchemasMap().put(longSchema.getKey(), longSchema);
- final AxContextAlbums albums = new AxContextAlbums(new AxArtifactKey(CONTEXT, VERSION));
- albums.getAlbumsMap().put(albumDefinition1.getKey(), albumDefinition1);
- albums.getAlbumsMap().put(albumDefinition2.getKey(), albumDefinition2);
-
- final AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey(KEY_INFO_MAP_KEY, VERSION));
- final AxContextModel contextModel =
- new AxContextModel(new AxArtifactKey("LongContextModel", VERSION), schemas, albums, keyInformation);
- contextModel.setKeyInformation(keyInformation);
- keyInformation.generateKeyInfo(contextModel);
-
- return contextModel;
- }
-
- /**
- * Creates the multi albums context model.
- *
- * @return the ax context model
- */
- public static AxContextModel createMultiAlbumsContextModel() {
- final AxContextSchema longSchema =
- new AxContextSchema(new AxArtifactKey("LongSchema", VERSION), JAVA_FLAVOUR, JAVA_LONG);
- final AxContextSchema lTypeSchema = new AxContextSchema(new AxArtifactKey("LTypeSchema", VERSION), JAVA_FLAVOUR,
- TestContextLongItem.class.getCanonicalName());
- final AxContextSchema dateSchema = new AxContextSchema(new AxArtifactKey("DateSchema", VERSION), JAVA_FLAVOUR,
- TestContextDateLocaleItem.class.getCanonicalName());
- final AxContextSchema mapSchema = new AxContextSchema(new AxArtifactKey("MapSchema", VERSION), JAVA_FLAVOUR,
- TestContextTreeMapItem.class.getCanonicalName());
-
- final AxContextSchemas schemas = new AxContextSchemas(new AxArtifactKey(SCHEMAS2, VERSION));
- schemas.getSchemasMap().put(longSchema.getKey(), longSchema);
- schemas.getSchemasMap().put(lTypeSchema.getKey(), lTypeSchema);
- schemas.getSchemasMap().put(dateSchema.getKey(), dateSchema);
- schemas.getSchemasMap().put(mapSchema.getKey(), mapSchema);
-
- final AxContextAlbum longAlbumDefinition = new AxContextAlbum(new AxArtifactKey(LONG_CONTEXT_ALBUM, VERSION),
- APPLICATION, true, longSchema.getKey());
- final AxContextAlbum lTypeAlbumDefinition = new AxContextAlbum(new AxArtifactKey("LTypeContextAlbum", VERSION),
- APPLICATION, true, lTypeSchema.getKey());
- final AxContextAlbum dateAlbumDefinition = new AxContextAlbum(new AxArtifactKey(DATE_CONTEXT_ALBUM, VERSION),
- APPLICATION, true, dateSchema.getKey());
- final AxContextAlbum mapAlbumDefinition = new AxContextAlbum(new AxArtifactKey(MAP_CONTEXT_ALBUM, VERSION),
- APPLICATION, true, mapSchema.getKey());
-
- final AxContextAlbums albums = new AxContextAlbums(new AxArtifactKey(CONTEXT, VERSION));
- albums.getAlbumsMap().put(longAlbumDefinition.getKey(), longAlbumDefinition);
- albums.getAlbumsMap().put(lTypeAlbumDefinition.getKey(), lTypeAlbumDefinition);
- albums.getAlbumsMap().put(dateAlbumDefinition.getKey(), dateAlbumDefinition);
- albums.getAlbumsMap().put(mapAlbumDefinition.getKey(), mapAlbumDefinition);
-
- final AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey(KEY_INFO_MAP_KEY, VERSION));
- final AxContextModel contextModel = new AxContextModel(new AxArtifactKey("MultiAlbumsContextModel", VERSION),
- schemas, albums, keyInformation);
- contextModel.setKeyInformation(keyInformation);
- keyInformation.generateKeyInfo(contextModel);
-
- return contextModel;
- }
-
-}
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/factory/package-info.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/factory/package-info.java
deleted file mode 100644
index ea70ce2a8..000000000
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/factory/package-info.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-/**
- * Contains factories for creating test context albums.
- *
- * @author Liam Fallon (liam.fallon@ericsson.com)
- */
-
-package org.onap.policy.apex.context.test.factory;
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/lock/modifier/AlbumModifier.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/lock/modifier/AlbumModifier.java
deleted file mode 100644
index d1127ffa3..000000000
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/lock/modifier/AlbumModifier.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.apex.context.test.lock.modifier;
-
-import org.onap.policy.apex.context.ContextAlbum;
-import org.onap.policy.apex.context.ContextException;
-
-/**
- * The Interface AlbumModifier defines the interface to allow context albums be modified during context tests.
- */
-@FunctionalInterface
-public interface AlbumModifier {
-
- /**
- * Modify album.
- *
- * @param contextAlbum the context album
- * @param loopSize the loop size
- * @param arraySize the array size
- * @throws ContextException the context exception
- */
- void modifyAlbum(final ContextAlbum contextAlbum, final int loopSize, final int arraySize) throws ContextException;
-
-}
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/lock/modifier/LockType.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/lock/modifier/LockType.java
deleted file mode 100644
index c4e6ac43a..000000000
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/lock/modifier/LockType.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.apex.context.test.lock.modifier;
-
-import org.onap.policy.apex.context.ContextRuntimeException;
-
-/**
- * The Enum LockType defines the type of lock on a test context album.
- */
-public enum LockType {
-
- NO_LOCK(0) {
- @Override
- public AlbumModifier getAlbumModifier() {
- return NO_LOCK_MODIFER;
- }
- },
- READ_LOCK(1) {
- @Override
- public AlbumModifier getAlbumModifier() {
- return READ_LOCK_MODIFER;
- }
- },
- WRITE_LOCK(2) {
- @Override
- public AlbumModifier getAlbumModifier() {
- return WRITE_LOCK_MODIFER;
- }
- },
- WRITE_LOCK_SINGLE_VALUE_UPDATE(3) {
- @Override
- public AlbumModifier getAlbumModifier() {
- return WRITE_LOCK_SINGLE_VALUE_MODIFER;
- }
- };
-
- private static final AlbumModifier NO_LOCK_MODIFER = new NoLockAlbumModifier();
- private static final AlbumModifier READ_LOCK_MODIFER = new ReadLockAlbumModifier();
- private static final AlbumModifier WRITE_LOCK_MODIFER = new WriteLockAlbumModifier();
- private static final AlbumModifier WRITE_LOCK_SINGLE_VALUE_MODIFER = new SingleValueWriteLockAlbumModifier();
-
- private final int value;
-
- /**
- * Instantiates a new lock type.
- *
- * @param value the value
- */
- LockType(final int value) {
- this.value = value;
- }
-
- /**
- * Gets the value.
- *
- * @return the value
- */
- public int getValue() {
- return value;
- }
-
- /**
- * Get the lock type given an int value.
- * @param value the value of lock type
- * @return the lock type
- */
- public static LockType getLockType(final int value) {
- for (final LockType lockType : LockType.values()) {
- if (lockType.getValue() == value) {
- return lockType;
- }
- }
- throw new ContextRuntimeException("Invalid Lock type value: " + value);
- }
-
- /**
- * Gets the album modifier.
- *
- * @return the album modifier
- */
- public abstract AlbumModifier getAlbumModifier();
-
-}
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/lock/modifier/NoLockAlbumModifier.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/lock/modifier/NoLockAlbumModifier.java
deleted file mode 100644
index 4ce7890be..000000000
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/lock/modifier/NoLockAlbumModifier.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.apex.context.test.lock.modifier;
-
-import java.util.Random;
-
-import org.onap.policy.apex.context.ContextAlbum;
-import org.onap.policy.apex.context.test.concepts.TestContextLongItem;
-import org.slf4j.ext.XLogger;
-import org.slf4j.ext.XLoggerFactory;
-
-/**
- * The Class NoLockAlbumModifier implements a non lock context album.
- */
-public class NoLockAlbumModifier implements AlbumModifier {
- private static final XLogger LOGGER = XLoggerFactory.getXLogger(NoLockAlbumModifier.class);
-
- /*
- * (non-Javadoc)
- *
- * @see org.onap.policy.apex.context.test.lock.modifier.AlbumModifier#modifyAlbum(org.onap.policy.apex.context.
- * ContextAlbum, int, int)
- */
- @Override
- public void modifyAlbum(final ContextAlbum contextAlbum, final int loopSize, final int arraySize) {
- final Random rand = new Random();
- for (int i = 0; i < loopSize; i++) {
- final String nextLongKey = Integer.toString(rand.nextInt(arraySize));
- final TestContextLongItem item = (TestContextLongItem) contextAlbum.get(nextLongKey);
- final long value = item.getLongValue();
- if (LOGGER.isTraceEnabled()) {
- LOGGER.trace("lock type={}, value={}", LockType.NO_LOCK, value);
- }
- }
- }
-
-}
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/lock/modifier/ReadLockAlbumModifier.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/lock/modifier/ReadLockAlbumModifier.java
deleted file mode 100644
index fbafb1081..000000000
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/lock/modifier/ReadLockAlbumModifier.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.apex.context.test.lock.modifier;
-
-import java.util.Random;
-
-import org.onap.policy.apex.context.ContextAlbum;
-import org.onap.policy.apex.context.ContextException;
-import org.onap.policy.apex.context.test.concepts.TestContextLongItem;
-import org.slf4j.ext.XLogger;
-import org.slf4j.ext.XLoggerFactory;
-
-/**
- * The Class ReadLockAlbumModifier implements a read lock context album.
- */
-public class ReadLockAlbumModifier implements AlbumModifier {
- private static final XLogger LOGGER = XLoggerFactory.getXLogger(ReadLockAlbumModifier.class);
-
- /*
- * (non-Javadoc)
- *
- * @see org.onap.policy.apex.context.test.lock.modifier.AlbumModifier#modifyAlbum(org.onap.policy.apex.context.
- * ContextAlbum, int, int)
- */
- @Override
- public void modifyAlbum(final ContextAlbum contextAlbum, final int loopSize, final int arraySize) {
- final Random rand = new Random();
- for (int i = 0; i < loopSize; i++) {
- final String nextLongKey = Integer.toString(rand.nextInt(arraySize));
- try {
- contextAlbum.lockForReading(nextLongKey);
- } catch (final ContextException e) {
- LOGGER.error("could not acquire read lock on context album, key=" + nextLongKey, e);
- continue;
- }
-
- final TestContextLongItem item = (TestContextLongItem) contextAlbum.get(nextLongKey);
- final long value = item.getLongValue();
- if (LOGGER.isTraceEnabled()) {
- LOGGER.trace("lock type={}, value={}", LockType.READ_LOCK, value);
- }
-
- try {
- contextAlbum.unlockForReading(nextLongKey);
- } catch (final ContextException e) {
- LOGGER.error("could not release read lock on context album, key=" + nextLongKey, e);
- }
- }
-
- }
-
-}
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/lock/modifier/SingleValueWriteLockAlbumModifier.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/lock/modifier/SingleValueWriteLockAlbumModifier.java
deleted file mode 100644
index 674cf3af2..000000000
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/lock/modifier/SingleValueWriteLockAlbumModifier.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.apex.context.test.lock.modifier;
-
-import static org.onap.policy.apex.context.test.utils.Constants.TEST_VALUE;
-
-import org.onap.policy.apex.context.ContextAlbum;
-import org.onap.policy.apex.context.ContextException;
-import org.onap.policy.apex.context.test.concepts.TestContextLongItem;
-import org.slf4j.ext.XLogger;
-import org.slf4j.ext.XLoggerFactory;
-
-/**
- * The Class SingleValueWriteLockAlbumModifier implements a single value lock context album.
- */
-public class SingleValueWriteLockAlbumModifier implements AlbumModifier {
- private static final XLogger LOGGER = XLoggerFactory.getXLogger(SingleValueWriteLockAlbumModifier.class);
-
- /*
- * (non-Javadoc)
- *
- * @see org.onap.policy.apex.context.test.lock.modifier.AlbumModifier#modifyAlbum(org.onap.policy.apex.context.
- * ContextAlbum, int, int)
- */
- @Override
- public void modifyAlbum(final ContextAlbum contextAlbum, final int loopSize, final int arraySize)
- throws ContextException {
- for (int i = 0; i < loopSize; i++) {
- try {
- contextAlbum.lockForWriting(TEST_VALUE);
- TestContextLongItem item = (TestContextLongItem) contextAlbum.get(TEST_VALUE);
- if (item != null) {
- long value = item.getLongValue();
- item.setLongValue(++value);
- } else {
- item = new TestContextLongItem(0L);
- }
- contextAlbum.put(TEST_VALUE, item);
- } finally {
- contextAlbum.unlockForWriting(TEST_VALUE);
- }
- }
-
- try {
- contextAlbum.lockForWriting(TEST_VALUE);
- final TestContextLongItem item = (TestContextLongItem) contextAlbum.get(TEST_VALUE);
- final long value = item.getLongValue();
- LOGGER.info("Value after modification: ", value);
- } catch (final Exception e) {
- LOGGER.error("could not read the value in the test context album", e);
- } finally {
- contextAlbum.unlockForWriting(TEST_VALUE);
- }
- }
-
-}
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/lock/modifier/WriteLockAlbumModifier.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/lock/modifier/WriteLockAlbumModifier.java
deleted file mode 100644
index 7136121f7..000000000
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/lock/modifier/WriteLockAlbumModifier.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.apex.context.test.lock.modifier;
-
-import java.util.Random;
-
-import org.onap.policy.apex.context.ContextAlbum;
-import org.onap.policy.apex.context.ContextException;
-import org.onap.policy.apex.context.test.concepts.TestContextLongItem;
-import org.slf4j.ext.XLogger;
-import org.slf4j.ext.XLoggerFactory;
-
-/**
- * The Class WriteLockAlbumModifier implements a write lock context album.
- */
-public class WriteLockAlbumModifier implements AlbumModifier {
- private static final XLogger LOGGER = XLoggerFactory.getXLogger(WriteLockAlbumModifier.class);
-
- /*
- * (non-Javadoc)
- *
- * @see org.onap.policy.apex.context.test.lock.modifier.AlbumModifier#modifyAlbum(org.onap.policy.apex.context.
- * ContextAlbum, int, int)
- */
- @Override
- public void modifyAlbum(final ContextAlbum contextAlbum, final int loopSize, final int arraySize) {
- final Random rand = new Random();
- for (int i = 0; i < loopSize; i++) {
- final String nextLongKey = Integer.toString(rand.nextInt(arraySize));
- try {
- contextAlbum.lockForWriting(nextLongKey);
- } catch (final ContextException e) {
- LOGGER.error("could not acquire write lock on context album, key=" + nextLongKey, e);
- continue;
- }
-
- final TestContextLongItem item = (TestContextLongItem) contextAlbum.get(nextLongKey);
- long value = item.getLongValue();
- if (LOGGER.isTraceEnabled()) {
- LOGGER.trace("lock type={}, value={}", LockType.WRITE_LOCK, value);
- }
- item.setLongValue(++value);
- contextAlbum.put(nextLongKey, item);
-
- try {
- contextAlbum.unlockForWriting(nextLongKey);
- } catch (final ContextException e) {
- LOGGER.error("could not release write lock on context album, key=" + nextLongKey, e);
- }
- }
-
- }
-
-}
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/lock/modifier/package-info.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/lock/modifier/package-info.java
deleted file mode 100644
index bf5bcb31c..000000000
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/lock/modifier/package-info.java
+++ /dev/null
@@ -1,25 +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=========================================================
- */
-
-/**
- * Provides modifiers that allow the locking on a contest album to be modified in various ways.
- */
-
-package org.onap.policy.apex.context.test.lock.modifier;
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContext.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContext.java
deleted file mode 100644
index f0dac722e..000000000
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContext.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.apex.context.test.locking;
-
-import java.io.Closeable;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.TimeUnit;
-
-import org.onap.policy.apex.context.ContextAlbum;
-import org.onap.policy.apex.context.ContextException;
-import org.onap.policy.apex.context.Distributor;
-import org.onap.policy.apex.context.test.concepts.TestContextLongItem;
-import org.onap.policy.apex.context.test.utils.ConfigrationProvider;
-import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
-import org.slf4j.ext.XLogger;
-import org.slf4j.ext.XLoggerFactory;
-
-/**
- * The Class TestConcurrentContext tests concurrent use of context.
- *
- * @author Liam Fallon (liam.fallon@ericsson.com)
- */
-public class ConcurrentContext {
- // Logger for this class
- private static final XLogger LOGGER = XLoggerFactory.getXLogger(ConcurrentContext.class);
-
- // The context distributor and map used by each test
- private Distributor contextDistributor = null;
- private ContextAlbum ltypeAlbum = null;
-
- private final ConfigrationProvider configrationProvider;
-
- public ConcurrentContext(final ConfigrationProvider configrationProvider) {
- this.configrationProvider = configrationProvider;
- }
-
- /**
- * The method tests concurrent use of context.
- *
- * @return the verified context
- * @throws ApexException the Apex exception occurs in handling Apex
- */
- public Map<String, TestContextLongItem> testConcurrentContext() throws ApexException {
-
- try {
- setupAndVerifyContext();
- } catch (final Exception exception) {
- LOGGER.error("Error occured while setting up and verifying concurrent context", exception);
- throw exception;
- }
-
- LOGGER.debug("starting JVMs and threads . . .");
-
- final ExecutorService executorService = configrationProvider.getExecutorService();
-
- final List<Closeable> tasks = new ArrayList<>(configrationProvider.getThreadCount());
-
- addShutDownHook(tasks);
-
- // Check if we have a single JVM or multiple JVMs
- if (configrationProvider.getJvmCount() == 1) {
- // Run everything in this JVM
- for (int t = 0; t < configrationProvider.getThreadCount(); t++) {
- final ConcurrentContextThread task = new ConcurrentContextThread(0, t, configrationProvider);
- tasks.add(task);
- executorService.execute(task);
- }
-
- } else {
- // Spawn JVMs to run the tests
- for (int j = 0; j < configrationProvider.getJvmCount(); j++) {
- final ConcurrentContextJvmThread task = new ConcurrentContextJvmThread(j, configrationProvider);
- tasks.add(task);
- executorService.execute(task);
- }
- }
-
- try {
- executorService.shutdown();
- // wait for threads to finish, if not Timeout
- executorService.awaitTermination(10, TimeUnit.MINUTES);
- } catch (final InterruptedException interruptedException) {
- LOGGER.error("Exception while waiting for threads to finish", interruptedException);
- // restore the interrupt status
- Thread.currentThread().interrupt();
- }
-
- LOGGER.info("Shutting down now ...");
- executorService.shutdownNow();
-
- return verifyAndClearContext();
- }
-
-
- private void addShutDownHook(final List<Closeable> tasks) {
- Runtime.getRuntime().addShutdownHook(new Thread() {
- @Override
- public void run() {
- LOGGER.info("Shutting down ...");
- for (final Closeable task : tasks) {
- try {
- task.close();
- } catch (final IOException ioException) {
- LOGGER.error("Unable to close task ... ", ioException);
- }
- }
- }
- });
- }
-
- /**
- * Setup and verify context.
- *
- * @throws ContextException the context exception
- */
- private void setupAndVerifyContext() {
- contextDistributor = configrationProvider.getDistributor();
- ltypeAlbum = configrationProvider.getContextAlbum(contextDistributor);
- final Map<String, Object> initValues = configrationProvider.getContextAlbumInitValues();
-
- for (final Entry<String, Object> entry : initValues.entrySet()) {
- ltypeAlbum.put(entry.getKey(), entry.getValue());
- }
- }
-
- private Map<String, TestContextLongItem> verifyAndClearContext() throws ContextException {
- final Map<String, TestContextLongItem> values = new HashMap<>();
- try {
-
- for (final Entry<String, Object> entry : ltypeAlbum.entrySet()) {
- values.put(entry.getKey(), (TestContextLongItem) entry.getValue());
- }
- } catch (final Exception exception) {
- LOGGER.error("Error: ", exception);
- }
- contextDistributor.clear();
- contextDistributor = null;
-
- return values;
- }
-}
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextJvm.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextJvm.java
deleted file mode 100644
index c7043bc53..000000000
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextJvm.java
+++ /dev/null
@@ -1,230 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.apex.context.test.locking;
-
-import com.google.gson.Gson;
-
-import java.net.InetAddress;
-import java.net.NetworkInterface;
-import java.net.SocketException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.List;
-import java.util.Map.Entry;
-import java.util.TreeSet;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
-
-import org.onap.policy.apex.context.ContextAlbum;
-import org.onap.policy.apex.context.Distributor;
-import org.onap.policy.apex.context.test.utils.ConfigrationProvider;
-import org.onap.policy.apex.context.test.utils.ConfigrationProviderImpl;
-import org.onap.policy.apex.context.test.utils.Constants;
-import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
-import org.onap.policy.apex.model.basicmodel.concepts.ApexRuntimeException;
-import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
-import org.onap.policy.common.parameters.ParameterGroup;
-import org.onap.policy.common.parameters.ParameterService;
-import org.slf4j.ext.XLogger;
-import org.slf4j.ext.XLoggerFactory;
-
-
-/**
- * The Class ConcurrentContextJVM tests concurrent use of context in a single JVM.
- *
- * @author Liam Fallon (liam.fallon@ericsson.com)
- */
-public final class ConcurrentContextJvm {
- // Logger for this class
- private static final XLogger LOGGER = XLoggerFactory.getXLogger(ConcurrentContextJvm.class);
-
- private static final int IPV4_ADDRESS_LENGTH = 4;
-
- private final int jvmNo;
-
- private final ExecutorService executorService;
-
- private final ConfigrationProvider configrationProvider;
-
- private ConcurrentContextJvm(final int jvmNo, final ConfigrationProvider configrationProvider) {
- this.jvmNo = jvmNo;
- this.configrationProvider = configrationProvider;
- final String name = configrationProvider.getTestName() + ":ConcurrentContextThread_" + jvmNo;
- this.executorService = configrationProvider.getExecutorService(name, configrationProvider.getThreadCount());
- }
-
- /**
- * This method executes the test of concurrent use of context in a single JVM.
- *
- * @throws ApexException the Apex exception occurs while running the test
- */
- public void execute() throws ApexException {
- LOGGER.debug("starting JVMs and threads . . .");
-
- final AxArtifactKey distributorKey = new AxArtifactKey("ApexDistributor" + jvmNo, "0.0.1");
- final Distributor distributor = configrationProvider.getDistributor(distributorKey);
- final ContextAlbum contextAlbum = configrationProvider.getContextAlbum(distributor);
- assert (contextAlbum != null);
-
- final List<Future<?>> tasks = new ArrayList<>(configrationProvider.getThreadCount());
-
- for (int t = 0; t < configrationProvider.getThreadCount(); t++) {
- tasks.add(executorService.submit(new ConcurrentContextThread(jvmNo, t, configrationProvider)));
- }
-
- try {
- executorService.shutdown();
- // wait for threads to finish, if not Timeout
- executorService.awaitTermination(10, TimeUnit.MINUTES);
- } catch (final InterruptedException interruptedException) {
- LOGGER.error("Exception while waiting for threads to finish", interruptedException);
- // restore the interrupt status
- Thread.currentThread().interrupt();
- }
-
- LOGGER.debug("threads finished, end value is {}", contextAlbum.get(Constants.TEST_VALUE));
- distributor.clear();
- LOGGER.info("Shutting down now ... ");
- executorService.shutdownNow();
- }
-
-
-
- /**
- * The main method.
- *
- * @param args the args
- * @throws Exception Any exception thrown by the test code
- */
- @SuppressWarnings("unchecked")
- public static void main(final String[] args) throws Exception {
- configure();
-
- LOGGER.info("JVM Arguments: " + Arrays.toString(args));
- // CHECKSTYLE:OFF: checkstyle:magicNumber
-
- // An even number of arguments greater than 3
- if (args.length < 9) {
- LOGGER.error("invalid arguments: " + Arrays.toString(args));
- LOGGER.error("usage: TestConcurrentContextJVM testType jvmNo threadCount threadLoops albumSize "
- + "lockType [parameterKey parameterJson].... ");
- return;
- }
-
-
- final String testName = getStringValue("testType", args, 0);
- final int jvmNo = getIntValue("jvmNo", args, 1);
- final int threadCount = getIntValue("threadCount", args, 2);
- final int threadLoops = getIntValue("threadLoops", args, 3);
- final int albumSize = getIntValue("albumSize", args, 4);
- final int lockType = getIntValue("lockType", args, 5);
- final String hazelCastfileLocation = getStringValue("hazelcast file location", args, 6);
-
- System.setProperty("hazelcast.config", hazelCastfileLocation);
-
- for (int p = 7; p < args.length - 1; p += 2) {
- @SuppressWarnings("rawtypes")
- final Class parametersClass = Class.forName(args[p]);
- final ParameterGroup parameters = (ParameterGroup) new Gson().fromJson(args[p + 1], parametersClass);
- ParameterService.register(parameters);
- }
-
- for (final Entry<String, ParameterGroup> parameterEntry : ParameterService.getAll()) {
- LOGGER.info("Parameter class " + parameterEntry.getKey() + "=" + parameterEntry.getValue().toString());
- }
-
- try {
- final ConfigrationProvider configrationProvider =
- new ConfigrationProviderImpl(testName, 1, threadCount, threadLoops, albumSize, lockType);
- final ConcurrentContextJvm concurrentContextJvm = new ConcurrentContextJvm(jvmNo, configrationProvider);
- concurrentContextJvm.execute();
-
- } catch (final Exception e) {
- LOGGER.error("error running test in JVM", e);
- }
- // CHECKSTYLE:ON: checkstyle:magicNumber
- }
-
- private static String getStringValue(final String key, final String[] args, final int position) {
- try {
- return args[position];
- } catch (final Exception e) {
- final String msg = "invalid argument " + key;
- LOGGER.error(msg, e);
- throw new ApexRuntimeException(msg, e);
- }
- }
-
- private static int getIntValue(final String key, final String[] args, final int position) {
- final String value = getStringValue(key, args, position);
- try {
- return Integer.parseInt(value);
- } catch (final Exception e) {
- final String msg = "Expects number found " + value;
- LOGGER.error(msg, e);
- throw new ApexRuntimeException(msg, e);
- }
- }
-
-
- /**
- * This method sets up any static configuration required by the JVM.
- *
- * @throws ApexException on configuration errors
- */
- public static void configure() throws ApexException {
- System.setProperty("java.net.preferIPv4Stack", "true");
- // The JGroups IP address must be set to a real (not loopback) IP address for Infinispan to
- // work. IN order to
- // ensure that all
- // the JVMs in a test pick up the same IP address, this function sets te address to be the
- // first non-loopback
- // IPv4 address
- // on a host
- final TreeSet<String> ipAddressSet = new TreeSet<>();
-
- Enumeration<NetworkInterface> nets;
- try {
- nets = NetworkInterface.getNetworkInterfaces();
- } catch (final SocketException e) {
- throw new ApexException("cound not get network interfaces for test", e);
- }
-
- for (final NetworkInterface netint : Collections.list(nets)) {
- final Enumeration<InetAddress> inetAddresses = netint.getInetAddresses();
- for (final InetAddress inetAddress : Collections.list(inetAddresses)) {
- // Look for real IPv4 Internet addresses
- if (!inetAddress.isLoopbackAddress() && inetAddress.getAddress().length == IPV4_ADDRESS_LENGTH) {
- ipAddressSet.add(inetAddress.getHostAddress());
- }
- }
- }
-
- if (ipAddressSet.isEmpty()) {
- throw new ApexException("cound not find real IP address for test");
- }
- LOGGER.info("Setting jgroups.tcp.address to: " + ipAddressSet.first());
- System.setProperty("jgroups.tcp.address", ipAddressSet.first());
- }
-}
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextJvmThread.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextJvmThread.java
deleted file mode 100644
index 9e23175fb..000000000
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextJvmThread.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.apex.context.test.locking;
-
-import com.google.gson.Gson;
-
-import java.io.BufferedReader;
-import java.io.Closeable;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map.Entry;
-
-import org.onap.policy.apex.context.test.utils.ConfigrationProvider;
-import org.onap.policy.common.parameters.ParameterGroup;
-import org.onap.policy.common.parameters.ParameterService;
-import org.slf4j.ext.XLogger;
-import org.slf4j.ext.XLoggerFactory;
-
-
-
-/**
- * The Class TestConcurrentContextThread tests concurrent use of context.
- *
- * @author Liam Fallon (liam.fallon@ericsson.com)
- */
-public class ConcurrentContextJvmThread implements Runnable, Closeable {
- // Logger for this class
- private static final XLogger LOGGER = XLoggerFactory.getXLogger(ConcurrentContextJvmThread.class);
-
- private final int jvm;
- private final ConfigrationProvider configrationProvider;
- private Process process = null;
-
- public ConcurrentContextJvmThread(final int jvm, final ConfigrationProvider configrationProvider) {
- this.jvm = jvm;
- this.configrationProvider = configrationProvider;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Runnable#run()
- */
- @Override
- public void run() {
- final List<String> commandList = new ArrayList<>();
- commandList.add(System.getProperty("java.home") + System.getProperty("file.separator") + "bin"
- + System.getProperty("file.separator") + "java");
- commandList.add("-Xms512m");
- commandList.add("-Xmx512m");
- commandList.add("-cp");
- commandList.add(System.getProperty("java.class.path"));
- commandList.add(ConcurrentContextJvm.class.getCanonicalName());
- commandList.add(configrationProvider.getTestName());
- commandList.add(Integer.toString(jvm));
- commandList.add(Integer.toString(configrationProvider.getThreadCount()));
- commandList.add(Integer.toString(configrationProvider.getLoopSize()));
- commandList.add(Integer.toString(configrationProvider.getAlbumSize()));
- commandList.add(Integer.toString(configrationProvider.getLockType().getValue()));
- commandList.add(System.getProperty("hazelcast.config", ""));
-
- for (final Entry<String, ParameterGroup> parameterServiceEntry : ParameterService.getAll()) {
- commandList.add(parameterServiceEntry.getValue().getClass().getCanonicalName());
- commandList.add(new Gson().toJson(parameterServiceEntry.getValue()));
- }
-
- LOGGER.info("starting JVM " + jvm);
-
- // Run the JVM
- final ProcessBuilder processBuilder = new ProcessBuilder(commandList);
- processBuilder.redirectErrorStream(true);
-
- try {
- process = processBuilder.start();
-
- final InputStream is = process.getInputStream();
- final InputStreamReader isr = new InputStreamReader(is);
- final BufferedReader br = new BufferedReader(isr);
- String line;
- LOGGER.info("JVM Output for command " + commandList + "\n");
- while ((line = br.readLine()) != null) {
- LOGGER.info(line);
- }
-
- waitForExitValue();
-
- } catch (final Exception ioException) {
- LOGGER.error("Error occured while writing JVM Output for command ", ioException);
- }
- }
-
- /**
- * Wait for an exit value from the the JVM.
- */
- private void waitForExitValue() {
- // Wait to get exit value
- try {
- final int exitValue = process.waitFor();
- LOGGER.info("\n\nJVM " + jvm + " finished, exit value is " + exitValue);
- } catch (final InterruptedException e) {
- LOGGER.warn("Thread was interrupted");
- Thread.currentThread().interrupt();
- }
- }
-
-
- @Override
- public void close() {
- LOGGER.info("Shutting down {} thread ...", Thread.currentThread().getName());
- if (process != null) {
- LOGGER.info("Destroying process ...");
- process.destroy();
- }
- }
-}
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextThread.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextThread.java
deleted file mode 100644
index 726880f3b..000000000
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextThread.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.apex.context.test.locking;
-
-import java.io.Closeable;
-
-import org.onap.policy.apex.context.ContextAlbum;
-import org.onap.policy.apex.context.ContextException;
-import org.onap.policy.apex.context.Distributor;
-import org.onap.policy.apex.context.parameters.ContextParameters;
-import org.onap.policy.apex.context.test.lock.modifier.AlbumModifier;
-import org.onap.policy.apex.context.test.utils.ConfigrationProvider;
-import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
-import org.slf4j.ext.XLogger;
-import org.slf4j.ext.XLoggerFactory;
-
-/**
- * The Class TestConcurrentContextThread tests concurrent use of context.
- *
- * @author Liam Fallon (liam.fallon@ericsson.com)
- */
-public class ConcurrentContextThread implements Runnable, Closeable {
- // Logger for this class
- private static final XLogger LOGGER = XLoggerFactory.getXLogger(ConcurrentContextThread.class);
- private final int jvm;
- private final int instance;
- private final ConfigrationProvider configrationProvider;
-
- /**
- * The Constructor.
- *
- * @param jvm the jvm
- * @param instance the instance
- * @param configrationProvider the configuration provider
- */
- public ConcurrentContextThread(final int jvm, final int instance, final ConfigrationProvider configrationProvider) {
- this.jvm = jvm;
- this.instance = instance;
- this.configrationProvider = configrationProvider;
-
- new ContextParameters();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Runnable#run()
- */
- @Override
- public void run() {
- LOGGER.info("running TestConcurrentContextThread_" + jvm + "_" + instance + " . . .");
-
-
- final AxArtifactKey distributorKey = new AxArtifactKey("ApexDistributor_" + jvm + "_" + instance, "0.0.1");
- final Distributor distributor = configrationProvider.getDistributor(distributorKey);
-
- try {
- final long startTime = System.currentTimeMillis();
- final ContextAlbum contextAlbum = configrationProvider.getContextAlbum(distributor);
-
- final AlbumModifier albumModifier = configrationProvider.getAlbumModifier();
- albumModifier.modifyAlbum(contextAlbum, configrationProvider.getLoopSize(),
- configrationProvider.getAlbumSize());
- LOGGER.info("Took {} ms to modify album", (System.currentTimeMillis() - startTime));
-
- } catch (final Exception e) {
- LOGGER.error("Unexpected error occured while processing", e);
- } finally {
- try {
- distributor.shutdown();
- } catch (final ContextException e) {
- LOGGER.error("Unable to shutdown distributor", e);
- }
- }
- LOGGER.info("finished TestConcurrentContextThread_" + jvm + "_" + instance + " . . .");
-
- }
-
- @Override
- public void close() {
- LOGGER.info("Shutting down {} thread ...", Thread.currentThread().getName());
- }
-}
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/package-info.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/package-info.java
deleted file mode 100644
index 0e80e611d..000000000
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/package-info.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-/**
- * Contains tests to check APEX context album distributed locking.
- *
- * @author Liam Fallon (liam.fallon@ericsson.com)
- */
-
-package org.onap.policy.apex.context.test.locking;
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/ConfigrationProvider.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/ConfigrationProvider.java
deleted file mode 100644
index f3a49dfbb..000000000
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/ConfigrationProvider.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.apex.context.test.utils;
-
-import java.util.Map;
-import java.util.concurrent.ExecutorService;
-
-import org.onap.policy.apex.context.ContextAlbum;
-import org.onap.policy.apex.context.ContextException;
-import org.onap.policy.apex.context.Distributor;
-import org.onap.policy.apex.context.test.lock.modifier.AlbumModifier;
-import org.onap.policy.apex.context.test.lock.modifier.LockType;
-import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
-
-/**
- * The Interface ConfigrationProvider provides the configuration for a context test to a context test executor.
- */
-public interface ConfigrationProvider {
-
- /**
- * Gets the test name.
- *
- * @return the test name
- */
- String getTestName();
-
- /**
- * Gets the loop size.
- *
- * @return the loop size
- */
- int getLoopSize();
-
- /**
- * Gets the thread count.
- *
- * @return the thread count
- */
- int getThreadCount();
-
- /**
- * Gets the jvm count.
- *
- * @return the jvm count
- */
- int getJvmCount();
-
- /**
- * Gets the album size.
- *
- * @return the album size
- */
- int getAlbumSize();
-
- /**
- * Gets the executor service.
- *
- * @return the executor service
- */
- ExecutorService getExecutorService();
-
- /**
- * Gets the executor service.
- *
- * @param threadFactoryName the thread factory name
- * @param threadPoolSize the thread pool size
- * @return the executor service
- */
- ExecutorService getExecutorService(final String threadFactoryName, final int threadPoolSize);
-
- /**
- * Gets the distributor.
- *
- * @param key the key
- * @return the distributor
- */
- Distributor getDistributor(final AxArtifactKey key);
-
- /**
- * Gets the distributor.
- *
- * @return the distributor
- */
- Distributor getDistributor();
-
- /**
- * Gets the context album.
- *
- * @param distributor the distributor
- * @return the context album
- */
- ContextAlbum getContextAlbum(final Distributor distributor);
-
- /**
- * Gets the context album.
- *
- * @param distributor the distributor
- * @param axContextAlbumKey the ax context album key
- * @param artifactKeys the artifact keys
- * @return the context album
- * @throws ContextException the context exception
- */
- ContextAlbum getContextAlbum(final Distributor distributor, AxArtifactKey axContextAlbumKey,
- AxArtifactKey[] artifactKeys) throws ContextException;
-
- /**
- * Gets the context album init values.
- *
- * @return the context album init values
- */
- Map<String, Object> getContextAlbumInitValues();
-
- /**
- * Gets the album modifier.
- *
- * @return the album modifier
- */
- AlbumModifier getAlbumModifier();
-
- /**
- * Gets the lock type.
- *
- * @return the lock type
- */
- LockType getLockType();
-
-}
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/ConfigrationProviderImpl.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/ConfigrationProviderImpl.java
deleted file mode 100644
index 70200943c..000000000
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/ConfigrationProviderImpl.java
+++ /dev/null
@@ -1,264 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.apex.context.test.utils;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-import org.onap.policy.apex.context.ContextAlbum;
-import org.onap.policy.apex.context.ContextException;
-import org.onap.policy.apex.context.ContextRuntimeException;
-import org.onap.policy.apex.context.Distributor;
-import org.onap.policy.apex.context.impl.distribution.DistributorFactory;
-import org.onap.policy.apex.context.test.concepts.TestContextLongItem;
-import org.onap.policy.apex.context.test.factory.TestContextAlbumFactory;
-import org.onap.policy.apex.context.test.lock.modifier.AlbumModifier;
-import org.onap.policy.apex.context.test.lock.modifier.LockType;
-import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
-import org.onap.policy.apex.model.contextmodel.concepts.AxContextModel;
-import org.onap.policy.apex.model.utilities.Assertions;
-
-/**
- * The Class ConfigrationProviderImpl provides configuration information for a context test back to the caller.
- */
-public class ConfigrationProviderImpl implements ConfigrationProvider {
-
- private final String testType;
- private final int jvmCount;
- private final int threadCount;
- private final int loopSize;
- private final int albumSize;
- private final LockType lockType;
-
- /**
- * The parameterized ConfigrationProviderImpl constructor.
- *
- * @param testType the test type
- * @param jvmCount the JVM count
- * @param threadCount the thread count
- * @param loopSize the size of loop
- * @param albumSize the size of album
- * @param lockType the lock type
- */
- public ConfigrationProviderImpl(final String testType, final int jvmCount, final int threadCount,
- final int loopSize, final int albumSize, final int lockType) {
- this.testType = testType;
- this.jvmCount = jvmCount;
- this.threadCount = threadCount;
- this.loopSize = loopSize;
- this.albumSize = albumSize;
- this.lockType = LockType.getLockType(lockType);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.onap.policy.apex.context.test.utils.ConfigrationProvider#getTestName()
- */
- @Override
- public String getTestName() {
- return testType;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.onap.policy.apex.context.test.utils.ConfigrationProvider#getLoopSize()
- */
- @Override
- public int getLoopSize() {
- return loopSize;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.onap.policy.apex.context.test.utils.ConfigrationProvider#getThreadCount()
- */
- @Override
- public int getThreadCount() {
- return threadCount;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.onap.policy.apex.context.test.utils.ConfigrationProvider#getJvmCount()
- */
- @Override
- public int getJvmCount() {
- return jvmCount;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.onap.policy.apex.context.test.utils.ConfigrationProvider#getAlbumSize()
- */
- @Override
- public int getAlbumSize() {
- return albumSize;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.onap.policy.apex.context.test.utils.ConfigrationProvider#getExecutorService()
- */
- @Override
- public ExecutorService getExecutorService() {
- final String name = getThreadFactoryName(jvmCount, testType);
- final IntegrationThreadFactory threadFactory = new IntegrationThreadFactory(name);
- return Executors.newFixedThreadPool(threadCount, threadFactory);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.onap.policy.apex.context.test.utils.ConfigrationProvider#getExecutorService(java.lang.String, int)
- */
- @Override
- public ExecutorService getExecutorService(final String threadFactoryName, final int threadPoolSize) {
- final IntegrationThreadFactory threadFactory = new IntegrationThreadFactory(threadFactoryName);
- return Executors.newFixedThreadPool(threadPoolSize, threadFactory);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.onap.policy.apex.context.test.utils.ConfigrationProvider#getDistributor(org.onap.policy.apex.model.basicmodel
- * .concepts.AxArtifactKey)
- */
- @Override
- public Distributor getDistributor(final AxArtifactKey key) {
- try {
- return new DistributorFactory().getDistributor(key);
- } catch (ContextException e) {
- throw new ContextRuntimeException("Unable to create Distributor", e);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.onap.policy.apex.context.test.utils.ConfigrationProvider#getDistributor()
- */
- @Override
- public Distributor getDistributor() {
- final AxArtifactKey distributorKey = new AxArtifactKey("ApexDistributor", "0.0.1");
- return getDistributor(distributorKey);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.onap.policy.apex.context.test.utils.ConfigrationProvider#getContextAlbum(org.onap.policy.apex.context.
- * Distributor)
- */
- @Override
- public ContextAlbum getContextAlbum(final Distributor distributor) {
- return getContextAlbum(distributor, Constants.L_TYPE_CONTEXT_ALBUM, Constants.getAxArtifactKeyArray());
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.onap.policy.apex.context.test.utils.ConfigrationProvider#getContextAlbum(org.onap.policy.apex.context.
- * Distributor, org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey,
- * org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey[])
- */
- @Override
- public ContextAlbum getContextAlbum(final Distributor distributor, final AxArtifactKey axContextAlbumKey,
- final AxArtifactKey[] artifactKeys) {
- final AxContextModel axContextModel = TestContextAlbumFactory.createMultiAlbumsContextModel();
- try {
- distributor.registerModel(axContextModel);
- final ContextAlbum contextAlbum = distributor.createContextAlbum(axContextAlbumKey);
- Assertions.argumentNotNull(contextAlbum, "ContextAlbum should not be null");
- contextAlbum.setUserArtifactStack(artifactKeys);
- return contextAlbum;
- } catch (ContextException e) {
- throw new ContextRuntimeException("Unable to create ContextAlbum", e);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.onap.policy.apex.context.test.utils.ConfigrationProvider#getContextAlbumInitValues()
- */
- @Override
- public Map<String, Object> getContextAlbumInitValues() {
- final Map<String, Object> values = new HashMap<>();
- for (int i = 0; i < albumSize; i++) {
- values.put(Integer.toString(i), new TestContextLongItem(0L));
- }
- return values;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.onap.policy.apex.context.test.utils.ConfigrationProvider#getAlbumModifier()
- */
- @Override
- public AlbumModifier getAlbumModifier() {
- return lockType.getAlbumModifier();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.onap.policy.apex.context.test.utils.ConfigrationProvider#getLockType()
- */
- @Override
- public LockType getLockType() {
- return lockType;
- }
-
- /**
- * Gets the thread factory name.
- *
- * @param jvmCount the jvm count
- * @param testType the test type
- * @return the thread factory name
- */
- private String getThreadFactoryName(final int jvmCount, final String testType) {
- return jvmCount == 1 ? testType + ":TestConcurrentContextThread_0_"
- : testType + ":TestConcurrentContextJVMThread_";
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return "ConfigrationProviderImpl [testType=" + testType + ", jvmCount=" + jvmCount + ", threadCount="
- + threadCount + ", loopSize=" + loopSize + ", albumSize=" + albumSize + ", lockType=" + lockType
- + "]";
- }
-
-}
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/Constants.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/Constants.java
deleted file mode 100644
index ba620d1f4..000000000
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/Constants.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.apex.context.test.utils;
-
-import java.util.TimeZone;
-
-import org.onap.policy.apex.context.test.concepts.TestPolicyContextItem;
-import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
-
-/**
- * The Class Constants provides constants for context tests.
- */
-public class Constants {
- public static final String MAP_CONTEXT_ALBUM = "MapContextAlbum";
- public static final String LONG_CONTEXT_ALBUM = "LongContextAlbum";
- public static final String DATE_CONTEXT_ALBUM = "DateContextAlbum";
-
- public static final String EXTERNAL_CONTEXT_ALBUM = "ExternalContextAlbum";
- public static final String GLOBAL_CONTEXT_ALBUM = "GlobalContextAlbum";
- public static final String POLICY_CONTEXT_ALBUM = "PolicyContextAlbum";
-
- public static final String APEX_DISTRIBUTOR = "ApexDistributor";
- public static final String VERSION = "0.0.1";
- public static final int INT_VAL = 0xFFFFFFFF;
- public static final int INT_VAL_2 = 2000;
- public static final int INT_VAL_3 = -1;
- public static final String EXCEPTION_MESSAGE = "Test should throw an exception";
- public static final byte BYTE_VAL = (byte) 0xFF;
- public static final double PI_VAL = Math.PI;
- public static final float FLOAT_VAL = 3.14159265359F;
- public static final String EXTERNAL_CONTEXT = "externalContext";
- public static final String GLOBAL_CONTEXT_KEY = "globalContext";
- public static final String STRING_GLOBAL_VAL = "This is a global context string";
- public static final String STRING_VAL = "This is a policy context string";
- public static final String STRING_EXT_VAL = "This is an external context string";
- public static final long LONG_VAL = 0xFFFFFFFFFFFFFFFFL;
- public static final String TEST_POLICY_CONTEXT_ITEM = TestPolicyContextItem.class.getName();
- public static final TimeZone TIME_ZONE = TimeZone.getTimeZone("Europe/Dublin");
-
- public static final AxArtifactKey L_TYPE_CONTEXT_ALBUM = new AxArtifactKey("LTypeContextAlbum", VERSION);
- public static final String TEST_VALUE = "testValue";
-
- private static final AxArtifactKey KEY = new AxArtifactKey("testC-top", VERSION);
- private static final AxArtifactKey KEY3 = new AxArtifactKey("testC-bot", VERSION);
- private static final AxArtifactKey KEY2 = new AxArtifactKey("testC-next", VERSION);
-
- private static final AxArtifactKey[] USED_ARTIFACT_STACK_ARRAY = new AxArtifactKey[] {KEY, KEY2, KEY3};
-
- /**
- * Instantiates a new constants.
- */
- private Constants() {}
-
- /**
- * Gets the ax artifact key array.
- *
- * @return the ax artifact key array
- */
- public static final AxArtifactKey[] getAxArtifactKeyArray() {
- return USED_ARTIFACT_STACK_ARRAY;
- }
-}
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/IntegrationThreadFactory.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/IntegrationThreadFactory.java
deleted file mode 100644
index 486a93cb4..000000000
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/IntegrationThreadFactory.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.apex.context.test.utils;
-
-import java.util.concurrent.ThreadFactory;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import org.slf4j.ext.XLogger;
-import org.slf4j.ext.XLoggerFactory;
-
-/**
- * A factory for creating IntegrationThread objects.
- */
-public class IntegrationThreadFactory implements ThreadFactory {
- private static final XLogger LOGGER = XLoggerFactory.getXLogger(IntegrationThreadFactory.class);
-
-
- private final String threadFactoryName;
-
- private final AtomicInteger counter = new AtomicInteger();
-
- /**
- * Instantiates a new integration thread factory.
- *
- * @param threadFactoryName the thread factory name
- */
- public IntegrationThreadFactory(final String threadFactoryName) {
- this.threadFactoryName = threadFactoryName;
- }
-
- /* (non-Javadoc)
- * @see java.util.concurrent.ThreadFactory#newThread(java.lang.Runnable)
- */
- @Override
- public Thread newThread(final Runnable runnable) {
- final Thread thread = new Thread(runnable);
- thread.setName(threadFactoryName + "_" + counter.getAndIncrement());
- LOGGER.debug("started thread " + thread.getName());
- return thread;
- }
-}
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/NetworkUtils.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/NetworkUtils.java
deleted file mode 100644
index d26ce955d..000000000
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/NetworkUtils.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.apex.context.test.utils;
-
-import java.net.InetAddress;
-import java.net.NetworkInterface;
-import java.net.SocketException;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.SortedSet;
-import java.util.TreeSet;
-
-/**
- * The Class NetworkUtils contains some utility functions for getting network information for context tests.
- */
-public class NetworkUtils {
-
- /**
- * Instantiates a new network utils.
- */
- private NetworkUtils() {}
-
- /**
- * The JGroups IP address must be set to a real (not loopback) IP address for Infinispan to
- * work. In order to ensure that all the JVMs in a test pick up the same IP address, this
- * function sets the address to be the first non-loopback IPv4 address on a host
- *
- * @return Set of IPv4 addresses
- * @throws SocketException throw socket exception if error occurs
- */
- public static SortedSet<String> getIPv4NonLoopAddresses() throws SocketException {
- final TreeSet<String> ipAddressSet = new TreeSet<>();
-
- final Enumeration<NetworkInterface> nets = NetworkInterface.getNetworkInterfaces();
- for (final NetworkInterface netint : Collections.list(nets)) {
- final Enumeration<InetAddress> inetAddresses = netint.getInetAddresses();
- for (final InetAddress inetAddress : Collections.list(inetAddresses)) {
- // Look for real IPv4 internet addresses
- if (!inetAddress.isLoopbackAddress() && inetAddress.getAddress().length == 4) {
- ipAddressSet.add(inetAddress.getHostAddress());
- }
- }
- }
- return ipAddressSet;
- }
-
-
-}
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/ZooKeeperServerServiceProvider.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/ZooKeeperServerServiceProvider.java
deleted file mode 100644
index ac9ae68b7..000000000
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/ZooKeeperServerServiceProvider.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.apex.context.test.utils;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.InetSocketAddress;
-
-import org.apache.zookeeper.server.NIOServerCnxnFactory;
-import org.apache.zookeeper.server.ZooKeeperServer;
-import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
-import org.slf4j.ext.XLogger;
-import org.slf4j.ext.XLoggerFactory;
-
-/**
- * The Class ZooKeeperServerServiceProvider provides a zookeeper service to a caller.
- */
-public class ZooKeeperServerServiceProvider {
- private static final XLogger LOGGER = XLoggerFactory.getXLogger(ZooKeeperServerServiceProvider.class);
-
- private NIOServerCnxnFactory zookeeperFactory;
- private File zookeeperDirectory;
- private InetSocketAddress addr;
-
- /**
- * Instantiates a new zoo keeper server service provider.
- *
- * @param zookeeperDirectory the zookeeper directory
- * @param addr the addr
- */
- public ZooKeeperServerServiceProvider(final File zookeeperDirectory, final InetSocketAddress addr) {
- this.zookeeperDirectory = zookeeperDirectory;
- this.addr = addr;
- }
-
- /**
- * Instantiates a new zoo keeper server service provider.
- *
- * @param zookeeperDirectory the zookeeper directory
- * @param addr the addr
- * @param port the port
- */
- public ZooKeeperServerServiceProvider(final File zookeeperDirectory, final String addr, final int port) {
- this.zookeeperDirectory = zookeeperDirectory;
- this.addr = new InetSocketAddress(addr, port);
- }
-
- /**
- * Start the Zookeeper server.
- *
- * @throws ApexException on configuration errors
- */
- public void startZookeeperServer() throws ApexException {
- LOGGER.info("Starting up ZooKeeperServer using address: {} and port: {}", addr.getAddress(), addr.getPort());
-
- ZooKeeperServer server;
- try {
- server = new ZooKeeperServer(zookeeperDirectory, zookeeperDirectory, 5000);
- zookeeperFactory = new NIOServerCnxnFactory();
- zookeeperFactory.configure(addr, 100);
- } catch (final IOException ioe) {
- final String message = "exception on starting Zookeeper server";
- LOGGER.warn(message, ioe);
- throw new ApexException(message, ioe);
- }
-
- try {
- zookeeperFactory.startup(server);
- } catch (InterruptedException | IOException ie) {
- final String message = "Zookeeper server start failed";
- LOGGER.warn(message, ie);
- Thread.currentThread().interrupt();
- throw new ApexException(message, ie);
- }
-
- }
-
- /**
- * Stop the Zookeeper server.
- */
- public void stopZookeeperServer() {
- LOGGER.info("Stopping ZooKeeperServer for address: {} and port: {}", addr.getAddress(), addr.getPort());
- if (zookeeperFactory != null) {
- zookeeperFactory.shutdown();
- }
- }
-}
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/package-info.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/package-info.java
deleted file mode 100755
index 2872d20df..000000000
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/package-info.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-/**
- * Contains utilities for context tests.
- *
- * @author Liam Fallon (liam.fallon@ericsson.com)
- */
-
-package org.onap.policy.apex.context.test.utils;
diff --git a/context/context-test-utils/src/site/css/site.css b/context/context-test-utils/src/site/css/site.css
deleted file mode 100644
index ef8bd4d15..000000000
--- a/context/context-test-utils/src/site/css/site.css
+++ /dev/null
@@ -1,100 +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=========================================================
- */
-
-@import url(http://cdnjs.cloudflare.com/ajax/libs/font-awesome/3.2.0/css/font-awesome.css);
-
-
-/*************** Table definitions *******************/
-
-tableblock > .title, .tableblock > caption { line-height: 1.4; color: #7a2518; font-weight: 300; margin-top: 0.2em; margin-bottom: 0.5em; }
-
-.tableblock > caption { text-align: left; font-weight: bold; white-space: nowrap; overflow: visible; max-width: 0; }
-
-table.tableblock { background: white; margin-bottom: 1.25em; border: solid 1px #dddddd; }
-table.tableblock thead, table.tableblock tfoot { background: whitesmoke; font-weight: bold; }
-table.tableblock thead tr th, table.tableblock thead tr td, table tfoot tr th, table tfoot tr td { padding: 0.5em 0.625em 0.625em; font-size: inherit; color: #222222; text-align: left; }
-table.tableblock tr th, table.tableblock tr td { padding: 0.5625em 0.625em; font-size: inherit; color: #222222; }
-table.tableblock tr.even, table.tableblock tr.alt, table.tableblock tr:nth-of-type(even) { background: #f9f9f9; }
-table.tableblock thead tr th, table.tableblock tfoot tr th, table.tableblock tbody tr td, table.tableblock tr td, table.tableblock tfoot tr td { display: table-cell; line-height: 1.6; }
-
-table.tableblock #preamble > .sectionbody > .paragraph:first-of-type p { font-size: inherit; }
-
-table.tableblock.grid-all { border-collapse: separate; border-spacing: 1px; -webkit-border-radius: 4px; border-radius: 4px; border-top: 1px solid #dddddd; border-bottom: 1px solid #dddddd; }
-
-table.tableblock.frame-topbot, table.tableblock.frame-none { border-left: 0; border-right: 0; }
-
-table.tableblock.frame-sides, table.tableblock.frame-none { border-top: 0; border-bottom: 0; }
-
-table.tableblock td .paragraph:last-child p, table.tableblock td > p:last-child { margin-bottom: 0; }
-
-th.tableblock.halign-left, td.tableblock.halign-left { text-align: left; }
-
-th.tableblock.halign-right, td.tableblock.halign-right { text-align: right; }
-
-th.tableblock.halign-center, td.tableblock.halign-center { text-align: center; }
-
-th.tableblock.valign-top, td.tableblock.valign-top { vertical-align: top; }
-
-th.tableblock.valign-bottom, td.tableblock.valign-bottom { vertical-align: bottom; }
-
-th.tableblock.valign-middle, td.tableblock.valign-middle { vertical-align: middle; }
-
-p.tableblock.header { color: #222222; font-weight: bold; }
-
-
-
-/*************** KBD Macro definitions *******************/
-
-kbd.keyseq { color: #555555; }
-
-kbd:not(.keyseq) { display: inline-block; color: #222222; font-size: 0.75em; line-height: 1.4; background-color: #F7F7F7; border: 1px solid #ccc; -webkit-border-radius: 3px; border-radius: 3px; -webkit-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2), 0 0 0 2px white inset; box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2), 0 0 0 2px white inset; margin: -0.15em 0.15em 0 0.15em; padding: 0.2em 0.6em 0.2em 0.5em; vertical-align: middle; white-space: nowrap; }
-
-kbd kbd:first-child { margin-left: 0; }
-
-kbd kbd:last-child { margin-right: 0; }
-
-
-/*************** Admontion Blocks definitions *******************/
-.admonitionblock td.content > .title, .exampleblock > .title, .imageblock > .title, .videoblock > .title, .listingblock > .title, .literalblock > .title, .openblock > .title, .paragraph > .title, .quoteblock > .title, .sidebarblock > .title, .tableblock > .title, .verseblock > .title, .dlist > .title, .olist > .title, .ulist > .title, .qlist > .title, .hdlist > .title { text-align: left; font-weight: bold; }
-
-.admonitionblock > table { border: 0; background: none; width: 100%; margin-top: 1em; margin-bottom: 1em;}
-.admonitionblock > table td.icon { text-align: center; width: 80px; }
-.admonitionblock > table td.icon img { max-width: none; }
-.admonitionblock > table td.icon .title { font-weight: bold; text-transform: uppercase; }
-.admonitionblock > table td.content { padding-left: 1.125em; padding-right: 1.25em; border-left: 1px solid #dddddd; color: #6f6f6f; }
-.admonitionblock > table td.content > :last-child > :last-child { margin-bottom: 0; }
-
-.admonitionblock td.icon [class^="fa icon-"]:before {font-size:2.5em;text-shadow:1px 1px 2px rgba(0,0,0,.5);cursor:default}
-.admonitionblock td.icon .icon-note:before { content: "\f05a"; color: #005498; color: #003f72; }
-.admonitionblock td.icon .icon-tip:before { content: "\f0eb"; text-shadow: 1px 1px 2px rgba(155, 155, 0, 0.8); color: #111; }
-.admonitionblock td.icon .icon-warning:before { content: "\f071"; color: #bf6900; }
-.admonitionblock td.icon .icon-caution:before { content: "\f06d"; color: #bf3400; }
-.admonitionblock td.icon .icon-important:before { content: "\f06a"; color: #bf0000; }
-
-
-
-/*************** Misc definitions *******************/
-
-*:not(pre) > code { font-size: 0.9375em; padding: 1px 3px 0; white-space: nowrap; background-color: #f2f2f2; border: 1px solid #cccccc; -webkit-border-radius: 4px; border-radius: 4px; text-shadow: none; }
-
-pre, pre > code { line-height: 1.4; color: inherit; font-family: Consolas, "Liberation Mono", Courier, monospace; font-weight: normal; }
-
-code { font-family: Consolas, "Liberation Mono", Courier, monospace; font-weight: normal; color: #6d180b; }
-
diff --git a/context/context-test-utils/src/site/images/logos.png b/context/context-test-utils/src/site/images/logos.png
deleted file mode 100644
index 915d6e59d..000000000
--- a/context/context-test-utils/src/site/images/logos.png
+++ /dev/null
Binary files differ
diff --git a/context/context-test-utils/src/site/site.xml b/context/context-test-utils/src/site/site.xml
deleted file mode 100644
index eff32000e..000000000
--- a/context/context-test-utils/src/site/site.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ============LICENSE_START=======================================================
- Copyright (C) 2016-2018 Ericsson. All rights reserved.
- ================================================================================
- This file is licensed under the CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE
- Full license text at https://creativecommons.org/licenses/by/4.0/legalcode
-
- SPDX-License-Identifier: CC-BY-4.0
- ============LICENSE_END=========================================================
-
- @author Sven van der Meer (sven.van.der.meer@ericsson.com)
-
--->
-
-<project name="APEX Context Test-Utils">
- <body>
- <menu name="APEX Context Test-Utils">
- <item href="javadocs/index.html" name="API Doc" />
- </menu>
- <menu ref="reports" inherit="top" />
- <menu ref="modules" />
-
- <breadcrumbs>
- <item name="Test-Utils" href="index.html" />
- </breadcrumbs>
- </body>
-</project> \ No newline at end of file
diff --git a/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/concepts/ConceptUncoveredTest.java b/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/concepts/ConceptUncoveredTest.java
deleted file mode 100644
index eca9cb72e..000000000
--- a/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/concepts/ConceptUncoveredTest.java
+++ /dev/null
@@ -1,715 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.apex.context.test.concepts;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.time.Instant;
-import java.util.Date;
-import java.util.Locale;
-import java.util.TreeMap;
-import java.util.TreeSet;
-
-import org.junit.Test;
-
-/**
- * Cover uncovered code in concepts.
- *
- */
-public class ConceptUncoveredTest {
-
- @SuppressWarnings("unlikely-arg-type")
- @Test
- public void testInt() {
- TestContextIntItem intItem = new TestContextIntItem(123);
- assertEquals(123, intItem.getIntValue());
-
- assertFalse(intItem.equals(null));
- assertTrue(intItem.equals(intItem));
-
- TestContextBooleanItem booleanItem = new TestContextBooleanItem();
- assertFalse(intItem.equals(booleanItem));
-
- TestContextIntItem otherIntItem = new TestContextIntItem(intItem);
- assertTrue(intItem.equals(otherIntItem));
- otherIntItem.setIntValue(321);
- assertFalse(intItem.equals(otherIntItem));
- }
-
- @SuppressWarnings("unlikely-arg-type")
- @Test
- public void testByte() {
- TestContextByteItem byteItem = new TestContextByteItem((byte) 123);
- assertEquals(123, byteItem.getByteValue());
-
- assertFalse(byteItem.equals(null));
- assertTrue(byteItem.equals(byteItem));
-
- TestContextBooleanItem booleanItem = new TestContextBooleanItem();
- assertFalse(byteItem.equals(booleanItem));
-
- TestContextByteItem otherByteItem = new TestContextByteItem((byte) 123);
- assertTrue(byteItem.equals(otherByteItem));
- otherByteItem.setByteValue((byte) 321);
- assertFalse(byteItem.equals(otherByteItem));
- }
-
- @SuppressWarnings("unlikely-arg-type")
- @Test
- public void testLong() {
- TestContextLongItem longItem = new TestContextLongItem((long) 123);
- assertEquals(123, longItem.getLongValue());
-
- assertFalse(longItem.equals(null));
- assertTrue(longItem.equals(longItem));
-
- TestContextBooleanItem booleanItem = new TestContextBooleanItem();
- assertFalse(longItem.equals(booleanItem));
-
- TestContextLongItem otherLongItem = new TestContextLongItem((long) 123);
- assertTrue(longItem.equals(otherLongItem));
- otherLongItem.setLongValue((long) 321);
- assertFalse(longItem.equals(otherLongItem));
- }
-
- @SuppressWarnings("unlikely-arg-type")
- @Test
- public void testFloat() {
- TestContextFloatItem floatItem = new TestContextFloatItem((float) 123);
- assertEquals(new Float("123"), (Float) floatItem.getFloatValue());
-
- assertFalse(floatItem.equals(null));
- assertTrue(floatItem.equals(floatItem));
-
- TestContextBooleanItem booleanItem = new TestContextBooleanItem();
- assertFalse(floatItem.equals(booleanItem));
-
- TestContextFloatItem otherFloatItem = new TestContextFloatItem((float) 123);
- assertTrue(floatItem.equals(otherFloatItem));
- otherFloatItem.setFloatValue((float) 321);
- assertFalse(floatItem.equals(otherFloatItem));
- }
-
- @SuppressWarnings("unlikely-arg-type")
- @Test
- public void testDouble() {
- TestContextDoubleItem doubleItem = new TestContextDoubleItem((double) 123);
- assertEquals(new Double("123"), (Double) doubleItem.getDoubleValue());
-
- assertFalse(doubleItem.equals(null));
- assertTrue(doubleItem.equals(doubleItem));
-
- TestContextBooleanItem booleanItem = new TestContextBooleanItem();
- assertFalse(doubleItem.equals(booleanItem));
-
- TestContextDoubleItem otherDoubleItem = new TestContextDoubleItem((double) 123);
- assertTrue(doubleItem.equals(otherDoubleItem));
- otherDoubleItem.setDoubleValue((double) 321);
- assertFalse(doubleItem.equals(otherDoubleItem));
- }
-
- @SuppressWarnings("unlikely-arg-type")
- @Test
- public void testBoolean() {
- TestContextBooleanItem booleanItem = new TestContextBooleanItem(true);
- assertEquals(true, booleanItem.getFlag());
-
- assertFalse(booleanItem.equals(null));
- assertTrue(booleanItem.equals(booleanItem));
-
- TestContextDoubleItem doubleItem = new TestContextDoubleItem();
- assertFalse(booleanItem.equals(doubleItem));
-
- TestContextBooleanItem otherBooleanItem = new TestContextBooleanItem(true);
- assertTrue(booleanItem.equals(otherBooleanItem));
- otherBooleanItem.setFlag(false);
- assertFalse(booleanItem.equals(otherBooleanItem));
-
- assertEquals(1262, booleanItem.hashCode());
- assertEquals(1268, otherBooleanItem.hashCode());
- }
-
- @SuppressWarnings("unlikely-arg-type")
- @Test
- public void testString() {
- TestContextStringItem stringItem = new TestContextStringItem("A String");
- assertEquals("A String", stringItem.getStringValue());
-
- assertFalse(stringItem.equals(null));
- assertTrue(stringItem.equals(stringItem));
-
- TestContextDoubleItem doubleItem = new TestContextDoubleItem();
- assertFalse(stringItem.equals(doubleItem));
-
- TestContextStringItem otherStringItem = new TestContextStringItem("A String");
- assertTrue(stringItem.equals(otherStringItem));
- otherStringItem.setStringValue("Some Other String Value");
- assertFalse(stringItem.equals(otherStringItem));
-
- otherStringItem.setStringValue(null);
- assertEquals(-1859249905, stringItem.hashCode());
- assertEquals(31, otherStringItem.hashCode());
-
- assertFalse(otherStringItem.equals(stringItem));
- }
-
- @SuppressWarnings("unlikely-arg-type")
- @Test
- public void testLongObject() {
- TestContextLongObjectItem longItem = new TestContextLongObjectItem((long) 123);
- assertEquals((Long) 123L, longItem.getLongValue());
-
- assertFalse(longItem.equals(null));
- assertTrue(longItem.equals(longItem));
-
- TestContextBooleanItem booleanItem = new TestContextBooleanItem();
- assertFalse(longItem.equals(booleanItem));
-
- TestContextLongObjectItem otherLongItem = new TestContextLongObjectItem((long) 123);
- assertTrue(longItem.equals(otherLongItem));
- otherLongItem.setLongValue((long) 321);
- assertFalse(longItem.equals(otherLongItem));
-
- otherLongItem.setLongValue(null);
- assertEquals(154, longItem.hashCode());
- assertEquals(31, otherLongItem.hashCode());
- assertFalse(otherLongItem.equals(longItem));
- }
-
- @SuppressWarnings(
- { "unlikely-arg-type", "rawtypes", "unchecked" })
- @Test
- public void testTreeMap() {
- TestContextTreeMapItem treeMapItem = new TestContextTreeMapItem();
- assertEquals(new TreeMap(), treeMapItem.getMapValue());
-
- assertFalse(treeMapItem.equals(null));
- assertTrue(treeMapItem.equals(treeMapItem));
-
- TestContextBooleanItem booleanItem = new TestContextBooleanItem();
- assertFalse(treeMapItem.equals(booleanItem));
-
- TestContextTreeMapItem otherTreeMapItem = new TestContextTreeMapItem();
- assertTrue(treeMapItem.equals(otherTreeMapItem));
- otherTreeMapItem.getMapValue().put("Key", "Value");
- assertFalse(treeMapItem.equals(otherTreeMapItem));
-
- treeMapItem.setMapValue(new TreeMap());
- otherTreeMapItem.setMapValue(null);
- assertNotNull(otherTreeMapItem.getMapValue());
- otherTreeMapItem.setMapValue(null);
- assertEquals(31, treeMapItem.hashCode());
- assertEquals(31, otherTreeMapItem.hashCode());
- assertFalse(otherTreeMapItem.equals(treeMapItem));
- treeMapItem.setMapValue(null);
- assertTrue(otherTreeMapItem.equals(treeMapItem));
- }
-
- @SuppressWarnings(
- { "unlikely-arg-type", "rawtypes", "unchecked" })
- @Test
- public void testTreeSet() {
- TestContextTreeSetItem treeSetItem = new TestContextTreeSetItem();
- assertEquals(new TreeSet(), treeSetItem.getSetValue());
-
- assertFalse(treeSetItem.equals(null));
- assertTrue(treeSetItem.equals(treeSetItem));
-
- TestContextBooleanItem booleanItem = new TestContextBooleanItem();
- assertFalse(treeSetItem.equals(booleanItem));
-
- TestContextTreeSetItem otherTreeSetItem = new TestContextTreeSetItem();
- assertTrue(treeSetItem.equals(otherTreeSetItem));
- otherTreeSetItem.getSetValue().add("Value");
- assertFalse(treeSetItem.equals(otherTreeSetItem));
-
- treeSetItem.setSetValue(new TreeSet());
- otherTreeSetItem.setSetValue(null);
- assertNotNull(otherTreeSetItem.getSetValue());
- otherTreeSetItem.setSetValue(null);
- assertEquals(31, treeSetItem.hashCode());
- assertEquals(31, otherTreeSetItem.hashCode());
- assertFalse(otherTreeSetItem.equals(treeSetItem));
- treeSetItem.setSetValue(null);
- assertTrue(otherTreeSetItem.equals(treeSetItem));
-
- String[] stringArray =
- { "hello", "goodbye" };
- TestContextTreeSetItem treeSetItemFromArray = new TestContextTreeSetItem(stringArray);
- assertTrue(treeSetItemFromArray.getSetValue().contains("hello"));
- assertTrue(treeSetItemFromArray.getSetValue().contains("goodbye"));
- }
-
- @SuppressWarnings(
- { "unlikely-arg-type" })
- @Test
- public void testDate() {
- TestContextDateItem dateItem = new TestContextDateItem();
- assertTrue(new Date().getTime() >= dateItem.getDateValue().getTime());
-
- assertFalse(dateItem.equals(null));
- assertTrue(dateItem.equals(dateItem));
-
- TestContextBooleanItem booleanItem = new TestContextBooleanItem();
- assertFalse(dateItem.equals(booleanItem));
-
- TestContextDateItem otherDateItem = new TestContextDateItem(dateItem.getDateValue());
- assertTrue(dateItem.equals(otherDateItem));
- otherDateItem.setDateValue(Date.from(Instant.now()));
- assertFalse(dateItem.equals(otherDateItem));
-
- dateItem.setDateValue(new Date());
- otherDateItem.setDateValue(null);
- assertNotNull(otherDateItem.getDateValue());
- otherDateItem.setDateValue(new Date(12345678));
- assertEquals(939444071, otherDateItem.hashCode());
- assertFalse(otherDateItem.equals(dateItem));
- dateItem = new TestContextDateItem(null);
- otherDateItem = new TestContextDateItem(null);
- assertTrue(otherDateItem.equals(dateItem));
-
- dateItem = new TestContextDateItem(new Date(1538394566123L));
- assertEquals(2018, dateItem.getYear());
- assertEquals(9, dateItem.getMonth());
- assertEquals(1, dateItem.getDay());
- assertEquals(11, dateItem.getHour());
- assertEquals(49, dateItem.getMinute());
- assertEquals(26, dateItem.getSecond());
- assertEquals(123, dateItem.getMilliSecond());
-
- dateItem = new TestContextDateItem(new Date(0L));
- otherDateItem = new TestContextDateItem(new Date(1L));
- assertFalse(dateItem.equals(otherDateItem));
-
- otherDateItem = new TestContextDateItem(new Date(1000L));
- assertFalse(dateItem.equals(otherDateItem));
-
- otherDateItem = new TestContextDateItem(new Date(60000L));
- assertFalse(dateItem.equals(otherDateItem));
-
- otherDateItem = new TestContextDateItem(new Date(3600000L));
- assertFalse(dateItem.equals(otherDateItem));
-
- otherDateItem = new TestContextDateItem(new Date(86400000L));
- assertFalse(dateItem.equals(otherDateItem));
-
- otherDateItem = new TestContextDateItem(new Date(2678400000L));
- assertFalse(dateItem.equals(otherDateItem));
-
- dateItem = new TestContextDateItem(123L);
- assertEquals(123, dateItem.getTime());
-
- assertEquals("TestContextItem008 [time=123, year=1970, month=0, day=1, "
- + "hour=0, minute=0, second=0, milliSecond=123]", dateItem.toString());
- }
-
- @SuppressWarnings("unlikely-arg-type")
- @Test
- public void testDateTz() {
- TestContextDateItem dateItem = new TestContextDateItem(new Date(0L));
-
- TestContextDateTzItem dateTzItem = new TestContextDateTzItem(dateItem, "UTC", true);
- assertEquals("Coordinated Universal Time", dateTzItem.getTzValue());
- assertEquals(true, dateTzItem.getDst());
-
- assertFalse(dateTzItem.equals(null));
- assertTrue(dateTzItem.equals(dateTzItem));
-
- TestContextDoubleItem doubleItem = new TestContextDoubleItem();
- assertFalse(dateTzItem.equals(doubleItem));
-
- TestContextDateTzItem otherDateTzItem = new TestContextDateTzItem(dateItem, "UTC", true);
- assertTrue(dateTzItem.equals(otherDateTzItem));
- otherDateTzItem.setDst(false);
- assertFalse(dateTzItem.equals(otherDateTzItem));
- otherDateTzItem.setDst(true);
- otherDateTzItem.setTzValue("IST");
- assertFalse(dateTzItem.equals(otherDateTzItem));
- otherDateTzItem.setTzValue(null);
- assertFalse(dateTzItem.equals(otherDateTzItem));
- otherDateTzItem.setTzValue("UTC");
- assertTrue(otherDateTzItem.equals(dateTzItem));
-
- dateTzItem.setDateValue(null);
- assertFalse(dateTzItem.equals(otherDateTzItem));
- otherDateTzItem.setDateValue(null);
- assertTrue(otherDateTzItem.equals(dateTzItem));
-
- TestContextDateItem otherDateItem = new TestContextDateItem(new Date(1L));
- dateTzItem.setDateValue(dateItem);
- otherDateTzItem.setDateValue(otherDateItem);
- assertFalse(dateTzItem.equals(otherDateTzItem));
- otherDateTzItem.setDateValue(dateItem);
-
- dateTzItem.setTzValue(null);
- assertFalse(dateTzItem.equals(otherDateTzItem));
- otherDateTzItem.setTzValue(null);
- assertTrue(otherDateTzItem.equals(dateTzItem));
-
- dateTzItem.setTzValue("UTC");
- otherDateTzItem.setTzValue("IST");
- assertFalse(dateTzItem.equals(otherDateTzItem));
-
- dateTzItem.setDateValue(null);
- dateTzItem.setTzValue(null);
- dateTzItem.setDst(true);
- assertEquals(67952, dateTzItem.hashCode());
-
- dateTzItem.setDst(false);
- assertEquals(68138, dateTzItem.hashCode());
- }
-
- @SuppressWarnings("unlikely-arg-type")
- @Test
- public void testDateLocale() {
- TestContextDateItem dateItem = new TestContextDateItem(new Date(0L));
-
- TestContextDateLocaleItem dateLocaleItem = new TestContextDateLocaleItem(dateItem, "UTC", true, 1, "EN", "IE");
- assertEquals("Coordinated Universal Time", dateLocaleItem.getTzValue());
- assertEquals(true, dateLocaleItem.getDst());
-
- assertFalse(dateLocaleItem.equals(null));
- assertTrue(dateLocaleItem.equals(dateLocaleItem));
-
- TestContextDoubleItem doubleItem = new TestContextDoubleItem();
- assertFalse(dateLocaleItem.equals(doubleItem));
-
- TestContextDateLocaleItem otherDateLocaleItem = new TestContextDateLocaleItem(dateItem, "UTC", true, 1, "EN",
- "IE");
- assertTrue(dateLocaleItem.equals(otherDateLocaleItem));
- otherDateLocaleItem.setDst(false);
- assertFalse(dateLocaleItem.equals(otherDateLocaleItem));
- otherDateLocaleItem.setDst(true);
- otherDateLocaleItem.setTzValue("IST");
- assertFalse(dateLocaleItem.equals(otherDateLocaleItem));
- otherDateLocaleItem.setTzValue(null);
- assertFalse(dateLocaleItem.equals(otherDateLocaleItem));
- otherDateLocaleItem.setTzValue("UTC");
- assertTrue(otherDateLocaleItem.equals(dateLocaleItem));
-
- dateLocaleItem.setDateValue(null);
- assertFalse(dateLocaleItem.equals(otherDateLocaleItem));
- otherDateLocaleItem.setDateValue(null);
- assertTrue(otherDateLocaleItem.equals(dateLocaleItem));
-
- TestContextDateItem otherDateItem = new TestContextDateItem(new Date(1L));
- dateLocaleItem.setDateValue(dateItem);
- otherDateLocaleItem.setDateValue(otherDateItem);
- assertFalse(dateLocaleItem.equals(otherDateLocaleItem));
- otherDateLocaleItem.setDateValue(dateItem);
-
- dateLocaleItem.setTzValue(null);
- assertFalse(dateLocaleItem.equals(otherDateLocaleItem));
- otherDateLocaleItem.setTzValue(null);
- assertTrue(otherDateLocaleItem.equals(dateLocaleItem));
-
- dateLocaleItem.setTzValue("UTC");
- otherDateLocaleItem.setTzValue("IST");
- assertFalse(dateLocaleItem.equals(otherDateLocaleItem));
-
- dateLocaleItem.setDateValue(null);
- dateLocaleItem.setTzValue(null);
- dateLocaleItem.setDst(true);
- dateLocaleItem.setLocale(new Locale("EN", "IE"));
- assertEquals(-1567427636, dateLocaleItem.hashCode());
-
- dateLocaleItem.setDst(false);
- assertEquals(-1567248890, dateLocaleItem.hashCode());
-
- dateLocaleItem.setLocale(null);
- assertEquals(65480619, dateLocaleItem.hashCode());
-
- dateLocaleItem.setLocale(new Locale("EN", "IE"));
- assertEquals(new Locale("EN", "IE"), dateLocaleItem.getLocale());
- assertEquals(1, dateLocaleItem.getUtcOffset());
-
- dateLocaleItem = new TestContextDateLocaleItem(dateItem, "UTC", true, 1, "EN", "IE");
- otherDateLocaleItem = new TestContextDateLocaleItem(dateItem, "UTC", true, 1, "EN", "IE");
- dateLocaleItem.setLocale(null);
- assertFalse(dateLocaleItem.equals(otherDateLocaleItem));
- otherDateLocaleItem.setLocale(null);
- assertTrue(otherDateLocaleItem.equals(dateLocaleItem));
-
- dateLocaleItem.setUtcOffset(0);
- assertFalse(otherDateLocaleItem.equals(dateLocaleItem));
- }
-
- @SuppressWarnings("unlikely-arg-type")
- @Test
- public void testPolicyContextItem() {
- TestPolicyContextItem item0 = new TestPolicyContextItem();
- TestPolicyContextItem item1 = new TestPolicyContextItem();
-
- assertTrue(item0.equals(item0));
- assertTrue(item0.equals(item1));
- assertFalse(item0.equals(null));
-
- TestContextBooleanItem booleanItem = new TestContextBooleanItem();
- assertFalse(item0.equals(booleanItem));
-
- assertEquals(887503681, item0.hashCode());
- item0.setTestPolicyContextItem000(new TestContextStringItem());
- item0.setTestPolicyContextItem001(new TestContextLongItem());
- item0.setTestPolicyContextItem002(new TestContextDoubleItem());
- item0.setTestPolicyContextItem003(new TestContextBooleanItem());
- item0.setTestPolicyContextItem004(new TestContextLongItem());
- item0.setTestPolicyContextItem005(new TestContextTreeMapItem());
- assertEquals(1805779574, item0.hashCode());
-
- assertFalse(item1.equals(item0));
-
- item1.setTestPolicyContextItem000(new TestContextStringItem("Hello"));
- assertFalse(item1.equals(item0));
- item1.setTestPolicyContextItem000(item0.getTestPolicyContextItem000());
- assertFalse(item1.equals(item0));
-
- item1.setTestPolicyContextItem001(new TestContextLongItem(123L));
- assertFalse(item1.equals(item0));
- item1.setTestPolicyContextItem001(item0.getTestPolicyContextItem001());
- assertFalse(item1.equals(item0));
-
- item1.setTestPolicyContextItem002(new TestContextDoubleItem(123.45));
- assertFalse(item1.equals(item0));
- item1.setTestPolicyContextItem002(item0.getTestPolicyContextItem002());
- assertFalse(item1.equals(item0));
-
- item1.setTestPolicyContextItem003(new TestContextBooleanItem(true));
- assertFalse(item1.equals(item0));
- item1.setTestPolicyContextItem003(item0.getTestPolicyContextItem003());
- assertFalse(item1.equals(item0));
-
- item1.setTestPolicyContextItem004(new TestContextLongItem(123L));
- assertFalse(item1.equals(item0));
- item1.setTestPolicyContextItem004(item0.getTestPolicyContextItem004());
- assertFalse(item1.equals(item0));
-
- item1.setTestPolicyContextItem005(new TestContextTreeMapItem());
- item1.getTestPolicyContextItem005().getMapValue().put("Key", "Value");
- assertFalse(item1.equals(item0));
- item1.setTestPolicyContextItem005(item0.getTestPolicyContextItem005());
- assertTrue(item1.equals(item0));
- }
-
- @SuppressWarnings("unlikely-arg-type")
- @Test
- public void testExternalContextItem() {
- TestExternalContextItem item0 = new TestExternalContextItem();
- TestExternalContextItem item1 = new TestExternalContextItem();
-
- assertTrue(item0.equals(item0));
- assertTrue(item0.equals(item1));
- assertFalse(item0.equals(null));
-
- TestContextBooleanItem booleanItem = new TestContextBooleanItem();
- assertFalse(item0.equals(booleanItem));
-
- assertEquals(-505558625, item0.hashCode());
- item0.setTestExternalContextItem000(new TestContextBooleanItem());
- item0.setTestExternalContextItem001(new TestContextByteItem());
- item0.setTestExternalContextItem002(new TestContextIntItem());
- item0.setTestExternalContextItem003(new TestContextLongItem());
- item0.setTestExternalContextItem004(new TestContextFloatItem());
- item0.setTestExternalContextItem005(new TestContextDoubleItem());
- item0.setTestExternalContextItem006(new TestContextStringItem());
- item0.setTestExternalContextItem007(new TestContextLongObjectItem());
- item0.setTestExternalContextItem008(new TestContextDateItem());
- item0.setTestExternalContextItem009(new TestContextDateTzItem());
- item0.setTestExternalContextItem00A(new TestContextDateLocaleItem());
- item0.setTestExternalContextItem00B(new TestContextTreeSetItem());
- item0.setTestExternalContextItem00C(new TestContextTreeMapItem());
- assertTrue(item0.hashCode() != 0);
-
- assertFalse(item1.equals(item0));
-
- item1.setTestExternalContextItem000(new TestContextBooleanItem(true));
- assertFalse(item1.equals(item0));
- item1.setTestExternalContextItem000(item0.getTestExternalContextItem000());
- assertFalse(item1.equals(item0));
-
- item1.setTestExternalContextItem001(new TestContextByteItem((byte) 123));
- assertFalse(item1.equals(item0));
- item1.setTestExternalContextItem001(item0.getTestExternalContextItem001());
- assertFalse(item1.equals(item0));
-
- item1.setTestExternalContextItem002(new TestContextIntItem(123));
- assertFalse(item1.equals(item0));
- item1.setTestExternalContextItem002(item0.getTestExternalContextItem002());
- assertFalse(item1.equals(item0));
-
- item1.setTestExternalContextItem003(new TestContextLongItem(123L));
- assertFalse(item1.equals(item0));
- item1.setTestExternalContextItem003(item0.getTestExternalContextItem003());
- assertFalse(item1.equals(item0));
-
- item1.setTestExternalContextItem004(new TestContextFloatItem((float) 123.45));
- assertFalse(item1.equals(item0));
- item1.setTestExternalContextItem004(item0.getTestExternalContextItem004());
- assertFalse(item1.equals(item0));
-
- item1.setTestExternalContextItem005(new TestContextDoubleItem(123.45));
- assertFalse(item1.equals(item0));
- item1.setTestExternalContextItem005(item0.getTestExternalContextItem005());
- assertFalse(item1.equals(item0));
-
- item1.setTestExternalContextItem006(new TestContextStringItem("Hello"));
- assertFalse(item1.equals(item0));
- item1.setTestExternalContextItem006(item0.getTestExternalContextItem006());
- assertFalse(item1.equals(item0));
-
- item1.setTestExternalContextItem007(new TestContextLongObjectItem(123L));
- assertFalse(item1.equals(item0));
- item1.setTestExternalContextItem007(item0.getTestExternalContextItem007());
- assertFalse(item1.equals(item0));
-
- item1.setTestExternalContextItem008(new TestContextDateItem(new Date(124)));
- assertFalse(item1.equals(item0));
- item1.setTestExternalContextItem008(item0.getTestExternalContextItem008());
- assertFalse(item1.equals(item0));
-
- item1.setTestExternalContextItem009(
- new TestContextDateTzItem(new TestContextDateItem(new Date(124)), "UTC", true));
- assertFalse(item1.equals(item0));
- item1.setTestExternalContextItem009(item0.getTestExternalContextItem009());
- assertFalse(item1.equals(item0));
-
- item1.setTestExternalContextItem00A(new TestContextDateLocaleItem(new TestContextDateItem(new Date(124)), "UTC",
- true, 1, "EN", "IE"));
- assertFalse(item1.equals(item0));
- item1.setTestExternalContextItem00A(item0.getTestExternalContextItem00A());
- assertFalse(item1.equals(item0));
-
- item1.setTestExternalContextItem00B(new TestContextTreeSetItem());
- item1.getTestExternalContextItem00B().getSetValue().add("Hello");
- assertFalse(item1.equals(item0));
- item1.setTestExternalContextItem00B(item0.getTestExternalContextItem00B());
- assertFalse(item1.equals(item0));
-
- item1.setTestExternalContextItem00C(new TestContextTreeMapItem());
- item1.getTestExternalContextItem00C().getMapValue().put("Key", "Value");
- assertFalse(item1.equals(item0));
- item1.setTestExternalContextItem00C(item0.getTestExternalContextItem00C());
- assertTrue(item1.equals(item0));
- }
-
- @SuppressWarnings("unlikely-arg-type")
- @Test
- public void testGlobalContextItem() {
- TestGlobalContextItem item0 = new TestGlobalContextItem();
- TestGlobalContextItem item1 = new TestGlobalContextItem();
-
- assertTrue(item0.equals(item0));
- assertTrue(item0.equals(item1));
- assertFalse(item0.equals(null));
-
- TestContextBooleanItem booleanItem = new TestContextBooleanItem();
- assertFalse(item0.equals(booleanItem));
-
- assertEquals(-505558625, item0.hashCode());
- item0.setTestGlobalContextItem000(new TestContextBooleanItem());
- item0.setTestGlobalContextItem001(new TestContextByteItem());
- item0.setTestGlobalContextItem002(new TestContextIntItem());
- item0.setTestGlobalContextItem003(new TestContextLongItem());
- item0.setTestGlobalContextItem004(new TestContextFloatItem());
- item0.setTestGlobalContextItem005(new TestContextDoubleItem());
- item0.setTestGlobalContextItem006(new TestContextStringItem());
- item0.setTestGlobalContextItem007(new TestContextLongObjectItem());
- item0.setTestGlobalContextItem008(new TestContextDateItem());
- item0.setTestGlobalContextItem009(new TestContextDateTzItem());
- item0.setTestGlobalContextItem00A(new TestContextDateLocaleItem());
- item0.setTestGlobalContextItem00B(new TestContextTreeSetItem());
- item0.setTestGlobalContextItem00C(new TestContextTreeMapItem());
- assertTrue(item0.hashCode() != 0);
-
- assertFalse(item1.equals(item0));
-
- item1.setTestGlobalContextItem000(new TestContextBooleanItem(true));
- assertFalse(item1.equals(item0));
- item1.setTestGlobalContextItem000(item0.getTestGlobalContextItem000());
- assertFalse(item1.equals(item0));
-
- item1.setTestGlobalContextItem001(new TestContextByteItem((byte) 123));
- assertFalse(item1.equals(item0));
- item1.setTestGlobalContextItem001(item0.getTestGlobalContextItem001());
- assertFalse(item1.equals(item0));
-
- item1.setTestGlobalContextItem002(new TestContextIntItem(123));
- assertFalse(item1.equals(item0));
- item1.setTestGlobalContextItem002(item0.getTestGlobalContextItem002());
- assertFalse(item1.equals(item0));
-
- item1.setTestGlobalContextItem003(new TestContextLongItem(123L));
- assertFalse(item1.equals(item0));
- item1.setTestGlobalContextItem003(item0.getTestGlobalContextItem003());
- assertFalse(item1.equals(item0));
-
- item1.setTestGlobalContextItem004(new TestContextFloatItem((float) 123.45));
- assertFalse(item1.equals(item0));
- item1.setTestGlobalContextItem004(item0.getTestGlobalContextItem004());
- assertFalse(item1.equals(item0));
-
- item1.setTestGlobalContextItem005(new TestContextDoubleItem(123.45));
- assertFalse(item1.equals(item0));
- item1.setTestGlobalContextItem005(item0.getTestGlobalContextItem005());
- assertFalse(item1.equals(item0));
-
- item1.setTestGlobalContextItem006(new TestContextStringItem("Hello"));
- assertFalse(item1.equals(item0));
- item1.setTestGlobalContextItem006(item0.getTestGlobalContextItem006());
- assertFalse(item1.equals(item0));
-
- item1.setTestGlobalContextItem007(new TestContextLongObjectItem(123L));
- assertFalse(item1.equals(item0));
- item1.setTestGlobalContextItem007(item0.getTestGlobalContextItem007());
- assertFalse(item1.equals(item0));
-
- item1.setTestGlobalContextItem008(new TestContextDateItem(new Date(124)));
- assertFalse(item1.equals(item0));
- item1.setTestGlobalContextItem008(item0.getTestGlobalContextItem008());
- assertFalse(item1.equals(item0));
-
- item1.setTestGlobalContextItem009(
- new TestContextDateTzItem(new TestContextDateItem(new Date(124)), "UTC", true));
- assertFalse(item1.equals(item0));
- item1.setTestGlobalContextItem009(item0.getTestGlobalContextItem009());
- assertFalse(item1.equals(item0));
-
- item1.setTestGlobalContextItem00A(new TestContextDateLocaleItem(new TestContextDateItem(new Date(124)), "UTC",
- true, 1, "EN", "IE"));
- assertFalse(item1.equals(item0));
- item1.setTestGlobalContextItem00A(item0.getTestGlobalContextItem00A());
- assertFalse(item1.equals(item0));
-
- item1.setTestGlobalContextItem00B(new TestContextTreeSetItem());
- item1.getTestGlobalContextItem00B().getSetValue().add("Hello");
- assertFalse(item1.equals(item0));
- item1.setTestGlobalContextItem00B(item0.getTestGlobalContextItem00B());
- assertFalse(item1.equals(item0));
-
- item1.setTestGlobalContextItem00C(new TestContextTreeMapItem());
- item1.getTestGlobalContextItem00C().getMapValue().put("Key", "Value");
- assertFalse(item1.equals(item0));
- item1.setTestGlobalContextItem00C(item0.getTestGlobalContextItem00C());
- assertTrue(item1.equals(item0));
- }
-}
diff --git a/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/distribution/ContextAlbumUpdateTest.java b/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/distribution/ContextAlbumUpdateTest.java
deleted file mode 100644
index 218a8f9af..000000000
--- a/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/distribution/ContextAlbumUpdateTest.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.apex.context.test.distribution;
-
-import java.io.IOException;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.onap.policy.apex.context.impl.distribution.jvmlocal.JvmLocalDistributor;
-import org.onap.policy.apex.context.impl.schema.java.JavaSchemaHelperParameters;
-import org.onap.policy.apex.context.parameters.ContextParameterConstants;
-import org.onap.policy.apex.context.parameters.ContextParameters;
-import org.onap.policy.apex.context.parameters.SchemaParameters;
-import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
-import org.onap.policy.apex.model.basicmodel.handling.ApexModelException;
-import org.onap.policy.common.parameters.ParameterService;
-import org.slf4j.ext.XLogger;
-import org.slf4j.ext.XLoggerFactory;
-
-public class ContextAlbumUpdateTest {
- // Logger for this class
- private static final XLogger logger = XLoggerFactory.getXLogger(ContextAlbumUpdateTest.class);
-
- private SchemaParameters schemaParameters;
- private ContextParameters contextParameters;
-
- /**
- * Set up context data.
- */
- @Before
- public void beforeTest() {
- contextParameters = new ContextParameters();
-
- contextParameters.setName(ContextParameterConstants.MAIN_GROUP_NAME);
- contextParameters.getDistributorParameters().setName(ContextParameterConstants.DISTRIBUTOR_GROUP_NAME);
- contextParameters.getLockManagerParameters().setName(ContextParameterConstants.LOCKING_GROUP_NAME);
- contextParameters.getPersistorParameters().setName(ContextParameterConstants.PERSISTENCE_GROUP_NAME);
-
- ParameterService.register(contextParameters);
- ParameterService.register(contextParameters.getDistributorParameters());
- ParameterService.register(contextParameters.getLockManagerParameters());
- ParameterService.register(contextParameters.getPersistorParameters());
-
- schemaParameters = new SchemaParameters();
- schemaParameters.setName(ContextParameterConstants.SCHEMA_GROUP_NAME);
- schemaParameters.getSchemaHelperParameterMap().put("JAVA", new JavaSchemaHelperParameters());
-
- ParameterService.register(schemaParameters);
- }
-
- /**
- * Clear down context data.
- */
- @After
- public void afterTest() {
- ParameterService.deregister(schemaParameters);
-
- ParameterService.deregister(contextParameters.getDistributorParameters());
- ParameterService.deregister(contextParameters.getLockManagerParameters());
- ParameterService.deregister(contextParameters.getPersistorParameters());
- ParameterService.deregister(contextParameters);
- }
-
- @Test
- public void testContextAlbumUpdateJvmLocalVarSet() throws ApexModelException, IOException, ApexException {
- logger.debug("Running testContextAlbumUpdateJVMLocalVarSet test . . .");
-
- contextParameters.getDistributorParameters().setPluginClass(JvmLocalDistributor.class.getCanonicalName());
- new ContextAlbumUpdate().testContextAlbumUpdate();
-
- logger.debug("Ran testContextAlbumUpdateJVMLocalVarSet test");
- }
-
- @Test
- public void testContextAlbumUpdateJvmLocalVarNotSet() throws ApexModelException, IOException, ApexException {
- logger.debug("Running testContextAlbumUpdateJVMLocalVarNotSet test . . .");
-
- new ContextAlbumUpdate().testContextAlbumUpdate();
-
- logger.debug("Ran testContextAlbumUpdateJVMLocalVarNotSet test");
- }
-}
diff --git a/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/distribution/ContextInstantiationTest.java b/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/distribution/ContextInstantiationTest.java
deleted file mode 100644
index d635be441..000000000
--- a/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/distribution/ContextInstantiationTest.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.apex.context.test.distribution;
-
-import java.io.IOException;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.onap.policy.apex.context.impl.distribution.jvmlocal.JvmLocalDistributor;
-import org.onap.policy.apex.context.impl.schema.java.JavaSchemaHelperParameters;
-import org.onap.policy.apex.context.parameters.ContextParameterConstants;
-import org.onap.policy.apex.context.parameters.ContextParameters;
-import org.onap.policy.apex.context.parameters.SchemaParameters;
-import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
-import org.onap.policy.apex.model.basicmodel.handling.ApexModelException;
-import org.onap.policy.common.parameters.ParameterService;
-import org.slf4j.ext.XLogger;
-import org.slf4j.ext.XLoggerFactory;
-
-/**
- * The Class TestContextInstantiation.
- *
- * @author Sergey Sachkov (sergey.sachkov@ericsson.com)
- */
-public class ContextInstantiationTest {
- // Logger for this class
- private static final XLogger logger = XLoggerFactory.getXLogger(ContextInstantiationTest.class);
-
- private SchemaParameters schemaParameters;
- private ContextParameters contextParameters;
-
- /**
- * Set up context for tests.
- */
- @Before
- public void beforeTest() {
- contextParameters = new ContextParameters();
-
- contextParameters.setName(ContextParameterConstants.MAIN_GROUP_NAME);
- contextParameters.getDistributorParameters().setName(ContextParameterConstants.DISTRIBUTOR_GROUP_NAME);
- contextParameters.getLockManagerParameters().setName(ContextParameterConstants.LOCKING_GROUP_NAME);
- contextParameters.getPersistorParameters().setName(ContextParameterConstants.PERSISTENCE_GROUP_NAME);
-
- ParameterService.register(contextParameters);
- ParameterService.register(contextParameters.getDistributorParameters());
- ParameterService.register(contextParameters.getLockManagerParameters());
- ParameterService.register(contextParameters.getPersistorParameters());
-
- schemaParameters = new SchemaParameters();
- schemaParameters.setName(ContextParameterConstants.SCHEMA_GROUP_NAME);
- schemaParameters.getSchemaHelperParameterMap().put("JAVA", new JavaSchemaHelperParameters());
-
- ParameterService.register(schemaParameters);
- }
-
- /**
- * Clear down context for tests.
- */
- @After
- public void afterTest() {
- ParameterService.deregister(schemaParameters);
-
- ParameterService.deregister(contextParameters.getDistributorParameters());
- ParameterService.deregister(contextParameters.getLockManagerParameters());
- ParameterService.deregister(contextParameters.getPersistorParameters());
- ParameterService.deregister(contextParameters);
- }
-
- @Test
- public void testContextInstantiationJvmLocalVarSet() throws ApexModelException, IOException, ApexException {
- logger.debug("Running testContextInstantiationJVMLocalVarSet test . . .");
-
- contextParameters.getDistributorParameters().setPluginClass(JvmLocalDistributor.class.getCanonicalName());
- new ContextInstantiation().testContextInstantiation();
-
- logger.debug("Ran testContextInstantiationJVMLocalVarSet test");
- }
-
- @Test
- public void testContextInstantiationJvmLocalVarNotSet() throws ApexModelException, IOException, ApexException {
- logger.debug("Running testContextInstantiationJVMLocalVarNotSet test . . .");
-
- new ContextInstantiation().testContextInstantiation();
-
- logger.debug("Ran testContextInstantiationJVMLocalVarNotSet test");
- }
-}
diff --git a/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/distribution/ContextUpdateTest.java b/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/distribution/ContextUpdateTest.java
deleted file mode 100644
index 0eaf591e3..000000000
--- a/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/distribution/ContextUpdateTest.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.apex.context.test.distribution;
-
-import java.io.IOException;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.onap.policy.apex.context.impl.distribution.jvmlocal.JvmLocalDistributor;
-import org.onap.policy.apex.context.impl.schema.java.JavaSchemaHelperParameters;
-import org.onap.policy.apex.context.parameters.ContextParameterConstants;
-import org.onap.policy.apex.context.parameters.ContextParameters;
-import org.onap.policy.apex.context.parameters.SchemaParameters;
-import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
-import org.onap.policy.apex.model.basicmodel.handling.ApexModelException;
-import org.onap.policy.common.parameters.ParameterService;
-import org.slf4j.ext.XLogger;
-import org.slf4j.ext.XLoggerFactory;
-
-/**
- * The Class TestContextUpdate.
- *
- * @author Sergey Sachkov (sergey.sachkov@ericsson.com)
- */
-public class ContextUpdateTest {
- // Logger for this class
- private static final XLogger logger = XLoggerFactory.getXLogger(ContextUpdateTest.class);
-
- private SchemaParameters schemaParameters;
- private ContextParameters contextParameters;
-
- /**
- * Set up context for tests.
- */
- @Before
- public void beforeTest() {
- contextParameters = new ContextParameters();
-
- contextParameters.setName(ContextParameterConstants.MAIN_GROUP_NAME);
- contextParameters.getDistributorParameters().setName(ContextParameterConstants.DISTRIBUTOR_GROUP_NAME);
- contextParameters.getLockManagerParameters().setName(ContextParameterConstants.LOCKING_GROUP_NAME);
- contextParameters.getPersistorParameters().setName(ContextParameterConstants.PERSISTENCE_GROUP_NAME);
-
- ParameterService.register(contextParameters);
- ParameterService.register(contextParameters.getDistributorParameters());
- ParameterService.register(contextParameters.getLockManagerParameters());
- ParameterService.register(contextParameters.getPersistorParameters());
-
- schemaParameters = new SchemaParameters();
- schemaParameters.setName(ContextParameterConstants.SCHEMA_GROUP_NAME);
- schemaParameters.getSchemaHelperParameterMap().put("JAVA", new JavaSchemaHelperParameters());
-
- ParameterService.register(schemaParameters);
- }
-
- /**
- * Clear down context for tests.
- */
- @After
- public void afterTest() {
- ParameterService.deregister(schemaParameters);
-
- ParameterService.deregister(contextParameters.getDistributorParameters());
- ParameterService.deregister(contextParameters.getLockManagerParameters());
- ParameterService.deregister(contextParameters.getPersistorParameters());
- ParameterService.deregister(contextParameters);
- }
-
- @Test
- public void testContextUpdateJvmLocalVarSet() throws ApexModelException, IOException, ApexException {
- logger.debug("Running testContextUpdateJVMLocalVarSet test . . .");
-
- contextParameters.getDistributorParameters().setPluginClass(JvmLocalDistributor.class.getCanonicalName());
- new ContextUpdate().testContextUpdate();
-
- logger.debug("Ran testContextUpdateJVMLocalVarSet test");
- }
-
- @Test
- public void testContextUpdateJvmLocalVarNotSet() throws ApexModelException, IOException, ApexException {
- logger.debug("Running testContextUpdateJVMLocalVarNotSet test . . .");
-
- new ContextUpdate().testContextUpdate();
-
- logger.debug("Ran testContextUpdateJVMLocalVarNotSet test");
- }
-}
diff --git a/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/distribution/SequentialContextInstantiationTest.java b/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/distribution/SequentialContextInstantiationTest.java
deleted file mode 100644
index 21ab6ef9e..000000000
--- a/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/distribution/SequentialContextInstantiationTest.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.apex.context.test.distribution;
-
-import java.io.IOException;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.onap.policy.apex.context.impl.distribution.jvmlocal.JvmLocalDistributor;
-import org.onap.policy.apex.context.impl.schema.java.JavaSchemaHelperParameters;
-import org.onap.policy.apex.context.parameters.ContextParameterConstants;
-import org.onap.policy.apex.context.parameters.ContextParameters;
-import org.onap.policy.apex.context.parameters.SchemaParameters;
-import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
-import org.onap.policy.apex.model.basicmodel.handling.ApexModelException;
-import org.onap.policy.common.parameters.ParameterService;
-import org.slf4j.ext.XLogger;
-import org.slf4j.ext.XLoggerFactory;
-
-/**
- * The Class TestContextInstantiation.
- *
- * @author Sergey Sachkov (sergey.sachkov@ericsson.com)
- */
-public class SequentialContextInstantiationTest {
- // Logger for this class
- private static final XLogger logger = XLoggerFactory.getXLogger(SequentialContextInstantiationTest.class);
-
- private SchemaParameters schemaParameters;
- private ContextParameters contextParameters;
-
- /**
- * Set up context for tests.
- */
- @Before
- public void beforeTest() {
- contextParameters = new ContextParameters();
-
- contextParameters.setName(ContextParameterConstants.MAIN_GROUP_NAME);
- contextParameters.getDistributorParameters().setName(ContextParameterConstants.DISTRIBUTOR_GROUP_NAME);
- contextParameters.getLockManagerParameters().setName(ContextParameterConstants.LOCKING_GROUP_NAME);
- contextParameters.getPersistorParameters().setName(ContextParameterConstants.PERSISTENCE_GROUP_NAME);
-
- ParameterService.register(contextParameters);
- ParameterService.register(contextParameters.getDistributorParameters());
- ParameterService.register(contextParameters.getLockManagerParameters());
- ParameterService.register(contextParameters.getPersistorParameters());
-
- schemaParameters = new SchemaParameters();
- schemaParameters.setName(ContextParameterConstants.SCHEMA_GROUP_NAME);
- schemaParameters.getSchemaHelperParameterMap().put("JAVA", new JavaSchemaHelperParameters());
-
- ParameterService.register(schemaParameters);
- }
-
- /**
- * Clear down context for tests.
- */
- @After
- public void afterTest() {
- ParameterService.deregister(schemaParameters);
-
- ParameterService.deregister(contextParameters.getDistributorParameters());
- ParameterService.deregister(contextParameters.getLockManagerParameters());
- ParameterService.deregister(contextParameters.getPersistorParameters());
- ParameterService.deregister(contextParameters);
- }
-
- @Test
- public void testSequentialContextInstantiationJvmLocalVarSet()
- throws ApexModelException, IOException, ApexException {
- logger.debug("Running testSequentialContextInstantiationJVMLocalVarSet test . . .");
-
- contextParameters.getDistributorParameters().setPluginClass(JvmLocalDistributor.class.getCanonicalName());
-
- new SequentialContextInstantiation().testSequentialContextInstantiation();
-
- logger.debug("Ran testSequentialContextInstantiationJVMLocalVarSet test");
- }
-
- @Test
- public void testSequentialContextInstantiationJvmLocalVarNotSet()
- throws ApexModelException, IOException, ApexException {
- logger.debug("Running testSequentialContextInstantiationJVMLocalVarNotSet test . . .");
-
- new ContextParameters();
- new SequentialContextInstantiation().testSequentialContextInstantiation();
-
- logger.debug("Ran testSequentialContextInstantiationJVMLocalVarNotSet test");
- }
-}
diff --git a/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/entities/ArtifactKeyTestEntityTest.java b/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/entities/ArtifactKeyTestEntityTest.java
deleted file mode 100644
index 486252517..000000000
--- a/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/entities/ArtifactKeyTestEntityTest.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.apex.context.test.entities;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Test;
-import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
-import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult;
-import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult.ValidationResult;
-
-/**
- * Test the AxArtifactKey test entity.
- *
- */
-public class ArtifactKeyTestEntityTest {
-
- @Test
- public void testTestEntity() {
- ArtifactKeyTestEntity testEntity = new ArtifactKeyTestEntity();
-
- ArtifactKeyTestEntity testEntityCopy = new ArtifactKeyTestEntity();
- assertEquals(120390253, testEntityCopy.hashCode());
-
- testEntity.setKey(null);
- testEntity.copyTo(testEntityCopy);
- assertTrue(testEntity.equals((testEntityCopy)));
- assertFalse(testEntity.checkSetKey());
- AxArtifactKey key = new AxArtifactKey("TestKey", "0.0.1");
-
- testEntity.setKey(key);
- testEntity.clean();
- AxValidationResult result = testEntity.validate(new AxValidationResult());
- assertEquals(ValidationResult.VALID, result.getValidationResult());
- assertEquals(key, testEntity.getKey());
- assertEquals(key, testEntity.getKeys().get(0));
- assertEquals(key.getId(), testEntity.getId());
- assertEquals((Double) 0.0, (Double) testEntity.getDoubleValue());
- assertTrue(testEntity.checkSetKey());
- assertEquals((Double) 0.0, (Double) testEntity.getDoubleValue());
- testEntity.setDoubleValue(3.14);
- assertEquals((Double) 3.14, (Double) testEntity.getDoubleValue());
- assertTrue(testEntity.checkSetKey());
- assertEquals("ArtifactKeyTestEntity [key=AxArtifactKey:(name=TestKey,version=0.0.1), doubleValue=3.14]",
- testEntity.toString());
- ArtifactKeyTestEntity testEntityClone = new ArtifactKeyTestEntity();
- testEntity.copyTo(testEntityClone);
- assertTrue(testEntity.equals(testEntity));
- assertTrue(testEntity.equals(testEntityClone));
- ArtifactKeyTestEntity testEntityNew = null;
- testEntityNew = (ArtifactKeyTestEntity) testEntity.copyTo(testEntityNew);
- assertTrue(testEntityNew.equals(testEntityNew));
- assertTrue(testEntity.equals(testEntityNew));
- ReferenceKeyTestEntity testEntityBad = new ReferenceKeyTestEntity();
- testEntityBad = (ReferenceKeyTestEntity) testEntity.copyTo(testEntityBad);
- assertNull(testEntityBad);
-
- testEntityBad = new ReferenceKeyTestEntity();
- assertEquals(-1036664728, testEntity.hashCode());
- assertFalse(testEntity.equals(null));
- assertEquals(-1, testEntity.compareTo(null));
- assertTrue(testEntity.equals(testEntity));
- assertEquals(0, testEntity.compareTo(testEntity));
- assertFalse(testEntity.equals(testEntityBad));
- assertEquals(-1, testEntity.compareTo(testEntityBad));
- assertFalse(testEntityCopy.equals(testEntity));
- assertEquals(1, testEntityCopy.compareTo(testEntity));
- testEntityClone.setKey(key);
- testEntityNew.setKey(AxArtifactKey.getNullKey());
- assertFalse(testEntityNew.equals(testEntityClone));
- assertEquals(-6, testEntityNew.compareTo(testEntityClone));
- testEntityClone.setKey(null);
- testEntityNew.setKey(null);
- assertTrue(testEntityNew.equals(testEntityClone));
- assertEquals(0, testEntityNew.compareTo(testEntityClone));
- testEntityCopy.setKey(AxArtifactKey.getNullKey());
- assertFalse(testEntityCopy.equals(testEntity));
- assertEquals(-6, testEntityCopy.compareTo(testEntity));
- testEntityClone.setKey(key);
- testEntityClone.setDoubleValue(1.23);
- assertFalse(testEntity.equals(testEntityClone));
- assertEquals(1, testEntity.compareTo(testEntityClone));
-
- ArtifactKeyTestEntity entity2 = new ArtifactKeyTestEntity(3.14);
- assertEquals((Double)3.14, (Double)entity2.getDoubleValue());
- ArtifactKeyTestEntity entity3 = new ArtifactKeyTestEntity(key, 3.14);
- assertEquals(key, entity3.getKey());
-
- entity3.setKey(null);
- assertEquals(31, entity3.hashCode());
- }
-}
diff --git a/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/entities/ReferenceTestEntityTest.java b/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/entities/ReferenceTestEntityTest.java
deleted file mode 100644
index ce9073431..000000000
--- a/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/entities/ReferenceTestEntityTest.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.apex.context.test.entities;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Test;
-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.concepts.AxValidationResult.ValidationResult;
-
-/**
- * Test the AxArtifactKey test entity.
- *
- */
-public class ReferenceTestEntityTest {
-
- @Test
- public void testTestEntity() {
- ReferenceKeyTestEntity testEntity = new ReferenceKeyTestEntity();
-
- ReferenceKeyTestEntity testEntityCopy = new ReferenceKeyTestEntity();
- assertEquals(-192063539, testEntityCopy.hashCode());
-
- testEntity.setKey(null);
- testEntity.copyTo(testEntityCopy);
- assertTrue(testEntity.equals((testEntityCopy)));
- assertFalse(testEntity.checkSetKey());
- AxReferenceKey key = new AxReferenceKey("TestKey", "0.0.1", "ParentLocalName", "LocalName");
-
- testEntity.setKey(key);
- testEntity.clean();
- AxValidationResult result = testEntity.validate(new AxValidationResult());
- assertEquals(ValidationResult.VALID, result.getValidationResult());
- assertEquals(key, testEntity.getKey());
- assertEquals(key, testEntity.getKeys().get(0));
- assertEquals(key.getId(), testEntity.getId());
- assertEquals((Double) 0.0, (Double) testEntity.getDoubleValue());
- assertTrue(testEntity.checkSetKey());
- assertEquals((Double) 0.0, (Double) testEntity.getDoubleValue());
- testEntity.setDoubleValue(3.14);
- assertEquals((Double) 3.14, (Double) testEntity.getDoubleValue());
- assertTrue(testEntity.checkSetKey());
- assertEquals("ReferenceKeyTestEntity [key=AxReferenceKey:(parentKeyName=TestKey,parentKeyVersion=0.0.1,"
- + "parentLocalName=ParentLocalName,localName=LocalName), doubleValue=3.14]",
- testEntity.toString());
- ReferenceKeyTestEntity testEntityClone = new ReferenceKeyTestEntity();
- testEntity.copyTo(testEntityClone);
- assertTrue(testEntity.equals(testEntity));
- assertTrue(testEntity.equals(testEntityClone));
- ReferenceKeyTestEntity testEntityNew = null;
- testEntityNew = (ReferenceKeyTestEntity) testEntity.copyTo(testEntityNew);
- assertTrue(testEntityNew.equals(testEntityNew));
- assertTrue(testEntity.equals(testEntityNew));
- ArtifactKeyTestEntity testEntityBad = new ArtifactKeyTestEntity();
- testEntityBad = (ArtifactKeyTestEntity) testEntity.copyTo(testEntityBad);
- assertNull(testEntityBad);
-
- testEntityBad = new ArtifactKeyTestEntity();
- assertEquals(-49094350, testEntity.hashCode());
- assertFalse(testEntity.equals(null));
- assertEquals(-1, testEntity.compareTo(null));
- assertTrue(testEntity.equals(testEntity));
- assertEquals(0, testEntity.compareTo(testEntity));
- assertFalse(testEntity.equals(testEntityBad));
- assertEquals(-1, testEntity.compareTo(testEntityBad));
- assertFalse(testEntityCopy.equals(testEntity));
- assertEquals(1, testEntityCopy.compareTo(testEntity));
- testEntityClone.setKey(key);
- testEntityNew.setKey(AxReferenceKey.getNullKey());
- assertFalse(testEntityNew.equals(testEntityClone));
- assertEquals(-6, testEntityNew.compareTo(testEntityClone));
- testEntityClone.setKey(null);
- testEntityNew.setKey(null);
- assertTrue(testEntityNew.equals(testEntityClone));
- assertEquals(0, testEntityNew.compareTo(testEntityClone));
- testEntityCopy.setKey(AxReferenceKey.getNullKey());
- assertFalse(testEntityCopy.equals(testEntity));
- assertEquals(-6, testEntityCopy.compareTo(testEntity));
- testEntityClone.setKey(key);
- testEntityClone.setDoubleValue(1.23);
- assertFalse(testEntity.equals(testEntityClone));
- assertEquals(1, testEntity.compareTo(testEntityClone));
-
- ReferenceKeyTestEntity entity2 = new ReferenceKeyTestEntity(3.14);
- assertEquals((Double) 3.14, (Double) entity2.getDoubleValue());
- ReferenceKeyTestEntity entity3 = new ReferenceKeyTestEntity(key, 3.14);
- assertEquals(key, entity3.getKey());
-
- entity3.setKey(null);
- assertEquals(31, entity3.hashCode());
- }
-}
diff --git a/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/locking/ConcurrentContextTest.java b/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/locking/ConcurrentContextTest.java
deleted file mode 100644
index 7274f0d57..000000000
--- a/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/locking/ConcurrentContextTest.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.apex.context.test.locking;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.onap.policy.apex.context.test.lock.modifier.LockType.WRITE_LOCK_SINGLE_VALUE_UPDATE;
-import static org.onap.policy.apex.context.test.utils.Constants.TEST_VALUE;
-
-import java.util.Map;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.onap.policy.apex.context.impl.distribution.jvmlocal.JvmLocalDistributor;
-import org.onap.policy.apex.context.impl.locking.jvmlocal.JvmLocalLockManager;
-import org.onap.policy.apex.context.impl.schema.java.JavaSchemaHelperParameters;
-import org.onap.policy.apex.context.parameters.ContextParameterConstants;
-import org.onap.policy.apex.context.parameters.ContextParameters;
-import org.onap.policy.apex.context.parameters.SchemaParameters;
-import org.onap.policy.apex.context.test.concepts.TestContextLongItem;
-import org.onap.policy.apex.context.test.utils.ConfigrationProvider;
-import org.onap.policy.apex.context.test.utils.ConfigrationProviderImpl;
-import org.onap.policy.apex.context.test.utils.Constants;
-import org.onap.policy.common.parameters.ParameterService;
-import org.slf4j.ext.XLogger;
-import org.slf4j.ext.XLoggerFactory;
-
-/**
- * The Class TestConcurrentContext tests concurrent use of context.
- *
- * @author Liam Fallon (liam.fallon@ericsson.com)
- */
-public class ConcurrentContextTest {
-
- // Logger for this class
- private static final XLogger logger = XLoggerFactory.getXLogger(ConcurrentContextTest.class);
-
- // Test parameters
- private static final int ALBUM_SIZE = 16;
- private static final int TEST_JVM_COUNT_SINGLE_JVM = 1;
- private static final int TEST_JVM_COUNT_MULTI_JVM = 3;
- private static final int TEST_THREAD_COUNT_SINGLE_JVM = 64;
- private static final int TEST_THREAD_COUNT_MULTI_JVM = 20;
- private static final int TEST_THREAD_LOOPS = 100;
-
- private SchemaParameters schemaParameters;
- private ContextParameters contextParameters;
-
- /**
- * Set up context for tests.
- */
- @Before
- public void beforeTest() {
- contextParameters = new ContextParameters();
-
- contextParameters.setName(ContextParameterConstants.MAIN_GROUP_NAME);
- contextParameters.getDistributorParameters().setName(ContextParameterConstants.DISTRIBUTOR_GROUP_NAME);
- contextParameters.getLockManagerParameters().setName(ContextParameterConstants.LOCKING_GROUP_NAME);
- contextParameters.getPersistorParameters().setName(ContextParameterConstants.PERSISTENCE_GROUP_NAME);
-
- ParameterService.register(contextParameters);
- ParameterService.register(contextParameters.getDistributorParameters());
- ParameterService.register(contextParameters.getLockManagerParameters());
- ParameterService.register(contextParameters.getPersistorParameters());
-
- schemaParameters = new SchemaParameters();
- schemaParameters.setName(ContextParameterConstants.SCHEMA_GROUP_NAME);
- schemaParameters.getSchemaHelperParameterMap().put("JAVA", new JavaSchemaHelperParameters());
-
- ParameterService.register(schemaParameters);
- }
-
- /**
- * Clear down context for tests.
- */
- @After
- public void afterTest() {
- ParameterService.deregister(schemaParameters);
-
- ParameterService.deregister(contextParameters.getDistributorParameters());
- ParameterService.deregister(contextParameters.getLockManagerParameters());
- ParameterService.deregister(contextParameters.getPersistorParameters());
- ParameterService.deregister(contextParameters);
- }
-
- @Test
- public void testConcurrentContextJvmLocalVarSet() throws Exception {
- logger.debug("Running testConcurrentContextJVMLocalVarSet test . . .");
-
- contextParameters.getLockManagerParameters().setPluginClass(JvmLocalLockManager.class.getCanonicalName());
-
- final ConfigrationProvider configrationProvider = getConfigrationProvider("JVMLocalVarSet",
- TEST_JVM_COUNT_SINGLE_JVM, TEST_THREAD_COUNT_SINGLE_JVM, TEST_THREAD_LOOPS);
-
- final ConcurrentContext concurrentContext = new ConcurrentContext(configrationProvider);
- final Map<String, TestContextLongItem> result = concurrentContext.testConcurrentContext();
-
- assertFalse(result.isEmpty());
- final int expected = TEST_JVM_COUNT_SINGLE_JVM * TEST_THREAD_COUNT_SINGLE_JVM * TEST_THREAD_LOOPS;
- final TestContextLongItem actual = result.get(TEST_VALUE);
- assertNotNull(actual);
- assertEquals(expected, actual.getLongValue());
-
-
- logger.debug("Ran testConcurrentContextJVMLocalVarSet test");
- }
-
- @Test
- public void testConcurrentContextJvmLocalNoVarSet() throws Exception {
- logger.debug("Running testConcurrentContextJVMLocalNoVarSet test . . .");
-
- final ConfigrationProvider configrationProvider = getConfigrationProvider("JVMLocalNoVarSet",
- TEST_JVM_COUNT_SINGLE_JVM, TEST_THREAD_COUNT_SINGLE_JVM, TEST_THREAD_LOOPS);
-
- final ConcurrentContext concurrentContext = new ConcurrentContext(configrationProvider);
- final Map<String, TestContextLongItem> result = concurrentContext.testConcurrentContext();
-
- assertFalse(result.isEmpty());
- final int expected = TEST_JVM_COUNT_SINGLE_JVM * TEST_THREAD_COUNT_SINGLE_JVM * TEST_THREAD_LOOPS;
- final TestContextLongItem actual = result.get(TEST_VALUE);
- assertNotNull(actual);
- assertEquals(expected, actual.getLongValue());
-
- logger.debug("Ran testConcurrentContextJVMLocalNoVarSet test");
- }
-
- @Test
- public void testConcurrentContextMultiJvmNoLock() throws Exception {
- logger.debug("Running testConcurrentContextMultiJVMNoLock test . . .");
-
- contextParameters.getDistributorParameters().setPluginClass(JvmLocalDistributor.class.getCanonicalName());
- contextParameters.getLockManagerParameters().setPluginClass(JvmLocalLockManager.class.getCanonicalName());
-
- final ConfigrationProvider configrationProvider = getConfigrationProvider("testConcurrentContextMultiJVMNoLock",
- TEST_JVM_COUNT_MULTI_JVM, TEST_THREAD_COUNT_MULTI_JVM, TEST_THREAD_LOOPS);
-
- final ConcurrentContext concurrentContext = new ConcurrentContext(configrationProvider);
- final Map<String, TestContextLongItem> result = concurrentContext.testConcurrentContext();
-
- // No concurrent map so result will be zero
- assertFalse(result.isEmpty());
- final TestContextLongItem actual = result.get(TEST_VALUE);
- assertNotNull(actual);
- assertEquals(0, actual.getLongValue());
-
- logger.debug("Ran testConcurrentContextMultiJVMNoLock test");
- }
-
- private ConfigrationProvider getConfigrationProvider(final String testType, final int jvmCount,
- final int threadCount, final int threadLoops) {
- return new ConfigrationProviderImpl(testType, jvmCount, threadCount, threadLoops, ALBUM_SIZE,
- WRITE_LOCK_SINGLE_VALUE_UPDATE.getValue()) {
- @Override
- public Map<String, Object> getContextAlbumInitValues() {
- final Map<String, Object> initValues = super.getContextAlbumInitValues();
- initValues.put(Constants.TEST_VALUE, new TestContextLongItem(0L));
- return initValues;
- }
- };
- }
-}
diff --git a/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/persistence/PersistentContextInstantiationTest.java b/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/persistence/PersistentContextInstantiationTest.java
deleted file mode 100644
index 6bd4a4d41..000000000
--- a/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/persistence/PersistentContextInstantiationTest.java
+++ /dev/null
@@ -1,224 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.apex.context.test.persistence;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.io.File;
-import java.io.IOException;
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.TimeZone;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.onap.policy.apex.context.ContextAlbum;
-import org.onap.policy.apex.context.Distributor;
-import org.onap.policy.apex.context.impl.distribution.DistributorFactory;
-import org.onap.policy.apex.context.impl.schema.java.JavaSchemaHelperParameters;
-import org.onap.policy.apex.context.parameters.ContextParameterConstants;
-import org.onap.policy.apex.context.parameters.ContextParameters;
-import org.onap.policy.apex.context.parameters.SchemaParameters;
-import org.onap.policy.apex.context.test.concepts.TestContextDateItem;
-import org.onap.policy.apex.context.test.concepts.TestContextDateLocaleItem;
-import org.onap.policy.apex.context.test.concepts.TestContextLongItem;
-import org.onap.policy.apex.context.test.concepts.TestContextTreeMapItem;
-import org.onap.policy.apex.context.test.factory.TestContextAlbumFactory;
-import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
-import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
-import org.onap.policy.apex.model.basicmodel.dao.ApexDao;
-import org.onap.policy.apex.model.basicmodel.dao.ApexDaoFactory;
-import org.onap.policy.apex.model.basicmodel.dao.DaoParameters;
-import org.onap.policy.apex.model.basicmodel.handling.ApexModelException;
-import org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum;
-import org.onap.policy.apex.model.contextmodel.concepts.AxContextModel;
-import org.onap.policy.common.parameters.ParameterService;
-
-/**
- * The Class TestContextInstantiation.
- *
- * @author Sergey Sachkov (sergey.sachkov@ericsson.com)
- */
-public class PersistentContextInstantiationTest {
- // Logger for this class
- // private static final XLogger logger =
- // XLoggerFactory.getXLogger(TestPersistentContextInstantiation.class);
-
- private Connection connection;
- private SchemaParameters schemaParameters;
- private ContextParameters contextParameters;
-
- @Before
- public void setup() throws Exception {
- Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance();
- connection = DriverManager.getConnection("jdbc:derby:memory:apex_test;create=true");
- }
-
- @After
- public void teardown() throws Exception {
- connection.close();
- new File("derby.log").delete();
- }
-
- /**
- * Set up context for tests.
- */
- @Before
- public void beforeTest() {
- contextParameters = new ContextParameters();
-
- contextParameters.setName(ContextParameterConstants.MAIN_GROUP_NAME);
- contextParameters.getDistributorParameters().setName(ContextParameterConstants.DISTRIBUTOR_GROUP_NAME);
- contextParameters.getLockManagerParameters().setName(ContextParameterConstants.LOCKING_GROUP_NAME);
- contextParameters.getPersistorParameters().setName(ContextParameterConstants.PERSISTENCE_GROUP_NAME);
-
- ParameterService.register(contextParameters);
- ParameterService.register(contextParameters.getDistributorParameters());
- ParameterService.register(contextParameters.getLockManagerParameters());
- ParameterService.register(contextParameters.getPersistorParameters());
-
- schemaParameters = new SchemaParameters();
- schemaParameters.setName(ContextParameterConstants.SCHEMA_GROUP_NAME);
- schemaParameters.getSchemaHelperParameterMap().put("JAVA", new JavaSchemaHelperParameters());
-
- ParameterService.register(schemaParameters);
- }
-
- /**
- * Clear down context for tests.
- */
- @After
- public void afterTest() {
- ParameterService.deregister(schemaParameters);
-
- ParameterService.deregister(contextParameters.getDistributorParameters());
- ParameterService.deregister(contextParameters.getLockManagerParameters());
- ParameterService.deregister(contextParameters.getPersistorParameters());
- ParameterService.deregister(contextParameters);
- }
-
- @Test
- public void testContextPersistentInstantiation() throws ApexModelException, IOException, ApexException {
-
- final AxArtifactKey distributorKey = new AxArtifactKey("AbstractDistributor", "0.0.1");
- final Distributor contextDistributor = new DistributorFactory().getDistributor(distributorKey);
-
- final AxArtifactKey[] usedArtifactStackArray = {
- new AxArtifactKey("testC-top", "0.0.1"),
- new AxArtifactKey("testC-next", "0.0.1"),
- new AxArtifactKey("testC-bot", "0.0.1")
- };
-
- final DaoParameters DaoParameters = new DaoParameters();
- DaoParameters.setPluginClass("org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao");
- DaoParameters.setPersistenceUnit("DAOTest");
- final ApexDao apexDao = new ApexDaoFactory().createApexDao(DaoParameters);
- apexDao.init(DaoParameters);
-
- final AxContextModel someContextModel = TestContextAlbumFactory.createMultiAlbumsContextModel();
-
- // Context for Storing Map values
- final AxContextAlbum axContextAlbumForMap = someContextModel.getAlbums().getAlbumsMap()
- .get(new AxArtifactKey("MapContextAlbum", "0.0.1"));
- apexDao.create(axContextAlbumForMap);
- contextDistributor.registerModel(someContextModel);
- final ContextAlbum contextAlbumForMap = contextDistributor.createContextAlbum(axContextAlbumForMap.getKey());
- assertNotNull(contextAlbumForMap);
- contextAlbumForMap.setUserArtifactStack(usedArtifactStackArray);
-
- final Map<String, String> testMap = new HashMap<String, String>();
- testMap.put("key", "This is a policy context string");
-
- final Map<String, Object> valueMap0 = new HashMap<String, Object>();
- valueMap0.put("TestPolicyContextItem000", new TestContextTreeMapItem(testMap));
-
- contextAlbumForMap.putAll(valueMap0);
-
- assertEquals("This is a policy context string",
- ((TestContextTreeMapItem) contextAlbumForMap.get("TestPolicyContextItem000")).getMapValue()
- .get("key"));
-
- contextAlbumForMap.flush();
-
- // Context for Storing Date values
- final AxContextAlbum axContextAlbumForDate = someContextModel.getAlbums().getAlbumsMap()
- .get(new AxArtifactKey("DateContextAlbum", "0.0.1"));
- apexDao.create(axContextAlbumForDate);
- contextDistributor.registerModel(someContextModel);
- final ContextAlbum contextAlbumForDate = contextDistributor.createContextAlbum(axContextAlbumForDate.getKey());
- assertNotNull(contextAlbumForDate);
- contextAlbumForDate.setUserArtifactStack(usedArtifactStackArray);
-
- final TestContextDateItem testDate = new TestContextDateItem(new Date());
- final TestContextDateLocaleItem tci00A = new TestContextDateLocaleItem();
- tci00A.setDateValue(testDate);
- tci00A.setTzValue(TimeZone.getTimeZone("Europe/Dublin").toString());
- tci00A.setDst(true);
-
- final Map<String, Object> valueMap1 = new HashMap<String, Object>();
- valueMap1.put("TestPolicyContextItem00A", tci00A);
-
- contextAlbumForDate.putAll(valueMap1);
-
- assertEquals(testDate, ((TestContextDateLocaleItem) contextAlbumForDate.get("TestPolicyContextItem00A"))
- .getDateValue());
- assertEquals(true, ((TestContextDateLocaleItem) contextAlbumForDate.get("TestPolicyContextItem00A")).getDst());
-
- contextAlbumForDate.flush();
-
- // Context for Storing Long values
- final AxContextAlbum axContextAlbumForLong = someContextModel.getAlbums().getAlbumsMap()
- .get(new AxArtifactKey("LTypeContextAlbum", "0.0.1"));
- apexDao.create(axContextAlbumForLong);
- contextDistributor.registerModel(someContextModel);
- final ContextAlbum contextAlbumForLong = contextDistributor.createContextAlbum(axContextAlbumForLong.getKey());
- assertNotNull(contextAlbumForLong);
- contextAlbumForLong.setUserArtifactStack(usedArtifactStackArray);
-
- final Map<String, Object> valueMap2 = new HashMap<String, Object>();
- valueMap2.put("TestPolicyContextItem0031", new TestContextLongItem(0xFFFFFFFFFFFFFFFFL));
- valueMap2.put("TestPolicyContextItem0032", new TestContextLongItem(0xFFFFFFFFFFFFFFFEL));
- valueMap2.put("TestPolicyContextItem0033", new TestContextLongItem(0xFFFFFFFFFFFFFFFDL));
- valueMap2.put("TestPolicyContextItem0034", new TestContextLongItem(0xFFFFFFFFFFFFFFFCL));
- valueMap2.put("TestPolicyContextItem0035", new TestContextLongItem(0xFFFFFFFFFFFFFFFBL));
-
- contextAlbumForLong.putAll(valueMap2);
-
- assertEquals(0xFFFFFFFFFFFFFFFFL,
- ((TestContextLongItem) contextAlbumForLong.get("TestPolicyContextItem0031")).getLongValue());
- assertEquals(0xFFFFFFFFFFFFFFFEL,
- ((TestContextLongItem) contextAlbumForLong.get("TestPolicyContextItem0032")).getLongValue());
- assertEquals(0xFFFFFFFFFFFFFFFDL,
- ((TestContextLongItem) contextAlbumForLong.get("TestPolicyContextItem0033")).getLongValue());
- assertEquals(0xFFFFFFFFFFFFFFFCL,
- ((TestContextLongItem) contextAlbumForLong.get("TestPolicyContextItem0034")).getLongValue());
- assertEquals(0xFFFFFFFFFFFFFFFBL,
- ((TestContextLongItem) contextAlbumForLong.get("TestPolicyContextItem0035")).getLongValue());
-
- contextAlbumForLong.flush();
- contextDistributor.clear();
- }
-}
diff --git a/context/context-test-utils/src/test/resources/META-INF/persistence.xml b/context/context-test-utils/src/test/resources/META-INF/persistence.xml
deleted file mode 100644
index b7911caa2..000000000
--- a/context/context-test-utils/src/test/resources/META-INF/persistence.xml
+++ /dev/null
@@ -1,50 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ============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=========================================================
--->
-
-<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0">
- <persistence-unit name="DAOTest" transaction-type="RESOURCE_LOCAL">
- <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
-
- <class>org.onap.policy.apex.model.basicmodel.dao.converters.CDataConditioner</class>
- <class>org.onap.policy.apex.model.basicmodel.dao.converters.Uuid2String</class>
- <class>org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey</class>
- <class>org.onap.policy.apex.model.basicmodel.concepts.AxConcept</class>
- <class>org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo</class>
- <class>org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation</class>
- <class>org.onap.policy.apex.model.basicmodel.concepts.AxModel</class>
- <class>org.onap.policy.apex.model.basicmodel.concepts.TestEntity</class>
- <class>org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema</class>
- <class>org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas</class>
- <class>org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum</class>
- <class>org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbums</class>
- <class>org.onap.policy.apex.model.contextmodel.concepts.AxContextModel</class>
-
- <properties>
- <property name="javax.persistence.jdbc.url" value="jdbc:derby:memory:apex_test" />
- <property name="javax.persistence.target-database" value="Derby" />
- <property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.EmbeddedDriver" />
-
- <property name="eclipselink.ddl-generation" value="drop-and-create-tables" />
- <property name="eclipselink.ddl-generation.output-mode" value="database" />
- <property name="eclipselink.logging.level" value="INFO" />
- </properties>
- </persistence-unit>
-</persistence>