diff options
90 files changed, 1345 insertions, 3261 deletions
diff --git a/context/context-test-utils/pom.xml b/context/context-test-utils/pom.xml deleted file mode 100644 index 37b4e6932..000000000 --- a/context/context-test-utils/pom.xml +++ /dev/null @@ -1,107 +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========================================================= ---> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.onap.policy.apex-pdp.context</groupId> - <artifactId>context</artifactId> - <version>2.1.0-SNAPSHOT</version> - </parent> - - <artifactId>context-test-utils</artifactId> - <name>${project.artifactId}</name> - <description>[${project.parent.artifactId}] module contain default distributor tests and common test utils</description> - - <dependencies> - <dependency> - <groupId>org.onap.policy.apex-pdp.model</groupId> - <artifactId>context-model</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.onap.policy.apex-pdp.context</groupId> - <artifactId>context-management</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>com.google.code.gson</groupId> - <artifactId>gson</artifactId> - </dependency> - <dependency> - <groupId>org.apache.derby</groupId> - <artifactId>derby</artifactId> - <version>${version.derby}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>compile</scope> - </dependency> - <dependency> - <groupId>org.apache.curator</groupId> - <artifactId>curator-test</artifactId> - <version>4.0.0</version> - <exclusions> - <exclusion> - <groupId>log4j</groupId> - <artifactId>log4j</artifactId> - </exclusion> - <exclusion> - <groupId>org.apache.zookeeper</groupId> - <artifactId>zookeeper</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.apache.zookeeper</groupId> - <artifactId>zookeeper</artifactId> - <version>3.5.4-beta</version> - <exclusions> - <!-- Zookeeper uses an ancient version of log4j --> - <exclusion> - <groupId>log4j</groupId> - <artifactId>log4j</artifactId> - </exclusion> - <exclusion> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-log4j12</artifactId> - </exclusion> - </exclusions> - </dependency> - </dependencies> - - <profiles> - <profile> - <id>apexSite</id> - <activation> - <property> - <name>apexSite</name> - </property> - </activation> - <distributionManagement> - <site> - <id>${project.artifactId}-site</id> - <url>${apex.adsite.prefix}/modules/${project.parent.artifactId}/${project.artifactId}/</url> - </site> - </distributionManagement> - </profile> - </profiles> -</project>
\ No newline at end of file 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 Binary files differdeleted file mode 100644 index 915d6e59d..000000000 --- a/context/context-test-utils/src/site/images/logos.png +++ /dev/null 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/pom.xml b/context/pom.xml index b4c78c69d..a41e6b51b 100644 --- a/context/pom.xml +++ b/context/pom.xml @@ -1,6 +1,7 @@ <!-- ============LICENSE_START======================================================= Copyright (C) 2018 Ericsson. All rights reserved. + Modifications Copyright (C) 2019 Nordix Foundation. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -34,7 +35,6 @@ <modules> <module>context-management</module> - <module>context-test-utils</module> </modules> <profiles> @@ -53,4 +53,4 @@ </distributionManagement> </profile> </profiles> -</project>
\ No newline at end of file +</project> diff --git a/docs/APEX-User-Manual.rst b/docs/APEX-User-Manual.rst index 9f7b1489b..01f74fabe 100644 --- a/docs/APEX-User-Manual.rst +++ b/docs/APEX-User-Manual.rst @@ -6606,7 +6606,7 @@ Test Policy Step 2 | "time": 1483351989000, | "amount" : 699, | | | "sale_ID": 99999983, | "assistant_ID" : 2323, | | | "amount": 699, | "notes" : "", | | - | tem_ID": 5321, | "quantity" : 1, | | + | "item_ID": 5321, | "quantity" : 1, | | | "quantity": 1, | "branch_ID" : 1001, | | | "assistant_ID": 2323, | "item_ID" : 5321, | | | "branch_ID": 1001, | "authorised" : true, | | diff --git a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ApexModelImpl.java b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ApexModelImpl.java index c15eadc7d..fae1d5951 100644 --- a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ApexModelImpl.java +++ b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ApexModelImpl.java @@ -931,22 +931,36 @@ public final class ApexModelImpl implements ApexModel { return policyFacade.deletePolicyStateFinalizerLogic(name, version, stateName, finalizerLogicName); } - /* - * (non-Javadoc) - * - * @see - * org.onap.policy.apex.core.modelapi.ApexEditorAPI#createPolicyStateTaskRef(java.lang.String, - * java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, - * java.lang.String, java.lang.String) - */ - @Override - // CHECKSTYLE:OFF: checkstyle:parameterNumber - public ApexApiResult createPolicyStateTaskRef(final String name, final String version, final String stateName, - final String taskLocalName, final String taskName, final String taskVersion, final String outputType, - final String outputName) { - return policyFacade.createPolicyStateTaskRef(name, version, stateName, taskLocalName, taskName, taskVersion, - outputType, outputName); - } + /* + * (non-Javadoc) + * + * @see + * org.onap.policy.apex.core.modelapi.ApexEditorAPI#createPolicyStateTaskRef(java.lang.String, + * java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, + * java.lang.String, java.lang.String) + */ + @Override + // CHECKSTYLE:OFF: checkstyle:parameterNumber + public ApexApiResult createPolicyStateTaskRef( + final String name, + final String version, + final String stateName, + final String taskLocalName, + final String taskName, + final String taskVersion, + final String outputType, + final String outputName) { + return policyFacade.createPolicyStateTaskRef( + new CreatePolicyStateTaskRefBuilder() + .setName(name) + .setVersion(version) + .setStateName(stateName) + .setTaskLocalName(taskLocalName) + .setTaskName(taskName) + .setTaskVersion(taskVersion) + .setOutputType(outputType) + .setOutputName(outputName)); + } // CHECKSTYLE:ON: checkstyle:parameterNumber /* diff --git a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/CreatePolicyStateTaskRefBuilder.java b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/CreatePolicyStateTaskRefBuilder.java new file mode 100644 index 000000000..d313c9d24 --- /dev/null +++ b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/CreatePolicyStateTaskRefBuilder.java @@ -0,0 +1,104 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Samsung Electronics Co., Ltd. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.apex.model.modelapi.impl; + +public class CreatePolicyStateTaskRefBuilder { + private String name; + private String version; + private String stateName; + private String taskLocalName; + private String taskName; + private String taskVersion; + private String outputType; + private String outputName; + + public String getName() { + return name; + } + + public String getVersion() { + return version; + } + + public String getStateName() { + return stateName; + } + + public String getTaskLocalName() { + return taskLocalName; + } + + public String getTaskName() { + return taskName; + } + + public String getTaskVersion() { + return taskVersion; + } + + public String getOutputType() { + return outputType; + } + + public String getOutputName() { + return outputName; + } + + public CreatePolicyStateTaskRefBuilder setName(String name) { + this.name = name; + return this; + } + + public CreatePolicyStateTaskRefBuilder setVersion(String version) { + this.version = version; + return this; + } + + public CreatePolicyStateTaskRefBuilder setStateName(String stateName) { + this.stateName = stateName; + return this; + } + + public CreatePolicyStateTaskRefBuilder setTaskLocalName(String taskLocalName) { + this.taskLocalName = taskLocalName; + return this; + } + + public CreatePolicyStateTaskRefBuilder setTaskName(String taskName) { + this.taskName = taskName; + return this; + } + + public CreatePolicyStateTaskRefBuilder setTaskVersion(String taskVersion) { + this.taskVersion = taskVersion; + return this; + } + + public CreatePolicyStateTaskRefBuilder setOutputType(String outputType) { + this.outputType = outputType; + return this; + } + + public CreatePolicyStateTaskRefBuilder setOutputName(String outputName) { + this.outputName = outputName; + return this; + } +} diff --git a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/PolicyFacade.java b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/PolicyFacade.java index 1d07b2e8c..d43ef3bd0 100644 --- a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/PolicyFacade.java +++ b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/PolicyFacade.java @@ -1010,85 +1010,91 @@ public class PolicyFacade { } } - /** - * Create a policy state task reference. - * - * @param name name of the policy - * @param version version of the policy, set to null to use the latest version - * @param stateName of the state - * @param taskLocalName the task local name - * @param taskName name of the task - * @param taskVersion version of the task, set to null to use the latest version - * @param outputType Type of output for the task, must be DIRECT for direct output to a state - * output or LOGIC for output to state finalizer logic - * @param outputName the name of the state output or state state finalizer logic to handle the - * task output - * @return result of the operation - */ - // CHECKSTYLE:OFF: checkstyle:parameterNumber - public ApexApiResult createPolicyStateTaskRef(final String name, final String version, final String stateName, - final String taskLocalName, final String taskName, final String taskVersion, final String outputType, - final String outputName) { - try { - Assertions.argumentNotNull(stateName, STATE_NAME_MAY_NOT_BE_NULL); - Assertions.argumentNotNull(outputName, "outputName may not be null"); - - final AxPolicy policy = apexModel.getPolicyModel().getPolicies().get(name, version); - if (policy == null) { - return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, - CONCEPT + name + ':' + version + DOES_NOT_EXIST); - } - - final AxState state = policy.getStateMap().get(stateName); - if (state == null) { - return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, - CONCEPT + policy.getKey().getId() + ':' + stateName + DOES_NOT_EXIST); - } - - final AxTask task = apexModel.getPolicyModel().getTasks().get(taskName, taskVersion); - if (task == null) { - return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, - CONCEPT + taskName + ':' + taskVersion + DOES_NOT_EXIST); - } - - if (state.getTaskReferences().containsKey(task.getKey())) { - return new ApexApiResult(ApexApiResult.Result.CONCEPT_EXISTS, "task " + task.getKey().getId() - + " already has reference with output " + state.getTaskReferences().get(task.getKey())); - } - - AxReferenceKey refKey; - if (taskLocalName == null) { - refKey = new AxReferenceKey(state.getKey(), state.getKey().getParentKeyName()); - } else { - refKey = new AxReferenceKey(state.getKey(), taskLocalName); - } - - // The reference to the output we're using here - final AxReferenceKey outputRefKey = new AxReferenceKey(state.getKey(), outputName); - - final AxStateTaskOutputType stateTaskOutputType = AxStateTaskOutputType.valueOf(outputType); - if (stateTaskOutputType.equals(AxStateTaskOutputType.DIRECT)) { - if (!state.getStateOutputs().containsKey(outputRefKey.getLocalName())) { - return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, - "state output concept " + outputRefKey.getId() + DOES_NOT_EXIST); - } - } else if (stateTaskOutputType.equals(AxStateTaskOutputType.LOGIC)) { - if (!state.getStateFinalizerLogicMap().containsKey(outputRefKey.getLocalName())) { - return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, - "state finalizer logic concept " + outputRefKey.getId() + DOES_NOT_EXIST); - } - } else { - return new ApexApiResult(ApexApiResult.Result.FAILED, "output type " + outputType + " invalid"); - } - - state.getTaskReferences().put(task.getKey(), - new AxStateTaskReference(refKey, stateTaskOutputType, outputRefKey)); - return new ApexApiResult(); - } catch (final Exception e) { - return new ApexApiResult(ApexApiResult.Result.FAILED, e); + /** + * Create a policy state task reference. + * + * @param CreatePolicyStateTaskRefBuilder + + * @return result of the operation + */ + public ApexApiResult createPolicyStateTaskRef(CreatePolicyStateTaskRefBuilder builder) { + try { + Assertions.argumentNotNull(builder.getStateName(), STATE_NAME_MAY_NOT_BE_NULL); + Assertions.argumentNotNull(builder.getOutputName(), "outputName may not be null"); + + final AxPolicy policy = + apexModel.getPolicyModel().getPolicies().get(builder.getName(), builder.getVersion()); + if (policy == null) { + return new ApexApiResult( + ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, + CONCEPT + builder.getName() + ':' + builder.getVersion() + DOES_NOT_EXIST); + } + + final AxState state = policy.getStateMap().get(builder.getStateName()); + if (state == null) { + return new ApexApiResult( + ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, + CONCEPT + policy.getKey().getId() + ':' + builder.getStateName() + DOES_NOT_EXIST); + } + + final AxTask task = + apexModel + .getPolicyModel() + .getTasks() + .get(builder.getTaskName(), builder.getTaskVersion()); + if (task == null) { + return new ApexApiResult( + ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, + CONCEPT + builder.getTaskName() + ':' + builder.getTaskVersion() + DOES_NOT_EXIST); + } + + if (state.getTaskReferences().containsKey(task.getKey())) { + return new ApexApiResult( + ApexApiResult.Result.CONCEPT_EXISTS, + "task " + + task.getKey().getId() + + " already has reference with output " + + state.getTaskReferences().get(task.getKey())); + } + + AxReferenceKey refKey; + if (builder.getTaskLocalName() == null) { + refKey = new AxReferenceKey(state.getKey(), state.getKey().getParentKeyName()); + } else { + refKey = new AxReferenceKey(state.getKey(), builder.getTaskLocalName()); + } + + // The reference to the output we're using here + final AxReferenceKey outputRefKey = + new AxReferenceKey(state.getKey(), builder.getOutputName()); + + final AxStateTaskOutputType stateTaskOutputType = + AxStateTaskOutputType.valueOf(builder.getOutputType()); + if (stateTaskOutputType.equals(AxStateTaskOutputType.DIRECT)) { + if (!state.getStateOutputs().containsKey(outputRefKey.getLocalName())) { + return new ApexApiResult( + ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, + "state output concept " + outputRefKey.getId() + DOES_NOT_EXIST); } + } else if (stateTaskOutputType.equals(AxStateTaskOutputType.LOGIC)) { + if (!state.getStateFinalizerLogicMap().containsKey(outputRefKey.getLocalName())) { + return new ApexApiResult( + ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, + "state finalizer logic concept " + outputRefKey.getId() + DOES_NOT_EXIST); + } + } else { + return new ApexApiResult( + ApexApiResult.Result.FAILED, "output type " + builder.getOutputType() + " invalid"); + } + + state + .getTaskReferences() + .put(task.getKey(), new AxStateTaskReference(refKey, stateTaskOutputType, outputRefKey)); + return new ApexApiResult(); + } catch (final Exception e) { + return new ApexApiResult(ApexApiResult.Result.FAILED, e); + } } - // CHECKSTYLE:ON: checkstyle:parameterNumber /** * List policy state task references. diff --git a/plugins/plugins-context/plugins-context-locking/plugins-context-locking-curator/pom.xml b/plugins/plugins-context/plugins-context-locking/plugins-context-locking-curator/pom.xml index 2dcdcf8de..8424969d7 100644 --- a/plugins/plugins-context/plugins-context-locking/plugins-context-locking-curator/pom.xml +++ b/plugins/plugins-context/plugins-context-locking/plugins-context-locking-curator/pom.xml @@ -1,6 +1,7 @@ <!-- ============LICENSE_START======================================================= Copyright (C) 2018 Ericsson. All rights reserved. + Modifications Copyright (C) 2019 Nordix Foundation. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -47,11 +48,11 @@ <artifactId>curator-recipes</artifactId> <version>4.0.1</version> </dependency> - <!-- The latest Zookeeper version fixes the vulnerabilities --> + <!-- This Zookeeper version fixes the vulnerabilities --> <dependency> <groupId>org.apache.zookeeper</groupId> <artifactId>zookeeper</artifactId> - <version>3.5.4-beta</version> + <version>3.4.13</version> <exclusions> <!-- Zookeeper uses an ancient version of log4j --> <exclusion> diff --git a/plugins/plugins-context/plugins-context-locking/plugins-context-locking-curator/src/main/java/org/onap/policy/apex/plugins/context/locking/curator/CuratorLockManager.java b/plugins/plugins-context/plugins-context-locking/plugins-context-locking-curator/src/main/java/org/onap/policy/apex/plugins/context/locking/curator/CuratorLockManager.java index bc8ce9055..ce727b8bf 100644 --- a/plugins/plugins-context/plugins-context-locking/plugins-context-locking-curator/src/main/java/org/onap/policy/apex/plugins/context/locking/curator/CuratorLockManager.java +++ b/plugins/plugins-context/plugins-context-locking/plugins-context-locking-curator/src/main/java/org/onap/policy/apex/plugins/context/locking/curator/CuratorLockManager.java @@ -1,19 +1,20 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ @@ -32,6 +33,8 @@ import org.apache.curator.utils.CloseableUtils; import org.apache.zookeeper.CreateMode; import org.onap.policy.apex.context.ContextException; import org.onap.policy.apex.context.impl.locking.AbstractLockManager; +import org.onap.policy.apex.context.parameters.ContextParameterConstants; +import org.onap.policy.apex.context.parameters.LockManagerParameters; import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; import org.onap.policy.common.parameters.ParameterService; import org.slf4j.ext.XLogger; @@ -75,11 +78,19 @@ public class CuratorLockManager extends AbstractLockManager { super.init(key); // Get the lock manager parameters - final CuratorLockManagerParameters lockParameters = ParameterService - .get(CuratorLockManagerParameters.class.getSimpleName()); + final LockManagerParameters lockParameters = ParameterService.get(ContextParameterConstants.LOCKING_GROUP_NAME); + + if (!(lockParameters instanceof CuratorLockManagerParameters)) { + String message = "could not set up Curator locking, " + + "curator lock manager parameters are not set"; + LOGGER.warn(message); + throw new ContextException(message); + } + + final CuratorLockManagerParameters curatorLockPars = (CuratorLockManagerParameters)lockParameters; // Check if the curator address has been set - curatorZookeeperAddress = lockParameters.getZookeeperAddress(); + curatorZookeeperAddress = curatorLockPars.getZookeeperAddress(); if (curatorZookeeperAddress == null || curatorZookeeperAddress.trim().length() == 0) { String message = "could not set up Curator locking, " + "check if the curator Zookeeper address parameter is set correctly"; @@ -89,8 +100,8 @@ public class CuratorLockManager extends AbstractLockManager { // Set up the curator framework we'll use curatorFramework = CuratorFrameworkFactory.builder().connectString(curatorZookeeperAddress) - .retryPolicy(new ExponentialBackoffRetry(lockParameters.getZookeeperConnectSleepTime(), - lockParameters.getZookeeperContextRetries())) + .retryPolicy(new ExponentialBackoffRetry(curatorLockPars.getZookeeperConnectSleepTime(), + curatorLockPars.getZookeeperContextRetries())) .build(); // Listen for changes on the Curator connection @@ -102,8 +113,8 @@ public class CuratorLockManager extends AbstractLockManager { // Wait for the connection to be made try { curatorFramework.blockUntilConnected( - lockParameters.getZookeeperConnectSleepTime() * lockParameters.getZookeeperContextRetries(), - TimeUnit.MILLISECONDS); + curatorLockPars.getZookeeperConnectSleepTime() * curatorLockPars.getZookeeperContextRetries(), + TimeUnit.MILLISECONDS); } catch (final InterruptedException e) { // restore the interrupt status Thread.currentThread().interrupt(); @@ -123,7 +134,7 @@ public class CuratorLockManager extends AbstractLockManager { // We'll use Ephemeral nodes for locks on the Zookeeper server curatorFramework.create().withMode(CreateMode.EPHEMERAL_SEQUENTIAL); - LOGGER.exit("init(" + key + "," + lockParameters + ")"); + LOGGER.exit("init(" + key + "," + curatorLockPars + ")"); } /* diff --git a/plugins/plugins-context/plugins-context-locking/plugins-context-locking-curator/src/main/java/org/onap/policy/apex/plugins/context/locking/curator/CuratorLockManagerParameters.java b/plugins/plugins-context/plugins-context-locking/plugins-context-locking-curator/src/main/java/org/onap/policy/apex/plugins/context/locking/curator/CuratorLockManagerParameters.java index ac936d436..39972a7f1 100644 --- a/plugins/plugins-context/plugins-context-locking/plugins-context-locking-curator/src/main/java/org/onap/policy/apex/plugins/context/locking/curator/CuratorLockManagerParameters.java +++ b/plugins/plugins-context/plugins-context-locking/plugins-context-locking-curator/src/main/java/org/onap/policy/apex/plugins/context/locking/curator/CuratorLockManagerParameters.java @@ -1,19 +1,20 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ @@ -30,7 +31,7 @@ import org.onap.policy.apex.context.parameters.LockManagerParameters; public class CuratorLockManagerParameters extends LockManagerParameters { // @formatter:off /** The default address used to connect to the Zookeeper server. */ - public static final String DEFAULT_ZOOKEEPER_ADDRESS = "localhost:2181"; + public static final String DEFAULT_ZOOKEEPER_ADDRESS = "localhost:2181"; /** The default sleep time to use when connecting to the Zookeeper server. */ public static final int DEFAULT_ZOOKEEPER_CONNECT_SLEEP_TIME = 1000; diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/test/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsConsumerTest.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/test/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsConsumerTest.java new file mode 100644 index 000000000..4c10cefe9 --- /dev/null +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/test/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsConsumerTest.java @@ -0,0 +1,111 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Samsung. 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.plugins.event.carrier.jms; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; + +import javax.jms.Message; +import javax.jms.Session; +import org.junit.Before; +import org.junit.Test; +import org.onap.policy.apex.service.engine.event.ApexEventException; +import org.onap.policy.apex.service.engine.event.ApexEventProducer; +import org.onap.policy.apex.service.engine.event.ApexEventReceiver; +import org.onap.policy.apex.service.engine.event.ApexEventRuntimeException; +import org.onap.policy.apex.service.engine.event.PeeredReference; +import org.onap.policy.apex.service.parameters.carriertechnology.CarrierTechnologyParameters; +import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters; +import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerPeeredMode; + +public class ApexJmsConsumerTest { + + ApexJmsConsumer apexJmsConsumer = null; + EventHandlerParameters consumerParameters = null; + ApexEventReceiver incomingEventReceiver = null; + ApexEventProducer apexJmsProducer = null; + Session jmsSession = null; + JmsCarrierTechnologyParameters jmsCarrierTechnologyParameters = null; + + /** + * Set up testing. + * + * @throws Exception on test set up errors. + */ + @Before + public void setUp() throws Exception { + apexJmsConsumer = new ApexJmsConsumer(); + consumerParameters = new EventHandlerParameters(); + apexJmsProducer = new ApexJmsProducer(); + } + + @Test(expected = ApexEventException.class) + public void testInitWithNonJmsCarrierTechnologyParameters() throws ApexEventException { + consumerParameters.setCarrierTechnologyParameters(new CarrierTechnologyParameters() {}); + apexJmsConsumer.init("TestApexJmsConsumer", consumerParameters, incomingEventReceiver); + } + + @Test(expected = ApexEventException.class) + public void testInitWithJmsCarrierTechnologyParameters() throws ApexEventException { + jmsCarrierTechnologyParameters = new JmsCarrierTechnologyParameters(); + consumerParameters.setCarrierTechnologyParameters(jmsCarrierTechnologyParameters); + apexJmsConsumer.init("TestApexJmsConsumer", consumerParameters, incomingEventReceiver); + } + + @Test + public void testStart() { + apexJmsConsumer.start(); + } + + @Test + public void testGetName() { + assertNull(apexJmsConsumer.getName()); + } + + @Test + public void testGetPeeredReference() { + assertNull(apexJmsConsumer.getPeeredReference(EventHandlerPeeredMode.REQUESTOR)); + } + + @Test + public void testSetPeeredReference() { + PeeredReference peeredReference = new PeeredReference(EventHandlerPeeredMode.REQUESTOR, + apexJmsConsumer, apexJmsProducer); + apexJmsConsumer.setPeeredReference(EventHandlerPeeredMode.REQUESTOR, peeredReference); + assertNotNull(apexJmsConsumer.getPeeredReference(EventHandlerPeeredMode.REQUESTOR)); + } + + @Test(expected = ApexEventRuntimeException.class) + public void testRun() { + apexJmsConsumer.run(); + + } + + @Test(expected = ApexEventRuntimeException.class) + public void testOnMessage() { + Message jmsMessage = null; + apexJmsConsumer.onMessage(jmsMessage); + } + + @Test(expected = NullPointerException.class) + public void testStop() { + apexJmsConsumer.stop(); + } +} diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/test/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsProducerTest.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/test/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsProducerTest.java new file mode 100644 index 000000000..4773296d9 --- /dev/null +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/test/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsProducerTest.java @@ -0,0 +1,119 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Samsung. 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.plugins.event.carrier.jms; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; + +import javax.jms.Session; +import org.junit.Before; +import org.junit.Test; +import org.onap.policy.apex.service.engine.event.ApexEvent; +import org.onap.policy.apex.service.engine.event.ApexEventException; +import org.onap.policy.apex.service.engine.event.ApexEventProducer; +import org.onap.policy.apex.service.engine.event.ApexEventReceiver; +import org.onap.policy.apex.service.engine.event.ApexEventRuntimeException; +import org.onap.policy.apex.service.engine.event.PeeredReference; +import org.onap.policy.apex.service.engine.event.SynchronousEventCache; +import org.onap.policy.apex.service.parameters.carriertechnology.CarrierTechnologyParameters; +import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters; +import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerPeeredMode; + +public class ApexJmsProducerTest { + + ApexJmsConsumer apexJmsConsumer = null; + EventHandlerParameters producerParameters = null; + ApexEventReceiver incomingEventReceiver = null; + ApexEventProducer apexJmsProducer = null; + Session jmsSession = null; + JmsCarrierTechnologyParameters jmsCarrierTechnologyParameters = null; + SynchronousEventCache synchronousEventCache = null; + private static final long DEFAULT_SYNCHRONOUS_EVENT_TIMEOUT = 1000; + + /** + * Set up testing. + * + * @throws Exception on test set up errors. + */ + @Before + public void setUp() throws Exception { + apexJmsConsumer = new ApexJmsConsumer(); + producerParameters = new EventHandlerParameters(); + apexJmsProducer = new ApexJmsProducer(); + } + + @Test(expected = ApexEventException.class) + public void testInitWithNonJmsCarrierTechnologyParameters() throws ApexEventException { + producerParameters.setCarrierTechnologyParameters(new CarrierTechnologyParameters() {}); + apexJmsProducer.init("TestApexJmsProducer", producerParameters); + } + + @Test(expected = ApexEventException.class) + public void testInitWithJmsCarrierTechnologyParameters() throws ApexEventException { + jmsCarrierTechnologyParameters = new JmsCarrierTechnologyParameters(); + producerParameters.setCarrierTechnologyParameters(jmsCarrierTechnologyParameters); + apexJmsProducer.init("TestApexJmsProducer", producerParameters); + } + + @Test + public void testGetName() { + assertNull(apexJmsProducer.getName()); + } + + @Test + public void testGetPeeredReference() { + assertNull(apexJmsProducer.getPeeredReference(EventHandlerPeeredMode.REQUESTOR)); + } + + @Test + public void testSetPeeredReference() { + PeeredReference peeredReference = new PeeredReference(EventHandlerPeeredMode.REQUESTOR, + apexJmsConsumer, apexJmsProducer); + apexJmsProducer.setPeeredReference(EventHandlerPeeredMode.REQUESTOR, peeredReference); + assertNotNull(apexJmsProducer.getPeeredReference(EventHandlerPeeredMode.REQUESTOR)); + } + + @Test(expected = NullPointerException.class) + public void testSendEvent() throws ApexEventException { + producerParameters.setCarrierTechnologyParameters(new JmsCarrierTechnologyParameters() {}); + synchronousEventCache = new SynchronousEventCache(EventHandlerPeeredMode.SYNCHRONOUS, + apexJmsConsumer, apexJmsProducer, DEFAULT_SYNCHRONOUS_EVENT_TIMEOUT); + apexJmsProducer.setPeeredReference(EventHandlerPeeredMode.SYNCHRONOUS, + synchronousEventCache); + ApexEvent apexEvent = new ApexEvent("testEvent", "testVersion", "testNameSpace", + "testSource", "testTarget"); + apexJmsProducer.sendEvent(1000L, "TestApexJmsProducer", apexEvent); + } + + @Test(expected = ApexEventRuntimeException.class) + public void testSendEventWithNonSerializableObject() throws ApexEventException { + producerParameters.setCarrierTechnologyParameters(new JmsCarrierTechnologyParameters() {}); + synchronousEventCache = new SynchronousEventCache(EventHandlerPeeredMode.SYNCHRONOUS, + apexJmsConsumer, apexJmsProducer, DEFAULT_SYNCHRONOUS_EVENT_TIMEOUT); + apexJmsProducer.setPeeredReference(EventHandlerPeeredMode.SYNCHRONOUS, + synchronousEventCache); + apexJmsProducer.sendEvent(-1L, "TestApexJmsProducer", new ApexJmsProducerTest()); + } + + @Test + public void testStop() { + apexJmsProducer.stop(); + } +} diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/test/java/org/onap/policy/apex/plugins/event/carrier/jms/JmsCarrierTechnologyParametersTest.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/test/java/org/onap/policy/apex/plugins/event/carrier/jms/JmsCarrierTechnologyParametersTest.java new file mode 100644 index 000000000..32d712411 --- /dev/null +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/test/java/org/onap/policy/apex/plugins/event/carrier/jms/JmsCarrierTechnologyParametersTest.java @@ -0,0 +1,216 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Samsung. 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.plugins.event.carrier.jms; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.util.Base64; +import java.util.Properties; +import org.junit.Before; +import org.junit.Test; +import org.onap.policy.common.parameters.GroupValidationResult; +import org.onap.policy.common.parameters.ParameterRuntimeException; + +public class JmsCarrierTechnologyParametersTest { + + JmsCarrierTechnologyParameters jmsCarrierTechnologyParameters = null; + Properties jmsProducerProperties = null; + Properties jmsConsumerProperties = null; + GroupValidationResult result = null; + + public static final String JMS_CARRIER_TECHNOLOGY_LABEL = "JMS"; + + public static final String JMS_EVENT_PRODUCER_PLUGIN_CLASS = + ApexJmsProducer.class.getCanonicalName(); + + public static final String JMS_EVENT_CONSUMER_PLUGIN_CLASS = + ApexJmsConsumer.class.getCanonicalName(); + + private static final String DEFAULT_CONNECTION_FACTORY = "jms/RemoteConnectionFactory"; + private static final String DEFAULT_INITIAL_CTXT_FACTORY = + "org.jboss.naming.remote.client.InitialContextFactory"; + private static final String DEFAULT_PROVIDER_URL = "remote://localhost:4447"; + private static final String DEFAULT_SECURITY_PRINCIPAL = "userid"; + private static final String DEFAULT_SECURITY_CREDENTIALS = "cGFzc3dvcmQ="; + private static final String DEFAULT_CONSUMER_TOPIC = "apex-in"; + private static final String DEFAULT_PRODUCER_TOPIC = "apex-out"; + private static final int DEFAULT_CONSUMER_WAIT_TIME = 100; + private static final boolean DEFAULT_TO_OBJECT_MSG_SENDING = true; + + /** + * Set up testing. + * + * @throws Exception on test set up errors. + */ + @Before + public void setUp() throws Exception { + jmsCarrierTechnologyParameters = new JmsCarrierTechnologyParameters(); + } + + @Test + public void testValidate() { + result = jmsCarrierTechnologyParameters.validate(); + assertNotNull(result); + assertTrue(result.getStatus().isValid()); + } + + @Test + public void testJmsCarrierTechnologyParameters() { + assertNotNull(jmsCarrierTechnologyParameters); + } + + @Test + public void testGetJmsProducerProperties() { + assertNotNull(jmsCarrierTechnologyParameters.getJmsConsumerProperties()); + } + + @Test + public void testGetJmsConsumerProperties() { + assertNotNull(jmsCarrierTechnologyParameters.getJmsProducerProperties()); + } + + @Test + public void testEqualityOfJmsConsumerAndProducerProperties() { + assertEquals(jmsCarrierTechnologyParameters.getJmsProducerProperties(), + jmsCarrierTechnologyParameters.getJmsConsumerProperties()); + } + + @Test + public void testGetConnectionFactory() { + assertEquals(DEFAULT_CONNECTION_FACTORY, + jmsCarrierTechnologyParameters.getConnectionFactory()); + } + + @Test + public void testSetConnectionFactory() { + jmsCarrierTechnologyParameters.setConnectionFactory("QueueConnectionFactory"); + assertNotEquals(DEFAULT_CONNECTION_FACTORY, + jmsCarrierTechnologyParameters.getConnectionFactory()); + } + + @Test + public void testSetConsumerTopic() { + assertEquals(DEFAULT_CONSUMER_TOPIC, jmsCarrierTechnologyParameters.getConsumerTopic()); + jmsCarrierTechnologyParameters.setConsumerTopic(null); + result = jmsCarrierTechnologyParameters.validate(); + assertFalse(result.getStatus().isValid()); + } + + @Test + public void testSetConsumerWaitTime() { + assertEquals(DEFAULT_CONSUMER_WAIT_TIME, + jmsCarrierTechnologyParameters.getConsumerWaitTime()); + jmsCarrierTechnologyParameters.setConsumerWaitTime(-1); + assertNotEquals(DEFAULT_CONSUMER_WAIT_TIME, + jmsCarrierTechnologyParameters.getConsumerWaitTime()); + } + + @Test + public void testSetEventConsumerPluginClass() { + assertEquals(JMS_EVENT_CONSUMER_PLUGIN_CLASS, + jmsCarrierTechnologyParameters.getEventConsumerPluginClass()); + jmsCarrierTechnologyParameters.setEventConsumerPluginClass("TestEventConsumerPluginClass"); + assertNotEquals(JMS_EVENT_CONSUMER_PLUGIN_CLASS, + jmsCarrierTechnologyParameters.getEventConsumerPluginClass()); + } + + @Test + public void testSetEventProducerPluginClass() { + assertEquals(JMS_EVENT_PRODUCER_PLUGIN_CLASS, + jmsCarrierTechnologyParameters.getEventProducerPluginClass()); + jmsCarrierTechnologyParameters.setEventProducerPluginClass("TestEventProducerPluginClass"); + assertNotEquals(JMS_EVENT_PRODUCER_PLUGIN_CLASS, + jmsCarrierTechnologyParameters.getEventProducerPluginClass()); + } + + @Test + public void testSetLabel() { + assertEquals(JMS_CARRIER_TECHNOLOGY_LABEL, jmsCarrierTechnologyParameters.getLabel()); + jmsCarrierTechnologyParameters.setLabel("TestLable"); + assertNotEquals(JMS_CARRIER_TECHNOLOGY_LABEL, jmsCarrierTechnologyParameters.getLabel()); + + } + + @Test + public void testSetObjectMessageSending() { + assertTrue(jmsCarrierTechnologyParameters.isObjectMessageSending()); + jmsCarrierTechnologyParameters.setObjectMessageSending(!DEFAULT_TO_OBJECT_MSG_SENDING); + assertFalse(jmsCarrierTechnologyParameters.isObjectMessageSending()); + } + + @Test + public void testSetProducerTopic() { + assertEquals(DEFAULT_PRODUCER_TOPIC, jmsCarrierTechnologyParameters.getProducerTopic()); + jmsCarrierTechnologyParameters.setProducerTopic(""); + result = jmsCarrierTechnologyParameters.validate(); + assertFalse(result.getStatus().isValid()); + } + + @Test + public void testSetProviderUrl() { + assertEquals(DEFAULT_PROVIDER_URL, jmsCarrierTechnologyParameters.getProviderUrl()); + jmsCarrierTechnologyParameters.setProviderUrl(null); + result = jmsCarrierTechnologyParameters.validate(); + assertFalse(result.getStatus().isValid()); + } + + @Test + public void testSetSecurityCredentials() { + assertEquals( + new String(Base64.getDecoder().decode(DEFAULT_SECURITY_CREDENTIALS.getBytes())), + jmsCarrierTechnologyParameters.getSecurityCredentials()); + jmsCarrierTechnologyParameters.setSecurityCredentials(""); + result = jmsCarrierTechnologyParameters.validate(); + assertFalse(result.getStatus().isValid()); + } + + @Test + public void testSetSecurityPrincipal() { + assertEquals(DEFAULT_SECURITY_PRINCIPAL, + jmsCarrierTechnologyParameters.getSecurityPrincipal()); + jmsCarrierTechnologyParameters.setSecurityPrincipal(null); + result = jmsCarrierTechnologyParameters.validate(); + assertFalse(result.getStatus().isValid()); + } + + @Test + public void testSetInitialContextFactory() { + + assertEquals(DEFAULT_INITIAL_CTXT_FACTORY, + jmsCarrierTechnologyParameters.getInitialContextFactory()); + + jmsCarrierTechnologyParameters.setInitialContextFactory(null); + result = jmsCarrierTechnologyParameters.validate(); + assertFalse(result.getStatus().isValid()); + + jmsCarrierTechnologyParameters.setInitialContextFactory("TestInitialContextFactory"); + assertNotEquals(DEFAULT_INITIAL_CTXT_FACTORY, + jmsCarrierTechnologyParameters.getInitialContextFactory()); + } + + @Test(expected = ParameterRuntimeException.class) + public void testSetName() { + jmsCarrierTechnologyParameters.setName("TestName"); + } +} diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src/test/java/org/onap/policy/apex/plugins/event/carrier/kafka/ApexKafkaConsumerTest.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src/test/java/org/onap/policy/apex/plugins/event/carrier/kafka/ApexKafkaConsumerTest.java new file mode 100644 index 000000000..bbebbc3b8 --- /dev/null +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src/test/java/org/onap/policy/apex/plugins/event/carrier/kafka/ApexKafkaConsumerTest.java @@ -0,0 +1,97 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Samsung. 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.plugins.event.carrier.kafka; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; + +import org.junit.Before; +import org.junit.Test; +import org.onap.policy.apex.service.engine.event.ApexEventException; +import org.onap.policy.apex.service.engine.event.ApexEventProducer; +import org.onap.policy.apex.service.engine.event.ApexEventReceiver; +import org.onap.policy.apex.service.engine.event.PeeredReference; +import org.onap.policy.apex.service.parameters.carriertechnology.CarrierTechnologyParameters; +import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters; +import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerPeeredMode; + +public class ApexKafkaConsumerTest { + ApexKafkaConsumer apexKafkaConsumer = null; + EventHandlerParameters consumerParameters = null; + ApexEventReceiver incomingEventReceiver = null; + ApexEventProducer apexKafkaProducer = null; + + /** + * Set up testing. + * + * @throws ApexEventException on test set up errors. + */ + @Before + public void setUp() throws ApexEventException { + apexKafkaConsumer = new ApexKafkaConsumer(); + consumerParameters = new EventHandlerParameters(); + apexKafkaProducer = new ApexKafkaProducer(); + consumerParameters + .setCarrierTechnologyParameters(new KafkaCarrierTechnologyParameters() {}); + apexKafkaConsumer.init("TestApexKafkaConsumer", consumerParameters, incomingEventReceiver); + } + + @Test + public void testStart() { + apexKafkaConsumer.start(); + } + + @Test + public void testGetName() { + assertEquals("TestApexKafkaConsumer", apexKafkaConsumer.getName()); + } + + @Test + public void testGetPeeredReference() { + assertNull(apexKafkaConsumer.getPeeredReference(EventHandlerPeeredMode.REQUESTOR)); + } + + @Test + public void testSetPeeredReference() { + PeeredReference peeredReference = new PeeredReference(EventHandlerPeeredMode.REQUESTOR, + apexKafkaConsumer, apexKafkaProducer); + apexKafkaConsumer.setPeeredReference(EventHandlerPeeredMode.REQUESTOR, peeredReference); + assertNotNull(apexKafkaConsumer.getPeeredReference(EventHandlerPeeredMode.REQUESTOR)); + } + + @Test(expected = java.lang.NullPointerException.class) + public void testRun() { + apexKafkaConsumer.run(); + } + + @Test(expected = java.lang.NullPointerException.class) + public void testStop() { + apexKafkaConsumer.stop(); + } + + @Test(expected = ApexEventException.class) + public void testInitWithNonKafkaCarrierTechnologyParameters() throws ApexEventException { + consumerParameters.setCarrierTechnologyParameters(new CarrierTechnologyParameters() {}); + apexKafkaConsumer.init("TestApexKafkaConsumer", consumerParameters, incomingEventReceiver); + } + +} diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src/test/java/org/onap/policy/apex/plugins/event/carrier/kafka/ApexKafkaProducerTest.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src/test/java/org/onap/policy/apex/plugins/event/carrier/kafka/ApexKafkaProducerTest.java new file mode 100644 index 000000000..7300474c7 --- /dev/null +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src/test/java/org/onap/policy/apex/plugins/event/carrier/kafka/ApexKafkaProducerTest.java @@ -0,0 +1,83 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Samsung. 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.plugins.event.carrier.kafka; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; + +import org.junit.Before; +import org.junit.Test; +import org.onap.policy.apex.service.engine.event.ApexEventException; +import org.onap.policy.apex.service.engine.event.PeeredReference; +import org.onap.policy.apex.service.engine.event.SynchronousEventCache; +import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters; +import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerPeeredMode; + +public class ApexKafkaProducerTest { + ApexKafkaProducer apexKafkaProducer = null; + ApexKafkaConsumer apexKafkaConsumer = null; + EventHandlerParameters producerParameters = null; + PeeredReference peeredReference = null; + SynchronousEventCache synchronousEventCache = null; + private static final long DEFAULT_SYNCHRONOUS_EVENT_TIMEOUT = 1000; + + /** + * Set up testing. + */ + @Before + public void setUp() throws Exception { + apexKafkaProducer = new ApexKafkaProducer(); + apexKafkaConsumer = new ApexKafkaConsumer(); + producerParameters = new EventHandlerParameters(); + + } + + @Test(expected = ApexEventException.class) + public void testInit() throws ApexEventException { + apexKafkaProducer.init("TestApexKafkaProducer", producerParameters); + } + + @Test + public void testGetName() { + assertNull(apexKafkaProducer.getName()); + } + + @Test + public void testGetPeeredReference() { + assertNull(apexKafkaProducer.getPeeredReference(EventHandlerPeeredMode.SYNCHRONOUS)); + } + + @Test + public void testWithProperValues() throws ApexEventException { + producerParameters + .setCarrierTechnologyParameters(new KafkaCarrierTechnologyParameters() {}); + synchronousEventCache = new SynchronousEventCache(EventHandlerPeeredMode.SYNCHRONOUS, + apexKafkaConsumer, apexKafkaProducer, DEFAULT_SYNCHRONOUS_EVENT_TIMEOUT); + apexKafkaProducer.setPeeredReference(EventHandlerPeeredMode.SYNCHRONOUS, + synchronousEventCache); + apexKafkaProducer.init("TestApexKafkaProducer", producerParameters); + assertEquals("TestApexKafkaProducer", apexKafkaProducer.getName()); + assertNotNull(apexKafkaProducer.getPeeredReference(EventHandlerPeeredMode.SYNCHRONOUS)); + apexKafkaProducer.stop(); + } + +} diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src/test/java/org/onap/policy/apex/plugins/event/carrier/kafka/KafkaCarrierTechnologyParametersTest.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src/test/java/org/onap/policy/apex/plugins/event/carrier/kafka/KafkaCarrierTechnologyParametersTest.java new file mode 100644 index 000000000..6eca1dcf0 --- /dev/null +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src/test/java/org/onap/policy/apex/plugins/event/carrier/kafka/KafkaCarrierTechnologyParametersTest.java @@ -0,0 +1,69 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Samsung. 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.plugins.event.carrier.kafka; + +import static org.junit.Assert.assertNotNull; + +import java.util.Properties; +import org.junit.Before; +import org.junit.Test; +import org.onap.policy.common.parameters.GroupValidationResult; + +public class KafkaCarrierTechnologyParametersTest { + + KafkaCarrierTechnologyParameters kafkaCarrierTechnologyParameters = null; + Properties kafkaProducerProperties = null; + Properties kafkaConsumerProperties = null; + GroupValidationResult result = null; + + /** + * Set up testing. + * + * @throws Exception on setup errors + */ + @Before + public void setUp() throws Exception { + kafkaCarrierTechnologyParameters = new KafkaCarrierTechnologyParameters(); + kafkaProducerProperties = kafkaCarrierTechnologyParameters.getKafkaProducerProperties(); + kafkaConsumerProperties = kafkaCarrierTechnologyParameters.getKafkaConsumerProperties(); + } + + @Test + public void testKafkaCarrierTechnologyParameters() { + assertNotNull(kafkaCarrierTechnologyParameters); + } + + @Test + public void testGetKafkaProducerProperties() { + assertNotNull(kafkaProducerProperties); + } + + @Test + public void testGetKafkaConsumerProperties() { + assertNotNull(kafkaConsumerProperties); + } + + @Test + public void testValidate() { + result = kafkaCarrierTechnologyParameters.validate(); + assertNotNull(result); + } +} diff --git a/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-hibernate/pom.xml b/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-hibernate/pom.xml index 2343a3ab8..ae2def8d2 100644 --- a/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-hibernate/pom.xml +++ b/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-hibernate/pom.xml @@ -1,23 +1,17 @@ -<!-- - ============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========================================================= ---> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<!-- ============LICENSE_START======================================================= + Copyright (C) 2018 Ericsson. All rights reserved. Modifications Copyright + (C) 2019 Nordix Foundation. ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); you may not + use this file except in compliance with the License. You may obtain a copy + of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required + by applicable law or agreed to in writing, software distributed under the + License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS + OF ANY KIND, either express or implied. See the License for the specific + language governing permissions and limitations under the License. SPDX-License-Identifier: + Apache-2.0 ============LICENSE_END========================================================= --> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.onap.policy.apex-pdp.plugins.plugins-persistence.plugins-persistence-jpa</groupId> @@ -72,6 +66,17 @@ <groupId>org.hibernate</groupId> <artifactId>hibernate-c3p0</artifactId> <version>${version.hibernate}</version> + <exclusions> + <exclusion> + <groupId>com.mchange</groupId> + <artifactId>c3p0</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>com.mchange</groupId> + <artifactId>c3p0</artifactId> + <version>0.9.5.3</version> </dependency> </dependencies> @@ -43,7 +43,7 @@ <version.commons-cli>1.4</version.commons-cli> <version.kafka>1.1.1</version.kafka> <version.jersey>2.26</version.jersey> - <version.hibernate>5.3.6.Final</version.hibernate> + <version.hibernate>5.3.7.Final</version.hibernate> <version.policy.common>1.4.0-SNAPSHOT</version.policy.common> <!-- sonar/jacoco overrides --> diff --git a/testsuites/integration/integration-context-test/pom.xml b/testsuites/integration/integration-context-test/pom.xml index 239bc684d..f8a96fd12 100644 --- a/testsuites/integration/integration-context-test/pom.xml +++ b/testsuites/integration/integration-context-test/pom.xml @@ -1,6 +1,7 @@ <!-- ============LICENSE_START======================================================= Copyright (C) 2018 Ericsson. All rights reserved. + Modifications Copyright (C) 2019 Nordix Foundation. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -69,12 +70,6 @@ <artifactId>plugins-context-locking-hazelcast</artifactId> <version>${project.version}</version> </dependency> - <dependency> - <groupId>org.onap.policy.apex-pdp.context</groupId> - <artifactId>context-test-utils</artifactId> - <version>${project.version}</version> - <scope>test</scope> - </dependency> </dependencies> <profiles> diff --git a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/TestConcurrentContext.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/TestConcurrentContext.java index a62414ac6..aa806b5e8 100644 --- a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/TestConcurrentContext.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/TestConcurrentContext.java @@ -1,19 +1,20 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ @@ -24,7 +25,7 @@ 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.parameters.DistributorParameters.DEFAULT_DISTRIBUTOR_PLUGIN_CLASS; -import static org.onap.policy.apex.context.test.utils.Constants.TEST_VALUE; +import static org.onap.policy.apex.testsuites.integration.context.utils.Constants.TEST_VALUE; import java.io.File; import java.io.IOException; @@ -32,22 +33,18 @@ import java.net.InetSocketAddress; import java.util.Map; import java.util.SortedSet; +import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; 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.DistributorParameters; -import org.onap.policy.apex.context.test.concepts.TestContextLongItem; -import org.onap.policy.apex.context.test.lock.modifier.LockType; -import org.onap.policy.apex.context.test.locking.ConcurrentContext; -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.context.test.utils.NetworkUtils; -import org.onap.policy.apex.context.test.utils.ZooKeeperServerServiceProvider; +import org.onap.policy.apex.context.parameters.SchemaParameters; import org.onap.policy.apex.core.infrastructure.messaging.util.MessagingUtils; import org.onap.policy.apex.model.basicmodel.concepts.ApexException; import org.onap.policy.apex.model.basicmodel.handling.ApexModelException; @@ -57,6 +54,14 @@ import org.onap.policy.apex.plugins.context.distribution.infinispan.InfinispanDi import org.onap.policy.apex.plugins.context.locking.curator.CuratorLockManager; import org.onap.policy.apex.plugins.context.locking.curator.CuratorLockManagerParameters; import org.onap.policy.apex.plugins.context.locking.hazelcast.HazelcastLockManager; +import org.onap.policy.apex.testsuites.integration.context.concepts.TestContextLongItem; +import org.onap.policy.apex.testsuites.integration.context.lock.modifier.LockType; +import org.onap.policy.apex.testsuites.integration.context.locking.ConcurrentContext; +import org.onap.policy.apex.testsuites.integration.context.utils.ConfigrationProvider; +import org.onap.policy.apex.testsuites.integration.context.utils.ConfigrationProviderImpl; +import org.onap.policy.apex.testsuites.integration.context.utils.Constants; +import org.onap.policy.apex.testsuites.integration.context.utils.NetworkUtils; +import org.onap.policy.apex.testsuites.integration.context.utils.ZooKeeperServerServiceProvider; import org.onap.policy.common.parameters.ParameterService; import org.onap.policy.common.utils.resources.ResourceUtils; import org.slf4j.ext.XLogger; @@ -88,8 +93,11 @@ public class TestConcurrentContext { // We need to increment the Zookeeper port because sometimes the port is not released at the end // of the test for a few seconds. private static int nextZookeeperPort = ZOOKEEPER_START_PORT; + private int zookeeperPort; + private static SchemaParameters schemaParameters; + @Rule public final TemporaryFolder folder = new TemporaryFolder(); @@ -114,6 +122,20 @@ public class TestConcurrentContext { logger.info("For Infinispan, setting jgroups.tcp.address to: {}", ipAddressSet.first()); System.setProperty("jgroups.tcp.address", ipAddressSet.first()); + schemaParameters = new SchemaParameters(); + + schemaParameters.setName(ContextParameterConstants.SCHEMA_GROUP_NAME); + schemaParameters.getSchemaHelperParameterMap().put("JAVA", new JavaSchemaHelperParameters()); + + ParameterService.register(schemaParameters, true); + } + + /** + * Clear configuration. + */ + @AfterClass + public static void clear() { + ParameterService.deregister(schemaParameters); } /** @@ -150,6 +172,7 @@ public class TestConcurrentContext { final ContextParameters contextParameters = new ContextParameters(); contextParameters.getLockManagerParameters().setPluginClass(JvmLocalLockManager.class.getCanonicalName()); + setContextParmetersInParameterService(contextParameters); final ConfigrationProvider configrationProvider = getConfigrationProvider("JVMLocalVarSet", TEST_JVM_COUNT_SINGLE_JVM, TEST_THREAD_COUNT_SINGLE_JVM, TEST_THREAD_LOOPS); @@ -164,6 +187,8 @@ public class TestConcurrentContext { assertNotNull(actual); assertEquals(expected, actual.getLongValue()); + clearContextParmetersInParameterService(contextParameters); + logger.debug("Ran testConcurrentContextJVMLocalVarSet test"); } @@ -176,7 +201,9 @@ public class TestConcurrentContext { public void testConcurrentContextJvmLocalNoVarSet() throws Exception { logger.debug("Running testConcurrentContextJVMLocalNoVarSet test . . ."); - new ContextParameters(); + final ContextParameters contextParameters = new ContextParameters(); + setContextParmetersInParameterService(contextParameters); + final ConfigrationProvider configrationProvider = getConfigrationProvider("JVMLocalNoVarSet", TEST_JVM_COUNT_SINGLE_JVM, TEST_THREAD_COUNT_SINGLE_JVM, TEST_THREAD_LOOPS); @@ -188,6 +215,7 @@ public class TestConcurrentContext { assertNotNull(actual); assertEquals(expected, actual.getLongValue()); + clearContextParmetersInParameterService(contextParameters); logger.debug("Ran testConcurrentContextJVMLocalNoVarSet test"); } @@ -203,6 +231,7 @@ public class TestConcurrentContext { final ContextParameters contextParameters = new ContextParameters(); contextParameters.getDistributorParameters().setPluginClass(JvmLocalDistributor.class.getCanonicalName()); contextParameters.getLockManagerParameters().setPluginClass(JvmLocalLockManager.class.getCanonicalName()); + setContextParmetersInParameterService(contextParameters); final ConfigrationProvider configrationProvider = getConfigrationProvider("testConcurrentContextMultiJVMNoLock", TEST_JVM_COUNT_MULTI_JVM, TEST_THREAD_COUNT_MULTI_JVM, TEST_THREAD_LOOPS); @@ -215,6 +244,7 @@ public class TestConcurrentContext { assertNotNull(actual); assertEquals(0, actual.getLongValue()); + clearContextParmetersInParameterService(contextParameters); logger.debug("Ran testConcurrentContextMultiJVMNoLock test"); } @@ -230,6 +260,7 @@ public class TestConcurrentContext { final ContextParameters contextParameters = new ContextParameters(); contextParameters.getDistributorParameters().setPluginClass(DEFAULT_DISTRIBUTOR_PLUGIN_CLASS); contextParameters.getLockManagerParameters().setPluginClass(HazelcastLockManager.class.getCanonicalName()); + setContextParmetersInParameterService(contextParameters); final ConfigrationProvider configrationProvider = getConfigrationProvider("HazelcastLock", TEST_JVM_COUNT_SINGLE_JVM, TEST_THREAD_COUNT_SINGLE_JVM, TEST_THREAD_LOOPS); @@ -242,6 +273,7 @@ public class TestConcurrentContext { assertNotNull(actual); assertEquals(expected, actual.getLongValue()); + clearContextParmetersInParameterService(contextParameters); logger.debug("Ran testConcurrentContextHazelcastLock test"); } @@ -253,9 +285,9 @@ public class TestConcurrentContext { @Test public void testConcurrentContextCuratorLock() throws Exception { logger.debug("Running testConcurrentContextCuratorLock test . . ."); + final ContextParameters contextParameters = new ContextParameters(); try { startZookeeperServer(); - final ContextParameters contextParameters = new ContextParameters(); final DistributorParameters distributorParameters = contextParameters.getDistributorParameters(); distributorParameters.setPluginClass(DEFAULT_DISTRIBUTOR_PLUGIN_CLASS); @@ -263,7 +295,7 @@ public class TestConcurrentContext { curatorParameters.setPluginClass(CuratorLockManager.class.getCanonicalName()); curatorParameters.setZookeeperAddress(ZOOKEEPER_ADDRESS + ":" + zookeeperPort); contextParameters.setLockManagerParameters(curatorParameters); - ParameterService.register(curatorParameters); + setContextParmetersInParameterService(contextParameters); final ConfigrationProvider configrationProvider = getConfigrationProvider("CuratorLock", TEST_JVM_COUNT_SINGLE_JVM, TEST_THREAD_COUNT_SINGLE_JVM, TEST_THREAD_LOOPS); @@ -278,6 +310,7 @@ public class TestConcurrentContext { logger.debug("Ran testConcurrentContextCuratorLock test"); } finally { stopZookeeperServer(); + clearContextParmetersInParameterService(contextParameters); } } @@ -294,6 +327,7 @@ public class TestConcurrentContext { final DistributorParameters distributorParameters = contextParameters.getDistributorParameters(); distributorParameters.setPluginClass(HazelcastContextDistributor.class.getCanonicalName()); contextParameters.getLockManagerParameters().setPluginClass(HazelcastLockManager.class.getCanonicalName()); + setContextParmetersInParameterService(contextParameters); final ConfigrationProvider configrationProvider = getConfigrationProvider("HazelcastMultiHazelcastlock", TEST_JVM_COUNT_MULTI_JVM, TEST_THREAD_COUNT_MULTI_JVM, TEST_THREAD_LOOPS); @@ -305,6 +339,8 @@ public class TestConcurrentContext { final TestContextLongItem actual = result.get(TEST_VALUE); assertNotNull(actual); assertEquals(expected, actual.getLongValue()); + + clearContextParmetersInParameterService(contextParameters); logger.debug("Ran testConcurrentContextHazelcastMultiJVMHazelcastLock test"); } @@ -326,6 +362,7 @@ public class TestConcurrentContext { infinispanParameters.setConfigFile("infinispan/infinispan-context-test.xml"); contextParameters.setDistributorParameters(infinispanParameters); contextParameters.getLockManagerParameters().setPluginClass(HazelcastLockManager.class.getCanonicalName()); + setContextParmetersInParameterService(contextParameters); final ConfigrationProvider configrationProvider = getConfigrationProvider("InfinispanMultiHazelcastlock", TEST_JVM_COUNT_MULTI_JVM, TEST_THREAD_COUNT_MULTI_JVM, TEST_THREAD_LOOPS); @@ -337,6 +374,8 @@ public class TestConcurrentContext { final TestContextLongItem actual = result.get(TEST_VALUE); assertNotNull(actual); assertEquals(expected, actual.getLongValue()); + + clearContextParmetersInParameterService(contextParameters); logger.debug("Ran testConcurrentContextInfinispanMultiJVMHazelcastlock test"); } @@ -349,10 +388,10 @@ public class TestConcurrentContext { public void testConcurrentContextInfinispanMultiJvmCuratorLock() throws Exception { logger.debug("Running testConcurrentContextInfinispanMultiJVMCuratorLock test . . ."); + final ContextParameters contextParameters = new ContextParameters(); try { startZookeeperServer(); - final ContextParameters contextParameters = new ContextParameters(); final InfinispanDistributorParameters infinispanParameters = new InfinispanDistributorParameters(); infinispanParameters.setPluginClass(InfinispanContextDistributor.class.getCanonicalName()); infinispanParameters.setConfigFile("infinispan/infinispan-context-test.xml"); @@ -362,7 +401,7 @@ public class TestConcurrentContext { curatorParameters.setPluginClass(CuratorLockManager.class.getCanonicalName()); curatorParameters.setZookeeperAddress(ZOOKEEPER_ADDRESS + ":" + zookeeperPort); contextParameters.setLockManagerParameters(curatorParameters); - ParameterService.register(curatorParameters); + setContextParmetersInParameterService(contextParameters); final ConfigrationProvider configrationProvider = getConfigrationProvider("InfinispanMultiCuratorLock", TEST_JVM_COUNT_MULTI_JVM, TEST_THREAD_COUNT_MULTI_JVM, TEST_THREAD_LOOPS); @@ -376,6 +415,7 @@ public class TestConcurrentContext { assertEquals(expected, actual.getLongValue()); } finally { stopZookeeperServer(); + clearContextParmetersInParameterService(contextParameters); } logger.debug("Ran testConcurrentContextInfinispanMultiJVMCuratorLock test"); @@ -390,10 +430,10 @@ public class TestConcurrentContext { public void testConcurrentContextHazelcastMultiJvmCuratorLock() throws Exception { logger.debug("Running testConcurrentContextHazelcastMultiJVMCuratorLock test . . ."); + final ContextParameters contextParameters = new ContextParameters(); try { startZookeeperServer(); - final ContextParameters contextParameters = new ContextParameters(); contextParameters.getDistributorParameters() .setPluginClass(HazelcastContextDistributor.class.getCanonicalName()); @@ -401,7 +441,7 @@ public class TestConcurrentContext { curatorParameters.setPluginClass(CuratorLockManager.class.getCanonicalName()); curatorParameters.setZookeeperAddress(ZOOKEEPER_ADDRESS + ":" + zookeeperPort); contextParameters.setLockManagerParameters(curatorParameters); - ParameterService.register(curatorParameters); + setContextParmetersInParameterService(contextParameters); final ConfigrationProvider configrationProvider = getConfigrationProvider("HazelcastMultiCuratorLock", TEST_JVM_COUNT_MULTI_JVM, TEST_THREAD_COUNT_MULTI_JVM, TEST_THREAD_LOOPS); @@ -414,6 +454,7 @@ public class TestConcurrentContext { assertEquals(expected, actual.getLongValue()); } finally { stopZookeeperServer(); + clearContextParmetersInParameterService(contextParameters); } logger.debug("Ran testConcurrentContextHazelcastMultiJVMCuratorLock test"); } @@ -440,4 +481,29 @@ public class TestConcurrentContext { }; } + + /** + * Set the context parameters in the parameter service. + * + * @param contextParameters The parameters to set. + */ + private void setContextParmetersInParameterService(final ContextParameters contextParameters) { + ParameterService.register(contextParameters); + ParameterService.register(contextParameters.getDistributorParameters()); + ParameterService.register(contextParameters.getLockManagerParameters()); + ParameterService.register(contextParameters.getPersistorParameters()); + } + + /** + * Clear the context parameters in the parameter service. + * + * @param contextParameters The parameters to set. + */ + private void clearContextParmetersInParameterService(final ContextParameters contextParameters) { + ParameterService.deregister(contextParameters.getPersistorParameters()); + ParameterService.deregister(contextParameters.getLockManagerParameters()); + ParameterService.deregister(contextParameters.getDistributorParameters()); + ParameterService.deregister(contextParameters); + + } } diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextBooleanItem.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestContextBooleanItem.java index 436624b7d..24193848b 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextBooleanItem.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestContextBooleanItem.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.policy.apex.context.test.concepts; +package org.onap.policy.apex.testsuites.integration.context.concepts; import java.io.Serializable; diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextByteItem.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestContextByteItem.java index eec5d2b47..a6d4b1a1e 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextByteItem.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestContextByteItem.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.policy.apex.context.test.concepts; +package org.onap.policy.apex.testsuites.integration.context.concepts; import java.io.Serializable; diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateItem.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestContextDateItem.java index 89d2a428f..9cd3c6e81 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateItem.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestContextDateItem.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.policy.apex.context.test.concepts; +package org.onap.policy.apex.testsuites.integration.context.concepts; import java.io.Serializable; import java.util.Calendar; diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateLocaleItem.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestContextDateLocaleItem.java index 4914a1bc5..28c3e9ee3 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateLocaleItem.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestContextDateLocaleItem.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.policy.apex.context.test.concepts; +package org.onap.policy.apex.testsuites.integration.context.concepts; import java.io.Serializable; import java.util.Locale; @@ -174,7 +175,7 @@ public class TestContextDateLocaleItem implements Serializable { if (locale != null) { this.locale = locale; } - else { + else { this.locale = null; } } diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateTzItem.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestContextDateTzItem.java index 15bd0232f..b081cd55f 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateTzItem.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestContextDateTzItem.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.policy.apex.context.test.concepts; +package org.onap.policy.apex.testsuites.integration.context.concepts; import java.io.Serializable; import java.util.TimeZone; diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDoubleItem.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestContextDoubleItem.java index 26d98cdf4..19f756051 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDoubleItem.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestContextDoubleItem.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.policy.apex.context.test.concepts; +package org.onap.policy.apex.testsuites.integration.context.concepts; import java.io.Serializable; diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextFloatItem.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestContextFloatItem.java index 294cf5b55..0883c1d8f 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextFloatItem.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestContextFloatItem.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.policy.apex.context.test.concepts; +package org.onap.policy.apex.testsuites.integration.context.concepts; import java.io.Serializable; diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextIntItem.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestContextIntItem.java index 24cfebbc5..5932769b3 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextIntItem.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestContextIntItem.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.policy.apex.context.test.concepts; +package org.onap.policy.apex.testsuites.integration.context.concepts; import java.io.Serializable; diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextLongItem.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestContextLongItem.java index 025cde657..8ab1c2bd0 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextLongItem.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestContextLongItem.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.policy.apex.context.test.concepts; +package org.onap.policy.apex.testsuites.integration.context.concepts; import java.io.Serializable; diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextLongObjectItem.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestContextLongObjectItem.java index 9027bfcbf..56b027279 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextLongObjectItem.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestContextLongObjectItem.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.policy.apex.context.test.concepts; +package org.onap.policy.apex.testsuites.integration.context.concepts; import java.io.Serializable; diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextStringItem.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestContextStringItem.java index 6c9fcb412..bbf3167ad 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextStringItem.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestContextStringItem.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.policy.apex.context.test.concepts; +package org.onap.policy.apex.testsuites.integration.context.concepts; import java.io.Serializable; diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextTreeMapItem.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestContextTreeMapItem.java index 538a5433e..0d5741a8e 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextTreeMapItem.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestContextTreeMapItem.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.policy.apex.context.test.concepts; +package org.onap.policy.apex.testsuites.integration.context.concepts; import java.io.Serializable; import java.util.Map; diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextTreeSetItem.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestContextTreeSetItem.java index 22056db34..80cd3b179 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextTreeSetItem.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestContextTreeSetItem.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.policy.apex.context.test.concepts; +package org.onap.policy.apex.testsuites.integration.context.concepts; import java.io.Serializable; import java.util.Arrays; diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestExternalContextItem.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestExternalContextItem.java index 5c63c2ecb..fbf5e6c80 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestExternalContextItem.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestExternalContextItem.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.policy.apex.context.test.concepts; +package org.onap.policy.apex.testsuites.integration.context.concepts; import java.io.Serializable; diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestGlobalContextItem.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestGlobalContextItem.java index 9953a1a95..c139d7469 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestGlobalContextItem.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestGlobalContextItem.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.policy.apex.context.test.concepts; +package org.onap.policy.apex.testsuites.integration.context.concepts; import java.io.Serializable; diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestPolicyContextItem.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestPolicyContextItem.java index fc728a7ae..39a0408a8 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestPolicyContextItem.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestPolicyContextItem.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.policy.apex.context.test.concepts; +package org.onap.policy.apex.testsuites.integration.context.concepts; import java.io.Serializable; diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/package-info.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/package-info.java index d57b3fda3..e897dda2a 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/package-info.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/package-info.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,4 +25,4 @@ * @author Liam Fallon (liam.fallon@ericsson.com) */ -package org.onap.policy.apex.context.test.concepts; +package org.onap.policy.apex.testsuites.integration.context.concepts; diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextAlbumUpdate.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/distribution/ContextAlbumUpdate.java index eb6904a04..97bfa9efd 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextAlbumUpdate.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/distribution/ContextAlbumUpdate.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,23 +19,23 @@ * ============LICENSE_END========================================================= */ -package org.onap.policy.apex.context.test.distribution; +package org.onap.policy.apex.testsuites.integration.context.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 static org.onap.policy.apex.testsuites.integration.context.utils.Constants.APEX_DISTRIBUTOR; +import static org.onap.policy.apex.testsuites.integration.context.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.onap.policy.apex.testsuites.integration.context.factory.TestContextAlbumFactory; import org.slf4j.ext.XLogger; import org.slf4j.ext.XLoggerFactory; diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextInstantiation.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/distribution/ContextInstantiation.java index 8c4f40a5a..186df673b 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextInstantiation.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/distribution/ContextInstantiation.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,33 +19,33 @@ * ============LICENSE_END========================================================= */ -package org.onap.policy.apex.context.test.distribution; +package org.onap.policy.apex.testsuites.integration.context.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 static org.onap.policy.apex.testsuites.integration.context.factory.TestContextAlbumFactory.createPolicyContextModel; +import static org.onap.policy.apex.testsuites.integration.context.utils.Constants.BYTE_VAL; +import static org.onap.policy.apex.testsuites.integration.context.utils.Constants.EXCEPTION_MESSAGE; +import static org.onap.policy.apex.testsuites.integration.context.utils.Constants.EXTERNAL_CONTEXT; +import static org.onap.policy.apex.testsuites.integration.context.utils.Constants.EXTERNAL_CONTEXT_ALBUM; +import static org.onap.policy.apex.testsuites.integration.context.utils.Constants.FLOAT_VAL; +import static org.onap.policy.apex.testsuites.integration.context.utils.Constants.GLOBAL_CONTEXT_ALBUM; +import static org.onap.policy.apex.testsuites.integration.context.utils.Constants.GLOBAL_CONTEXT_KEY; +import static org.onap.policy.apex.testsuites.integration.context.utils.Constants.INT_VAL; +import static org.onap.policy.apex.testsuites.integration.context.utils.Constants.INT_VAL_2; +import static org.onap.policy.apex.testsuites.integration.context.utils.Constants.INT_VAL_3; +import static org.onap.policy.apex.testsuites.integration.context.utils.Constants.LONG_VAL; +import static org.onap.policy.apex.testsuites.integration.context.utils.Constants.PI_VAL; +import static org.onap.policy.apex.testsuites.integration.context.utils.Constants.POLICY_CONTEXT_ALBUM; +import static org.onap.policy.apex.testsuites.integration.context.utils.Constants.STRING_EXT_VAL; +import static org.onap.policy.apex.testsuites.integration.context.utils.Constants.STRING_GLOBAL_VAL; +import static org.onap.policy.apex.testsuites.integration.context.utils.Constants.STRING_VAL; +import static org.onap.policy.apex.testsuites.integration.context.utils.Constants.TEST_POLICY_CONTEXT_ITEM; +import static org.onap.policy.apex.testsuites.integration.context.utils.Constants.TIME_ZONE; +import static org.onap.policy.apex.testsuites.integration.context.utils.Constants.VERSION; import java.util.Collection; import java.util.Date; @@ -61,27 +62,27 @@ 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.onap.policy.apex.testsuites.integration.context.concepts.TestContextBooleanItem; +import org.onap.policy.apex.testsuites.integration.context.concepts.TestContextByteItem; +import org.onap.policy.apex.testsuites.integration.context.concepts.TestContextDateItem; +import org.onap.policy.apex.testsuites.integration.context.concepts.TestContextDateLocaleItem; +import org.onap.policy.apex.testsuites.integration.context.concepts.TestContextDateTzItem; +import org.onap.policy.apex.testsuites.integration.context.concepts.TestContextDoubleItem; +import org.onap.policy.apex.testsuites.integration.context.concepts.TestContextFloatItem; +import org.onap.policy.apex.testsuites.integration.context.concepts.TestContextIntItem; +import org.onap.policy.apex.testsuites.integration.context.concepts.TestContextLongItem; +import org.onap.policy.apex.testsuites.integration.context.concepts.TestContextLongObjectItem; +import org.onap.policy.apex.testsuites.integration.context.concepts.TestContextStringItem; +import org.onap.policy.apex.testsuites.integration.context.concepts.TestContextTreeMapItem; +import org.onap.policy.apex.testsuites.integration.context.concepts.TestContextTreeSetItem; +import org.onap.policy.apex.testsuites.integration.context.concepts.TestExternalContextItem; +import org.onap.policy.apex.testsuites.integration.context.concepts.TestGlobalContextItem; +import org.onap.policy.apex.testsuites.integration.context.concepts.TestPolicyContextItem; +import org.onap.policy.apex.testsuites.integration.context.factory.TestContextAlbumFactory; +import org.onap.policy.apex.testsuites.integration.context.utils.Constants; import org.slf4j.ext.XLogger; import org.slf4j.ext.XLoggerFactory; diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextUpdate.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/distribution/ContextUpdate.java index f8370ec6c..0ed036992 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextUpdate.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/distribution/ContextUpdate.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,21 +19,21 @@ * ============LICENSE_END========================================================= */ -package org.onap.policy.apex.context.test.distribution; +package org.onap.policy.apex.testsuites.integration.context.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 static org.onap.policy.apex.testsuites.integration.context.utils.Constants.APEX_DISTRIBUTOR; +import static org.onap.policy.apex.testsuites.integration.context.utils.Constants.DATE_CONTEXT_ALBUM; +import static org.onap.policy.apex.testsuites.integration.context.utils.Constants.EXCEPTION_MESSAGE; +import static org.onap.policy.apex.testsuites.integration.context.utils.Constants.LONG_CONTEXT_ALBUM; +import static org.onap.policy.apex.testsuites.integration.context.utils.Constants.MAP_CONTEXT_ALBUM; +import static org.onap.policy.apex.testsuites.integration.context.utils.Constants.TIME_ZONE; +import static org.onap.policy.apex.testsuites.integration.context.utils.Constants.VERSION; +import static org.onap.policy.apex.testsuites.integration.context.utils.Constants.getAxArtifactKeyArray; import java.util.Date; import java.util.HashMap; @@ -44,13 +45,13 @@ 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.onap.policy.apex.testsuites.integration.context.concepts.TestContextDateItem; +import org.onap.policy.apex.testsuites.integration.context.concepts.TestContextDateLocaleItem; +import org.onap.policy.apex.testsuites.integration.context.concepts.TestContextTreeMapItem; +import org.onap.policy.apex.testsuites.integration.context.factory.TestContextAlbumFactory; import org.slf4j.ext.XLogger; import org.slf4j.ext.XLoggerFactory; diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/SequentialContextInstantiation.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/distribution/SequentialContextInstantiation.java index 293ef9205..4c9339514 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/SequentialContextInstantiation.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/distribution/SequentialContextInstantiation.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,25 +19,25 @@ * ============LICENSE_END========================================================= */ -package org.onap.policy.apex.context.test.distribution; +package org.onap.policy.apex.testsuites.integration.context.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 static org.onap.policy.apex.testsuites.integration.context.factory.TestContextAlbumFactory.createMultiAlbumsContextModel; +import static org.onap.policy.apex.testsuites.integration.context.utils.Constants.APEX_DISTRIBUTOR; +import static org.onap.policy.apex.testsuites.integration.context.utils.Constants.BYTE_VAL; +import static org.onap.policy.apex.testsuites.integration.context.utils.Constants.DATE_CONTEXT_ALBUM; +import static org.onap.policy.apex.testsuites.integration.context.utils.Constants.EXCEPTION_MESSAGE; +import static org.onap.policy.apex.testsuites.integration.context.utils.Constants.FLOAT_VAL; +import static org.onap.policy.apex.testsuites.integration.context.utils.Constants.INT_VAL; +import static org.onap.policy.apex.testsuites.integration.context.utils.Constants.LONG_VAL; +import static org.onap.policy.apex.testsuites.integration.context.utils.Constants.PI_VAL; +import static org.onap.policy.apex.testsuites.integration.context.utils.Constants.STRING_GLOBAL_VAL; +import static org.onap.policy.apex.testsuites.integration.context.utils.Constants.TIME_ZONE; +import static org.onap.policy.apex.testsuites.integration.context.utils.Constants.VERSION; import java.util.Collection; import java.util.Date; @@ -51,19 +52,19 @@ 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.onap.policy.apex.testsuites.integration.context.concepts.TestContextBooleanItem; +import org.onap.policy.apex.testsuites.integration.context.concepts.TestContextByteItem; +import org.onap.policy.apex.testsuites.integration.context.concepts.TestContextDateItem; +import org.onap.policy.apex.testsuites.integration.context.concepts.TestContextDateLocaleItem; +import org.onap.policy.apex.testsuites.integration.context.concepts.TestContextDateTzItem; +import org.onap.policy.apex.testsuites.integration.context.concepts.TestContextDoubleItem; +import org.onap.policy.apex.testsuites.integration.context.concepts.TestContextFloatItem; +import org.onap.policy.apex.testsuites.integration.context.concepts.TestContextIntItem; +import org.onap.policy.apex.testsuites.integration.context.concepts.TestContextLongItem; +import org.onap.policy.apex.testsuites.integration.context.concepts.TestContextLongObjectItem; +import org.onap.policy.apex.testsuites.integration.context.concepts.TestContextStringItem; +import org.onap.policy.apex.testsuites.integration.context.utils.Constants; import org.slf4j.ext.XLogger; import org.slf4j.ext.XLoggerFactory; diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/package-info.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/distribution/package-info.java index 148c8cac4..04230aaae 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/package-info.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/distribution/package-info.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,4 +25,4 @@ * @author Liam Fallon (liam.fallon@ericsson.com) */ -package org.onap.policy.apex.context.test.distribution; +package org.onap.policy.apex.testsuites.integration.context.distribution; diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/entities/ArtifactKeyTestEntity.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/entities/ArtifactKeyTestEntity.java index c40eeba98..1f3ea3c20 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/entities/ArtifactKeyTestEntity.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/entities/ArtifactKeyTestEntity.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.policy.apex.context.test.entities; +package org.onap.policy.apex.testsuites.integration.context.entities; import java.util.Arrays; import java.util.List; @@ -78,7 +79,7 @@ public class ArtifactKeyTestEntity extends AxConcept { /* * (non-Javadoc) - * + * * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#getKey() */ @Override @@ -88,7 +89,7 @@ public class ArtifactKeyTestEntity extends AxConcept { /* * (non-Javadoc) - * + * * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#getKeys() */ @Override @@ -134,7 +135,7 @@ public class ArtifactKeyTestEntity extends AxConcept { /* * (non-Javadoc) - * + * * @see * org.onap.policy.apex.model.basicmodel.concepts.AxConcept#validate(org.onap.policy.apex.model.basicmodel.concepts. * AxValidationResult) @@ -146,7 +147,7 @@ public class ArtifactKeyTestEntity extends AxConcept { /* * (non-Javadoc) - * + * * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#clean() */ @Override @@ -156,7 +157,7 @@ public class ArtifactKeyTestEntity extends AxConcept { /* * (non-Javadoc) - * + * * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#toString() */ @Override @@ -166,7 +167,7 @@ public class ArtifactKeyTestEntity extends AxConcept { /* * (non-Javadoc) - * + * * @see * org.onap.policy.apex.model.basicmodel.concepts.AxConcept#copyTo(org.onap.policy.apex.model.basicmodel.concepts. * AxConcept) @@ -190,7 +191,7 @@ public class ArtifactKeyTestEntity extends AxConcept { /* * (non-Javadoc) - * + * * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#hashCode() */ @Override @@ -203,7 +204,7 @@ public class ArtifactKeyTestEntity extends AxConcept { /* * (non-Javadoc) - * + * * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#equals(java.lang.Object) */ @Override @@ -230,7 +231,7 @@ public class ArtifactKeyTestEntity extends AxConcept { /* * (non-Javadoc) - * + * * @see java.lang.Comparable#compareTo(java.lang.Object) */ @Override diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/entities/ReferenceKeyTestEntity.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/entities/ReferenceKeyTestEntity.java index 3c421a7a9..2eef94ed7 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/entities/ReferenceKeyTestEntity.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/entities/ReferenceKeyTestEntity.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.policy.apex.context.test.entities; +package org.onap.policy.apex.testsuites.integration.context.entities; import java.util.Arrays; import java.util.List; @@ -81,7 +82,7 @@ public class ReferenceKeyTestEntity extends AxConcept { /* * (non-Javadoc) - * + * * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#getKey() */ @Override @@ -91,7 +92,7 @@ public class ReferenceKeyTestEntity extends AxConcept { /* * (non-Javadoc) - * + * * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#getKeys() */ @Override @@ -137,7 +138,7 @@ public class ReferenceKeyTestEntity extends AxConcept { /* * (non-Javadoc) - * + * * @see * org.onap.policy.apex.model.basicmodel.concepts.AxConcept#validate(org.onap.policy.apex.model.basicmodel.concepts. * AxValidationResult) @@ -149,7 +150,7 @@ public class ReferenceKeyTestEntity extends AxConcept { /* * (non-Javadoc) - * + * * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#clean() */ @Override @@ -159,7 +160,7 @@ public class ReferenceKeyTestEntity extends AxConcept { /* * (non-Javadoc) - * + * * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#toString() */ @Override @@ -169,7 +170,7 @@ public class ReferenceKeyTestEntity extends AxConcept { /* * (non-Javadoc) - * + * * @see * org.onap.policy.apex.model.basicmodel.concepts.AxConcept#copyTo(org.onap.policy.apex.model.basicmodel.concepts. * AxConcept) @@ -193,7 +194,7 @@ public class ReferenceKeyTestEntity extends AxConcept { /* * (non-Javadoc) - * + * * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#hashCode() */ @Override @@ -206,7 +207,7 @@ public class ReferenceKeyTestEntity extends AxConcept { /* * (non-Javadoc) - * + * * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#equals(java.lang.Object) */ @Override @@ -233,7 +234,7 @@ public class ReferenceKeyTestEntity extends AxConcept { /* * (non-Javadoc) - * + * * @see java.lang.Comparable#compareTo(java.lang.Object) */ @Override diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/entities/package-info.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/entities/package-info.java index be51a4e7e..8824a16f5 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/entities/package-info.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/entities/package-info.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,4 +24,4 @@ * @author Dinh Danh Le (dinh.danh.le@ericsson.com) * */ -package org.onap.policy.apex.context.test.entities; +package org.onap.policy.apex.testsuites.integration.context.entities; diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/factory/TestContextAlbumFactory.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/factory/TestContextAlbumFactory.java index 9689acb3d..2efa80154 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/factory/TestContextAlbumFactory.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/factory/TestContextAlbumFactory.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,22 +19,16 @@ * ============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; +package org.onap.policy.apex.testsuites.integration.context.factory; + +import static org.onap.policy.apex.testsuites.integration.context.utils.Constants.DATE_CONTEXT_ALBUM; +import static org.onap.policy.apex.testsuites.integration.context.utils.Constants.EXTERNAL_CONTEXT_ALBUM; +import static org.onap.policy.apex.testsuites.integration.context.utils.Constants.GLOBAL_CONTEXT_ALBUM; +import static org.onap.policy.apex.testsuites.integration.context.utils.Constants.LONG_CONTEXT_ALBUM; +import static org.onap.policy.apex.testsuites.integration.context.utils.Constants.MAP_CONTEXT_ALBUM; +import static org.onap.policy.apex.testsuites.integration.context.utils.Constants.POLICY_CONTEXT_ALBUM; +import static org.onap.policy.apex.testsuites.integration.context.utils.Constants.VERSION; + 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; @@ -41,6 +36,12 @@ 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; +import org.onap.policy.apex.testsuites.integration.context.concepts.TestContextDateLocaleItem; +import org.onap.policy.apex.testsuites.integration.context.concepts.TestContextLongItem; +import org.onap.policy.apex.testsuites.integration.context.concepts.TestContextTreeMapItem; +import org.onap.policy.apex.testsuites.integration.context.concepts.TestExternalContextItem; +import org.onap.policy.apex.testsuites.integration.context.concepts.TestGlobalContextItem; +import org.onap.policy.apex.testsuites.integration.context.concepts.TestPolicyContextItem; /** * The Class TestContextAlbumFactory creates test context albums. diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/factory/package-info.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/factory/package-info.java index ea70ce2a8..3d946eec1 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/factory/package-info.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/factory/package-info.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,4 +25,4 @@ * @author Liam Fallon (liam.fallon@ericsson.com) */ -package org.onap.policy.apex.context.test.factory; +package org.onap.policy.apex.testsuites.integration.context.factory; diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/lock/modifier/AlbumModifier.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/lock/modifier/AlbumModifier.java index d1127ffa3..f9f94c980 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/lock/modifier/AlbumModifier.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/lock/modifier/AlbumModifier.java @@ -1,24 +1,25 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ -package org.onap.policy.apex.context.test.lock.modifier; +package org.onap.policy.apex.testsuites.integration.context.lock.modifier; import org.onap.policy.apex.context.ContextAlbum; import org.onap.policy.apex.context.ContextException; diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/lock/modifier/LockType.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/lock/modifier/LockType.java index c4e6ac43a..dc9cd94e7 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/lock/modifier/LockType.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/lock/modifier/LockType.java @@ -1,24 +1,25 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ -package org.onap.policy.apex.context.test.lock.modifier; +package org.onap.policy.apex.testsuites.integration.context.lock.modifier; import org.onap.policy.apex.context.ContextRuntimeException; diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/lock/modifier/NoLockAlbumModifier.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/lock/modifier/NoLockAlbumModifier.java index 4ce7890be..26f54e08c 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/lock/modifier/NoLockAlbumModifier.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/lock/modifier/NoLockAlbumModifier.java @@ -1,29 +1,30 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ -package org.onap.policy.apex.context.test.lock.modifier; +package org.onap.policy.apex.testsuites.integration.context.lock.modifier; import java.util.Random; import org.onap.policy.apex.context.ContextAlbum; -import org.onap.policy.apex.context.test.concepts.TestContextLongItem; +import org.onap.policy.apex.testsuites.integration.context.concepts.TestContextLongItem; import org.slf4j.ext.XLogger; import org.slf4j.ext.XLoggerFactory; @@ -35,7 +36,7 @@ public class NoLockAlbumModifier implements AlbumModifier { /* * (non-Javadoc) - * + * * @see org.onap.policy.apex.context.test.lock.modifier.AlbumModifier#modifyAlbum(org.onap.policy.apex.context. * ContextAlbum, int, int) */ diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/lock/modifier/ReadLockAlbumModifier.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/lock/modifier/ReadLockAlbumModifier.java index fbafb1081..f5d22ed87 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/lock/modifier/ReadLockAlbumModifier.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/lock/modifier/ReadLockAlbumModifier.java @@ -1,30 +1,31 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ -package org.onap.policy.apex.context.test.lock.modifier; +package org.onap.policy.apex.testsuites.integration.context.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.onap.policy.apex.testsuites.integration.context.concepts.TestContextLongItem; import org.slf4j.ext.XLogger; import org.slf4j.ext.XLoggerFactory; @@ -36,7 +37,7 @@ public class ReadLockAlbumModifier implements AlbumModifier { /* * (non-Javadoc) - * + * * @see org.onap.policy.apex.context.test.lock.modifier.AlbumModifier#modifyAlbum(org.onap.policy.apex.context. * ContextAlbum, int, int) */ diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/lock/modifier/SingleValueWriteLockAlbumModifier.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/lock/modifier/SingleValueWriteLockAlbumModifier.java index 674cf3af2..b54fe166f 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/lock/modifier/SingleValueWriteLockAlbumModifier.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/lock/modifier/SingleValueWriteLockAlbumModifier.java @@ -1,30 +1,31 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ -package org.onap.policy.apex.context.test.lock.modifier; +package org.onap.policy.apex.testsuites.integration.context.lock.modifier; -import static org.onap.policy.apex.context.test.utils.Constants.TEST_VALUE; +import static org.onap.policy.apex.testsuites.integration.context.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.onap.policy.apex.testsuites.integration.context.concepts.TestContextLongItem; import org.slf4j.ext.XLogger; import org.slf4j.ext.XLoggerFactory; @@ -36,7 +37,7 @@ public class SingleValueWriteLockAlbumModifier implements AlbumModifier { /* * (non-Javadoc) - * + * * @see org.onap.policy.apex.context.test.lock.modifier.AlbumModifier#modifyAlbum(org.onap.policy.apex.context. * ContextAlbum, int, int) */ diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/lock/modifier/WriteLockAlbumModifier.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/lock/modifier/WriteLockAlbumModifier.java index 7136121f7..87214fb47 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/lock/modifier/WriteLockAlbumModifier.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/lock/modifier/WriteLockAlbumModifier.java @@ -1,30 +1,31 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ -package org.onap.policy.apex.context.test.lock.modifier; +package org.onap.policy.apex.testsuites.integration.context.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.onap.policy.apex.testsuites.integration.context.concepts.TestContextLongItem; import org.slf4j.ext.XLogger; import org.slf4j.ext.XLoggerFactory; @@ -36,7 +37,7 @@ public class WriteLockAlbumModifier implements AlbumModifier { /* * (non-Javadoc) - * + * * @see org.onap.policy.apex.context.test.lock.modifier.AlbumModifier#modifyAlbum(org.onap.policy.apex.context. * ContextAlbum, int, int) */ diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/lock/modifier/package-info.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/lock/modifier/package-info.java index bf5bcb31c..cf38edb7b 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/lock/modifier/package-info.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/lock/modifier/package-info.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,4 +23,4 @@ * 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; +package org.onap.policy.apex.testsuites.integration.context.lock.modifier; diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContext.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/locking/ConcurrentContext.java index f0dac722e..4326d5adb 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContext.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/locking/ConcurrentContext.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.policy.apex.context.test.locking; +package org.onap.policy.apex.testsuites.integration.context.locking; import java.io.Closeable; import java.io.IOException; @@ -33,9 +34,9 @@ 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.onap.policy.apex.testsuites.integration.context.concepts.TestContextLongItem; +import org.onap.policy.apex.testsuites.integration.context.utils.ConfigrationProvider; import org.slf4j.ext.XLogger; import org.slf4j.ext.XLoggerFactory; @@ -60,7 +61,7 @@ public class ConcurrentContext { /** * The method tests concurrent use of context. - * + * * @return the verified context * @throws ApexException the Apex exception occurs in handling Apex */ diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextJvm.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/locking/ConcurrentContextJvm.java index c7043bc53..0a9f4cf93 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextJvm.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/locking/ConcurrentContextJvm.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.policy.apex.context.test.locking; +package org.onap.policy.apex.testsuites.integration.context.locking; import com.google.gson.Gson; @@ -38,12 +39,12 @@ 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.apex.testsuites.integration.context.utils.ConfigrationProvider; +import org.onap.policy.apex.testsuites.integration.context.utils.ConfigrationProviderImpl; +import org.onap.policy.apex.testsuites.integration.context.utils.Constants; import org.onap.policy.common.parameters.ParameterGroup; import org.onap.policy.common.parameters.ParameterService; import org.slf4j.ext.XLogger; @@ -76,7 +77,7 @@ public final class ConcurrentContextJvm { /** * 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 { @@ -104,7 +105,9 @@ public final class ConcurrentContextJvm { } LOGGER.debug("threads finished, end value is {}", contextAlbum.get(Constants.TEST_VALUE)); + distributor.clear(); + LOGGER.info("Shutting down now ... "); executorService.shutdownNow(); } diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextJvmThread.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/locking/ConcurrentContextJvmThread.java index 9e23175fb..3e8105c86 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextJvmThread.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/locking/ConcurrentContextJvmThread.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.policy.apex.context.test.locking; +package org.onap.policy.apex.testsuites.integration.context.locking; import com.google.gson.Gson; @@ -30,7 +31,7 @@ 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.apex.testsuites.integration.context.utils.ConfigrationProvider; import org.onap.policy.common.parameters.ParameterGroup; import org.onap.policy.common.parameters.ParameterService; import org.slf4j.ext.XLogger; @@ -103,7 +104,7 @@ public class ConcurrentContextJvmThread implements Runnable, Closeable { } waitForExitValue(); - + } catch (final Exception ioException) { LOGGER.error("Error occured while writing JVM Output for command ", ioException); } diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextThread.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/locking/ConcurrentContextThread.java index 726880f3b..baad04e19 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextThread.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/locking/ConcurrentContextThread.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,17 +19,16 @@ * ============LICENSE_END========================================================= */ -package org.onap.policy.apex.context.test.locking; +package org.onap.policy.apex.testsuites.integration.context.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.onap.policy.apex.testsuites.integration.context.lock.modifier.AlbumModifier; +import org.onap.policy.apex.testsuites.integration.context.utils.ConfigrationProvider; import org.slf4j.ext.XLogger; import org.slf4j.ext.XLoggerFactory; @@ -83,15 +83,9 @@ public class ConcurrentContextThread implements Runnable, Closeable { } 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 + " . . ."); + LOGGER.info("finished TestConcurrentContextThread_" + jvm + "_" + instance + " . . ."); } @Override diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/package-info.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/locking/package-info.java index 0e80e611d..ce32762d1 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/package-info.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/locking/package-info.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,4 +25,4 @@ * @author Liam Fallon (liam.fallon@ericsson.com) */ -package org.onap.policy.apex.context.test.locking; +package org.onap.policy.apex.testsuites.integration.context.locking; diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/ConfigrationProvider.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/utils/ConfigrationProvider.java index f3a49dfbb..98dfd6966 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/ConfigrationProvider.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/utils/ConfigrationProvider.java @@ -1,24 +1,25 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ -package org.onap.policy.apex.context.test.utils; +package org.onap.policy.apex.testsuites.integration.context.utils; import java.util.Map; import java.util.concurrent.ExecutorService; @@ -26,9 +27,9 @@ 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; +import org.onap.policy.apex.testsuites.integration.context.lock.modifier.AlbumModifier; +import org.onap.policy.apex.testsuites.integration.context.lock.modifier.LockType; /** * The Interface ConfigrationProvider provides the configuration for a context test to a context test executor. diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/ConfigrationProviderImpl.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/utils/ConfigrationProviderImpl.java index 70200943c..24586231f 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/ConfigrationProviderImpl.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/utils/ConfigrationProviderImpl.java @@ -1,24 +1,25 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ -package org.onap.policy.apex.context.test.utils; +package org.onap.policy.apex.testsuites.integration.context.utils; import java.util.HashMap; import java.util.Map; @@ -30,13 +31,13 @@ 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; +import org.onap.policy.apex.testsuites.integration.context.concepts.TestContextLongItem; +import org.onap.policy.apex.testsuites.integration.context.factory.TestContextAlbumFactory; +import org.onap.policy.apex.testsuites.integration.context.lock.modifier.AlbumModifier; +import org.onap.policy.apex.testsuites.integration.context.lock.modifier.LockType; /** * The Class ConfigrationProviderImpl provides configuration information for a context test back to the caller. @@ -52,7 +53,7 @@ public class ConfigrationProviderImpl implements ConfigrationProvider { /** * The parameterized ConfigrationProviderImpl constructor. - * + * * @param testType the test type * @param jvmCount the JVM count * @param threadCount the thread count @@ -72,7 +73,7 @@ public class ConfigrationProviderImpl implements ConfigrationProvider { /* * (non-Javadoc) - * + * * @see org.onap.policy.apex.context.test.utils.ConfigrationProvider#getTestName() */ @Override @@ -82,7 +83,7 @@ public class ConfigrationProviderImpl implements ConfigrationProvider { /* * (non-Javadoc) - * + * * @see org.onap.policy.apex.context.test.utils.ConfigrationProvider#getLoopSize() */ @Override @@ -92,7 +93,7 @@ public class ConfigrationProviderImpl implements ConfigrationProvider { /* * (non-Javadoc) - * + * * @see org.onap.policy.apex.context.test.utils.ConfigrationProvider#getThreadCount() */ @Override @@ -102,7 +103,7 @@ public class ConfigrationProviderImpl implements ConfigrationProvider { /* * (non-Javadoc) - * + * * @see org.onap.policy.apex.context.test.utils.ConfigrationProvider#getJvmCount() */ @Override @@ -112,7 +113,7 @@ public class ConfigrationProviderImpl implements ConfigrationProvider { /* * (non-Javadoc) - * + * * @see org.onap.policy.apex.context.test.utils.ConfigrationProvider#getAlbumSize() */ @Override @@ -122,7 +123,7 @@ public class ConfigrationProviderImpl implements ConfigrationProvider { /* * (non-Javadoc) - * + * * @see org.onap.policy.apex.context.test.utils.ConfigrationProvider#getExecutorService() */ @Override @@ -134,7 +135,7 @@ public class ConfigrationProviderImpl implements ConfigrationProvider { /* * (non-Javadoc) - * + * * @see org.onap.policy.apex.context.test.utils.ConfigrationProvider#getExecutorService(java.lang.String, int) */ @Override @@ -145,7 +146,7 @@ public class ConfigrationProviderImpl implements ConfigrationProvider { /* * (non-Javadoc) - * + * * @see * org.onap.policy.apex.context.test.utils.ConfigrationProvider#getDistributor(org.onap.policy.apex.model.basicmodel * .concepts.AxArtifactKey) @@ -161,7 +162,7 @@ public class ConfigrationProviderImpl implements ConfigrationProvider { /* * (non-Javadoc) - * + * * @see org.onap.policy.apex.context.test.utils.ConfigrationProvider#getDistributor() */ @Override @@ -172,7 +173,7 @@ public class ConfigrationProviderImpl implements ConfigrationProvider { /* * (non-Javadoc) - * + * * @see org.onap.policy.apex.context.test.utils.ConfigrationProvider#getContextAlbum(org.onap.policy.apex.context. * Distributor) */ @@ -183,7 +184,7 @@ public class ConfigrationProviderImpl implements ConfigrationProvider { /* * (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[]) @@ -205,7 +206,7 @@ public class ConfigrationProviderImpl implements ConfigrationProvider { /* * (non-Javadoc) - * + * * @see org.onap.policy.apex.context.test.utils.ConfigrationProvider#getContextAlbumInitValues() */ @Override @@ -219,7 +220,7 @@ public class ConfigrationProviderImpl implements ConfigrationProvider { /* * (non-Javadoc) - * + * * @see org.onap.policy.apex.context.test.utils.ConfigrationProvider#getAlbumModifier() */ @Override @@ -229,7 +230,7 @@ public class ConfigrationProviderImpl implements ConfigrationProvider { /* * (non-Javadoc) - * + * * @see org.onap.policy.apex.context.test.utils.ConfigrationProvider#getLockType() */ @Override @@ -251,7 +252,7 @@ public class ConfigrationProviderImpl implements ConfigrationProvider { /* * (non-Javadoc) - * + * * @see java.lang.Object#toString() */ @Override diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/Constants.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/utils/Constants.java index ba620d1f4..ea80d4e7d 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/Constants.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/utils/Constants.java @@ -1,29 +1,30 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ -package org.onap.policy.apex.context.test.utils; +package org.onap.policy.apex.testsuites.integration.context.utils; import java.util.TimeZone; -import org.onap.policy.apex.context.test.concepts.TestPolicyContextItem; import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; +import org.onap.policy.apex.testsuites.integration.context.concepts.TestPolicyContextItem; /** * The Class Constants provides constants for context tests. diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/IntegrationThreadFactory.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/utils/IntegrationThreadFactory.java index 486a93cb4..271bb9519 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/IntegrationThreadFactory.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/utils/IntegrationThreadFactory.java @@ -1,24 +1,25 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ -package org.onap.policy.apex.context.test.utils; +package org.onap.policy.apex.testsuites.integration.context.utils; import java.util.concurrent.ThreadFactory; import java.util.concurrent.atomic.AtomicInteger; diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/NetworkUtils.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/utils/NetworkUtils.java index d26ce955d..ac43b7120 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/NetworkUtils.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/utils/NetworkUtils.java @@ -1,24 +1,25 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ -package org.onap.policy.apex.context.test.utils; +package org.onap.policy.apex.testsuites.integration.context.utils; import java.net.InetAddress; import java.net.NetworkInterface; @@ -42,7 +43,7 @@ public class 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 */ diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/ZooKeeperServerServiceProvider.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/utils/ZooKeeperServerServiceProvider.java index ac9ae68b7..0e90f673e 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/ZooKeeperServerServiceProvider.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/utils/ZooKeeperServerServiceProvider.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.policy.apex.context.test.utils; +package org.onap.policy.apex.testsuites.integration.context.utils; import java.io.File; import java.io.IOException; diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/package-info.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/utils/package-info.java index 2872d20df..d195331a6 100755 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/package-info.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/utils/package-info.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,4 +25,4 @@ * @author Liam Fallon (liam.fallon@ericsson.com) */ -package org.onap.policy.apex.context.test.utils; +package org.onap.policy.apex.testsuites.integration.context.utils; diff --git a/context/context-test-utils/src/test/resources/META-INF/persistence.xml b/testsuites/integration/integration-context-test/src/test/resources/META-INF/persistence.xml index b7911caa2..b6a9a9d1e 100644 --- a/context/context-test-utils/src/test/resources/META-INF/persistence.xml +++ b/testsuites/integration/integration-context-test/src/test/resources/META-INF/persistence.xml @@ -2,6 +2,7 @@ <!-- ============LICENSE_START======================================================= Copyright (C) 2016-2018 Ericsson. All rights reserved. + Modifications Copyright (C) 2019 Nordix Foundation. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/testsuites/integration/pom.xml b/testsuites/integration/pom.xml index 4242e8231..c5b89a71c 100644 --- a/testsuites/integration/pom.xml +++ b/testsuites/integration/pom.xml @@ -1,6 +1,7 @@ <!-- ============LICENSE_START======================================================= Copyright (C) 2018 Ericsson. All rights reserved. + Modifications Copyright (C) 2019 Nordix Foundation. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -38,17 +39,6 @@ <profiles> <profile> - <id>apexMetrics</id> - <activation> - <property> - <name>apexMetrics</name> - </property> - </activation> - <modules> - <module>integration-context-test</module> - </modules> - </profile> - <profile> <id>apexAll</id> <activation> <property> @@ -75,4 +65,4 @@ </distributionManagement> </profile> </profiles> -</project>
\ No newline at end of file +</project> diff --git a/testsuites/performance/performance-context-metrics/pom.xml b/testsuites/performance/performance-context-metrics/pom.xml deleted file mode 100644 index 3e65f466c..000000000 --- a/testsuites/performance/performance-context-metrics/pom.xml +++ /dev/null @@ -1,93 +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========================================================= ---> - -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.onap.policy.apex-pdp.testsuites.performance</groupId> - <artifactId>performance</artifactId> - <version>2.1.0-SNAPSHOT</version> - </parent> - - <artifactId>performance-context-metrics</artifactId> - <name>${project.artifactId}</name> - <description>[${project.parent.artifactId}] module to calculate metrics using various plugins</description> - - <dependencies> - <dependency> - <groupId>org.onap.policy.common</groupId> - <artifactId>utils</artifactId> - </dependency> - <dependency> - <groupId>org.onap.policy.apex-pdp.core</groupId> - <artifactId>core-infrastructure</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.onap.policy.apex-pdp.context</groupId> - <artifactId>context-test-utils</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.onap.policy.apex-pdp.plugins.plugins-context.plugins-context-distribution</groupId> - <artifactId>plugins-context-distribution-hazelcast</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.onap.policy.apex-pdp.plugins.plugins-context.plugins-context-distribution</groupId> - <artifactId>plugins-context-distribution-infinispan</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.onap.policy.apex-pdp.plugins.plugins-context.plugins-context-locking</groupId> - <artifactId>plugins-context-locking-curator</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.onap.policy.apex-pdp.plugins.plugins-context.plugins-context-locking</groupId> - <artifactId>plugins-context-locking-hazelcast</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.apache.curator</groupId> - <artifactId>curator-test</artifactId> - <version>3.2.0</version> - <scope>test</scope> - </dependency> - </dependencies> - - <profiles> - <profile> - <id>apexSite</id> - <activation> - <property> - <name>apexSite</name> - </property> - </activation> - <distributionManagement> - <site> - <id>${project.artifactId}-site</id> - <url>${apex.adsite.prefix}/modules/testsuites/${project.parent.artifactId}/${project.artifactId}/</url> - </site> - </distributionManagement> - </profile> - </profiles> -</project>
\ No newline at end of file diff --git a/testsuites/performance/performance-context-metrics/src/main/java/org/onap/policy/apex/testsuites/performance/context/metrics/ConcurrentContextMetrics.java b/testsuites/performance/performance-context-metrics/src/main/java/org/onap/policy/apex/testsuites/performance/context/metrics/ConcurrentContextMetrics.java deleted file mode 100644 index b0bfb1ce7..000000000 --- a/testsuites/performance/performance-context-metrics/src/main/java/org/onap/policy/apex/testsuites/performance/context/metrics/ConcurrentContextMetrics.java +++ /dev/null @@ -1,322 +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.testsuites.performance.context.metrics; - -import static org.onap.policy.apex.context.parameters.DistributorParameters.DEFAULT_DISTRIBUTOR_PLUGIN_CLASS; -import static org.onap.policy.apex.context.parameters.LockManagerParameters.DEFAULT_LOCK_MANAGER_PLUGIN_CLASS; - -import java.io.File; -import java.io.IOException; -import java.util.Arrays; -import java.util.Map; -import java.util.Map.Entry; - -import org.onap.policy.apex.context.parameters.ContextParameters; -import org.onap.policy.apex.context.parameters.DistributorParameters; -import org.onap.policy.apex.context.test.concepts.TestContextLongItem; -import org.onap.policy.apex.context.test.locking.ConcurrentContext; -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.ZooKeeperServerServiceProvider; -import org.onap.policy.apex.model.basicmodel.concepts.ApexException; -import org.onap.policy.apex.model.basicmodel.handling.ApexModelException; -import org.onap.policy.apex.plugins.context.distribution.hazelcast.HazelcastContextDistributor; -import org.onap.policy.apex.plugins.context.distribution.infinispan.InfinispanContextDistributor; -import org.onap.policy.apex.plugins.context.distribution.infinispan.InfinispanDistributorParameters; -import org.onap.policy.apex.plugins.context.locking.curator.CuratorLockManager; -import org.onap.policy.apex.plugins.context.locking.curator.CuratorLockManagerParameters; -import org.onap.policy.apex.plugins.context.locking.hazelcast.HazelcastLockManager; -import org.slf4j.ext.XLogger; -import org.slf4j.ext.XLoggerFactory; - -/** - * The Class concurrentContextMetrics tests concurrent use of context. - * - * @author Liam Fallon (liam.fallon@ericsson.com) - */ -public class ConcurrentContextMetrics { - private static final int NUM_ARGS = 9; - private static final int ARG_LABEL = 0; - private static final int ARG_JVM_COUNT = 1; - private static final int ARG_THREAD_COUNT = 2; - private static final int ARG_ITERATIONS = 3; - private static final int ARG_ARRAY_SIZE = 4; - private static final int ARG_LOCK_TYPE = 5; - private static final int ARG_ZOOKEEPER_ADDRESS = 6; - private static final int ARG_ZOOKEEPER_PORT = 7; - private static final int ARG_ZOOKEEPER_DIRECTORY = 8; - - // Logger for this class - private static final XLogger LOGGER = XLoggerFactory.getXLogger(ConcurrentContextMetrics.class); - - private String zookeeperAddress = null; - private final ConfigrationProvider configrationProvider; - private final File zookeeperDirectory; - private final int zookeeperPort; - - /** - * Construct a concurrent context object. - * - * @param configrationProvider Configuration for the context metrics - * @param zookeeperAddress Zookeeper address - * @param zookeeperPort Zookeeper port - * @param zookeeperDirectory Zookeeper directory - */ - public ConcurrentContextMetrics(final ConfigrationProvider configrationProvider, final String zookeeperAddress, - final int zookeeperPort, final String zookeeperDirectory) { - this.configrationProvider = configrationProvider; - this.zookeeperAddress = zookeeperAddress; - this.zookeeperPort = zookeeperPort; - this.zookeeperDirectory = new File(zookeeperDirectory); - } - - /** - * Concurrent context metrics JVM local. - * - * @throws ApexModelException the apex model exception - * @throws IOException the IO exception - * @throws ApexException the apex exception - */ - private void concurrentContextMetricsJvmLocal() throws ApexException { - if (configrationProvider.getJvmCount() != 1) { - return; - } - - LOGGER.debug("Running concurrentContextMetricsJVMLocalVarSet metrics . . ."); - - final ContextParameters contextParameters = new ContextParameters(); - contextParameters.getDistributorParameters().setPluginClass(DEFAULT_DISTRIBUTOR_PLUGIN_CLASS); - contextParameters.getLockManagerParameters().setPluginClass(DEFAULT_LOCK_MANAGER_PLUGIN_CLASS); - runConcurrentContextMetrics("JVMLocal"); - - LOGGER.debug("Ran concurrentContextMetricsJVMLocalVarSet metrics"); - } - - /** - * Concurrent context metrics hazelcast. - * - * @throws IOException the IO exception - * @throws ApexException the apex exception - */ - private void concurrentContextMetricsHazelcast() throws ApexException { - if (configrationProvider.getJvmCount() != 1) { - return; - } - - LOGGER.debug("Running concurrentContextMetricsHazelcast metrics . . ."); - - final ContextParameters contextParameters = new ContextParameters(); - contextParameters.getDistributorParameters().setPluginClass(DEFAULT_DISTRIBUTOR_PLUGIN_CLASS); - contextParameters.getLockManagerParameters().setPluginClass(HazelcastLockManager.class.getCanonicalName()); - runConcurrentContextMetrics("Hazelcast"); - - LOGGER.debug("Ran concurrentContextMetricsHazelcast metrics"); - } - - /** - * Concurrent context metrics curator. - * - * @throws IOException the IO exception - * @throws ApexException the apex exception - */ - private void concurrentContextMetricsCurator() throws ApexException { - if (configrationProvider.getJvmCount() != 1) { - return; - } - - LOGGER.debug("Running concurrentContextMetricsCurator metrics . . ."); - - final ContextParameters contextParameters = new ContextParameters(); - contextParameters.getDistributorParameters().setPluginClass(DEFAULT_DISTRIBUTOR_PLUGIN_CLASS); - - final CuratorLockManagerParameters curatorParameters = new CuratorLockManagerParameters(); - curatorParameters.setPluginClass(CuratorLockManager.class.getCanonicalName()); - contextParameters.setLockManagerParameters(curatorParameters); - curatorParameters.setZookeeperAddress(zookeeperAddress); - - runConcurrentContextMetrics("Curator"); - - LOGGER.debug("Ran concurrentContextMetricsCurator metrics"); - } - - /** - * Concurrent context metrics hazelcast multi JVM hazelcast lock. - * - * @throws IOException the IO exception - * @throws ApexException the apex exception - */ - private void concurrentContextMetricsHazelcastMultiJvmHazelcastLock() throws ApexException { - LOGGER.debug("Running concurrentContextMetricsHazelcastMultiJVMHazelcastLock metrics . . ."); - - final ContextParameters contextParameters = new ContextParameters(); - final DistributorParameters distributorParameters = contextParameters.getDistributorParameters(); - distributorParameters.setPluginClass(HazelcastContextDistributor.class.getCanonicalName()); - contextParameters.getLockManagerParameters().setPluginClass(HazelcastLockManager.class.getCanonicalName()); - runConcurrentContextMetrics("HazelcastMultiJVMHazelcastLock"); - - LOGGER.debug("Ran concurrentContextMetricsHazelcastMultiJVMHazelcastLock metrics"); - } - - /** - * Concurrent context metrics infinispan multi JVM hazelcastlock. - * - * @throws IOException the IO exception - * @throws ApexException the apex exception - */ - private void concurrentContextMetricsInfinispanMultiJvmHazelcastlock() throws ApexException { - LOGGER.debug("Running concurrentContextMetricsInfinispanMultiJVMHazelcastlock metrics . . ."); - - final ContextParameters contextParameters = new ContextParameters(); - final DistributorParameters distributorParameters = contextParameters.getDistributorParameters(); - distributorParameters.setPluginClass(InfinispanContextDistributor.class.getCanonicalName()); - contextParameters.getLockManagerParameters().setPluginClass(HazelcastLockManager.class.getCanonicalName()); - - final InfinispanDistributorParameters infinispanParameters = new InfinispanDistributorParameters(); - contextParameters.setDistributorParameters(infinispanParameters); - - runConcurrentContextMetrics("InfinispanMultiJVMHazelcastlock"); - - LOGGER.debug("Ran concurrentContextMetricsInfinispanMultiJVMHazelcastlock metrics"); - } - - /** - * Concurrent context metrics infinispan multi JVM curator lock. - * - * @throws IOException the IO exception - * @throws ApexException the apex exception - * @throws InterruptedException on interrupts - */ - private void concurrentContextMetricsInfinispanMultiJvmCuratorLock() - throws ApexException { - - LOGGER.debug("Running concurrentContextMetricsInfinispanMultiJVMCuratorLock metrics . . ."); - - final ZooKeeperServerServiceProvider zooKeeperServerServiceProvider = new ZooKeeperServerServiceProvider( - zookeeperDirectory, zookeeperAddress, zookeeperPort); - try { - zooKeeperServerServiceProvider.startZookeeperServer(); - final ContextParameters contextParameters = new ContextParameters(); - final DistributorParameters distributorParameters = contextParameters.getDistributorParameters(); - distributorParameters.setPluginClass(InfinispanContextDistributor.class.getCanonicalName()); - - final CuratorLockManagerParameters curatorParameters = new CuratorLockManagerParameters(); - curatorParameters.setPluginClass(CuratorLockManager.class.getCanonicalName()); - contextParameters.setLockManagerParameters(curatorParameters); - curatorParameters.setZookeeperAddress(zookeeperAddress); - - final InfinispanDistributorParameters infinispanParameters = new InfinispanDistributorParameters(); - contextParameters.setDistributorParameters(infinispanParameters); - - runConcurrentContextMetrics("InfinispanMultiJVMCuratorLock"); - } finally { - zooKeeperServerServiceProvider.stopZookeeperServer(); - } - LOGGER.debug("Ran concurrentContextMetricsInfinispanMultiJVMCuratorLock metrics"); - } - - /** - * Concurrent context metrics hazelcast multi JVM curator lock. - * - * @throws IOException the IO exception - * @throws ApexException the apex exception - * @throws InterruptedException on interrupts - */ - private void concurrentContextMetricsHazelcastMultiJvmCuratorLock() - throws ApexException { - LOGGER.debug("Running concurrentContextMetricsHazelcastMultiJVMCuratorLock metrics . . ."); - - final ZooKeeperServerServiceProvider zooKeeperServerServiceProvider = new ZooKeeperServerServiceProvider( - zookeeperDirectory, zookeeperAddress, zookeeperPort); - - try { - zooKeeperServerServiceProvider.startZookeeperServer(); - final ContextParameters contextParameters = new ContextParameters(); - final DistributorParameters distributorParameters = contextParameters.getDistributorParameters(); - distributorParameters.setPluginClass(HazelcastContextDistributor.class.getCanonicalName()); - - final CuratorLockManagerParameters curatorParameters = new CuratorLockManagerParameters(); - curatorParameters.setPluginClass(CuratorLockManager.class.getCanonicalName()); - contextParameters.setLockManagerParameters(curatorParameters); - curatorParameters.setZookeeperAddress(zookeeperAddress); - - runConcurrentContextMetrics("HazelcastMultiJVMCuratorLock"); - } finally { - zooKeeperServerServiceProvider.stopZookeeperServer(); - } - LOGGER.debug("Ran concurrentContextMetricsHazelcastMultiJVMCuratorLock metrics"); - } - - /** - * Run concurrent context metrics. - * - * @param testName the test name - * @throws IOException the IO exception - * @throws ApexException the apex exception - */ - private void runConcurrentContextMetrics(final String testName) throws ApexException { - final ConcurrentContext concurrentContext = new ConcurrentContext(configrationProvider); - - LOGGER.info("Running {} ...", testName); - final Map<String, TestContextLongItem> result = concurrentContext.testConcurrentContext(); - - long total = 0; - for (final Entry<String, TestContextLongItem> entry : result.entrySet()) { - LOGGER.trace("Album key: {}, value: {}", entry.getKey(), entry.getValue()); - total += entry.getValue().getLongValue(); - } - LOGGER.info("Album total value after execution: {}", total); - - LOGGER.info("Completed {} ...", testName); - } - - /** - * The main method. - * - * @param args the args - * @throws Exception the exception - */ - public static void main(final String[] args) throws Exception { - if (args.length != NUM_ARGS) { - String errorMessage = "Args: " + Arrays.toString(args) - + "\nusage: testLabel jvmCount threadCount threadLoops longArraySize lockType " - + "zookeeperAddress zookeeperPort zookeeperDirectory"; - LOGGER.info(errorMessage); - return; - } - - final ConfigrationProvider configrationProvider = new ConfigrationProviderImpl(args[ARG_LABEL], - Integer.valueOf(args[ARG_JVM_COUNT]), Integer.valueOf(args[ARG_THREAD_COUNT]), - Integer.valueOf(args[ARG_ITERATIONS]), Integer.valueOf(args[ARG_ARRAY_SIZE]), - Integer.valueOf(args[ARG_LOCK_TYPE])); - - final ConcurrentContextMetrics concurrentContextMetrics = new ConcurrentContextMetrics(configrationProvider, - args[ARG_ZOOKEEPER_ADDRESS], Integer.valueOf(args[ARG_ZOOKEEPER_PORT]), - args[ARG_ZOOKEEPER_DIRECTORY]); - - concurrentContextMetrics.concurrentContextMetricsJvmLocal(); - concurrentContextMetrics.concurrentContextMetricsCurator(); - concurrentContextMetrics.concurrentContextMetricsHazelcast(); - concurrentContextMetrics.concurrentContextMetricsHazelcastMultiJvmHazelcastLock(); - concurrentContextMetrics.concurrentContextMetricsInfinispanMultiJvmHazelcastlock(); - concurrentContextMetrics.concurrentContextMetricsInfinispanMultiJvmCuratorLock(); - concurrentContextMetrics.concurrentContextMetricsHazelcastMultiJvmCuratorLock(); - } -} diff --git a/testsuites/performance/performance-context-metrics/src/main/java/org/onap/policy/apex/testsuites/performance/context/metrics/package-info.java b/testsuites/performance/performance-context-metrics/src/main/java/org/onap/policy/apex/testsuites/performance/context/metrics/package-info.java deleted file mode 100644 index 9bb84d76b..000000000 --- a/testsuites/performance/performance-context-metrics/src/main/java/org/onap/policy/apex/testsuites/performance/context/metrics/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========================================================= - */ - -/** - * Used to get metrics on the performance of Context Album performance for various types of - * distribution and locking mechanisms in APEX. - * - * @author Liam Fallon (liam.fallon@ericsson.com) - */ -package org.onap.policy.apex.testsuites.performance.context.metrics; diff --git a/testsuites/performance/performance-context-metrics/src/site/css/site.css b/testsuites/performance/performance-context-metrics/src/site/css/site.css deleted file mode 100644 index ef8bd4d15..000000000 --- a/testsuites/performance/performance-context-metrics/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/testsuites/performance/performance-context-metrics/src/site/images/logos.png b/testsuites/performance/performance-context-metrics/src/site/images/logos.png Binary files differdeleted file mode 100644 index 915d6e59d..000000000 --- a/testsuites/performance/performance-context-metrics/src/site/images/logos.png +++ /dev/null diff --git a/testsuites/performance/performance-context-metrics/src/site/site.xml b/testsuites/performance/performance-context-metrics/src/site/site.xml deleted file mode 100644 index 937759ed5..000000000 --- a/testsuites/performance/performance-context-metrics/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 Testsuites Performance Context-Metrics"> - <body> - <menu name="APEX Testsuites Performance Context-Metrics"> - <item href="javadocs/index.html" name="API Doc" /> - </menu> - <menu ref="reports" inherit="top" /> - <menu ref="modules" /> - - <breadcrumbs> - <item name="Context-Metrics" href="index.html" /> - </breadcrumbs> - </body> -</project>
\ No newline at end of file diff --git a/testsuites/performance/performance-context-metrics/src/test/java/org/onap/policy/apex/testsuites/performance/context/metrics/MetricsTest.java b/testsuites/performance/performance-context-metrics/src/test/java/org/onap/policy/apex/testsuites/performance/context/metrics/MetricsTest.java deleted file mode 100644 index af6b46918..000000000 --- a/testsuites/performance/performance-context-metrics/src/test/java/org/onap/policy/apex/testsuites/performance/context/metrics/MetricsTest.java +++ /dev/null @@ -1,94 +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.testsuites.performance.context.metrics; - -import static org.junit.Assert.fail; - -import java.io.File; -import java.io.IOException; -import java.util.Arrays; -import java.util.SortedSet; - -import org.junit.BeforeClass; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.TemporaryFolder; -import org.onap.policy.apex.context.test.utils.NetworkUtils; -import org.onap.policy.apex.testsuites.performance.context.metrics.ConcurrentContextMetrics; -import org.onap.policy.common.utils.resources.ResourceUtils; -import org.slf4j.ext.XLogger; -import org.slf4j.ext.XLoggerFactory; - -/** - * The Class TestMetrics. - */ -public class MetricsTest { - // Logger for this class - private static final XLogger LOGGER = XLoggerFactory.getXLogger(MetricsTest.class); - private static final String HAZELCAST_CONFIG = "hazelcast.config"; - - private static final String JAVA_NET_PREFER_IPV4_STACK = "java.net.preferIPv4Stack"; - private static final String HAZELCAST_XML_FILE = "src/test/resources/hazelcast/hazelcast.xml"; - - @Rule - public final TemporaryFolder folder = new TemporaryFolder(); - - /** - * Configure. - * - * @throws Exception the exception - */ - @BeforeClass - public static void configure() throws Exception { - System.setProperty(JAVA_NET_PREFER_IPV4_STACK, "true"); - final String hazelCastfileLocation = ResourceUtils.getFilePath4Resource(HAZELCAST_XML_FILE); - System.setProperty(HAZELCAST_CONFIG, hazelCastfileLocation); - - final SortedSet<String> ipAddressSet = NetworkUtils.getIPv4NonLoopAddresses(); - - if (ipAddressSet.size() == 0) { - throw new Exception("cound not find real IP address for test"); - } - LOGGER.info("For Infinispan, setting jgroups.tcp.address to: {}", ipAddressSet.first()); - System.setProperty("jgroups.tcp.address", ipAddressSet.first()); - - } - - /** - * Gets the single jvm metrics. - * - * @throws IOException Signals that an I/O exception has occurred. - */ - @Test - public void getSingleJvmMetrics() throws IOException { - final File zookeeperDirectory = folder.newFolder("zookeeperDirectory"); - final String[] args = {"singleJVMTestNL", "1", "32", "1000", "65536", "0", "localhost", "62181", - zookeeperDirectory.getAbsolutePath()}; - - LOGGER.info("Starting with args: {}", Arrays.toString(args)); - try { - ConcurrentContextMetrics.main(args); - } catch (final Exception exception) { - LOGGER.error("Unexpected error", exception); - fail("Metrics test failed"); - } - } -} diff --git a/testsuites/performance/performance-context-metrics/src/test/resources/hazelcast/hazelcast.xml b/testsuites/performance/performance-context-metrics/src/test/resources/hazelcast/hazelcast.xml deleted file mode 100644 index 932b33cc9..000000000 --- a/testsuites/performance/performance-context-metrics/src/test/resources/hazelcast/hazelcast.xml +++ /dev/null @@ -1,63 +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========================================================= ---> - -<hazelcast xmlns="http://www.hazelcast.com/schema/config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <group> - <name>HazelcastGroup3.0EVAL</name> - <password>password3.0EVAL</password> - </group> - <network> - <port auto-increment="true">5706</port> - <join> - <multicast enabled="false"> - <multicast-group>224.2.2.10</multicast-group> - <multicast-port>54327</multicast-port> - </multicast> - <tcp-ip enabled="true"> - <members>127.0.0.1</members> - </tcp-ip> - </join> - <interfaces enabled="false"> - <!-- This value will allow hazelcast to run locally from the IDE --> - <interface>127.0.0.*</interface> - </interfaces> - </network> - <properties> - <property name="hazelcast.icmp.enabled">false</property> - <property name="hazelcast.logging.type">slf4j</property> - <!-- disable the hazelcast shutdown hook - prefer to control the shutdown - in code --> - <property name="hazelcast.shutdownhook.enabled">false</property> - <property name="hazelcast.graceful.shutdown.max.wait">60</property> - <property name="hazelcast.operation.generic.thread.count">1</property> - <property name="hazelcast.operation.thread.count">1</property> - <property name="hazelcast.clientengine.thread.count">1</property> - <property name="hazelcast.client.event.thread.count">1</property> - <property name="hazelcast.event.thread.count">1</property> - <property name="hazelcast.io.output.thread.count">1</property> - <property name="hazelcast.io.thread.count">1</property> - <property name="hazelcast.executor.client.thread.count">1</property> - <property name="hazelcast.clientengine.thread.count">1</property> - </properties> - <executor-service> - <pool-size>2</pool-size> - </executor-service> -</hazelcast> diff --git a/testsuites/performance/performance-context-metrics/src/test/resources/infinispan/default-jgroups-tcp.xml b/testsuites/performance/performance-context-metrics/src/test/resources/infinispan/default-jgroups-tcp.xml deleted file mode 100644 index 028cf1df6..000000000 --- a/testsuites/performance/performance-context-metrics/src/test/resources/infinispan/default-jgroups-tcp.xml +++ /dev/null @@ -1,76 +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========================================================= ---> - -<config xmlns="urn:org:jgroups" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="urn:org:jgroups http://www.jgroups.org/schema/jgroups-4.0.xsd"> - <TCP bind_addr="${jgroups.tcp.address:127.0.0.1}" - bind_port="${jgroups.tcp.port:7800}" - enable_diagnostics="false" - thread_naming_pattern="pl" - send_buf_size="640k" - sock_conn_timeout="300" - bundler_type="no-bundler" - - thread_pool.min_threads="${jgroups.thread_pool.min_threads:0}" - thread_pool.max_threads="${jgroups.thread_pool.max_threads:200}" - thread_pool.keep_alive_time="60000" - /> - <MPING bind_addr="${jgroups.tcp.address:127.0.0.1}" - mcast_addr="${jgroups.mping.mcast_addr:228.2.4.6}" - mcast_port="${jgroups.mping.mcast_port:43366}" - ip_ttl="${jgroups.udp.ip_ttl:2}" - /> - <MERGE3 min_interval="10000" - max_interval="30000" - /> - <FD_SOCK /> - <FD_ALL timeout="60000" - interval="15000" - timeout_check_interval="5000" - /> - <VERIFY_SUSPECT timeout="5000" /> - <pbcast.NAKACK2 use_mcast_xmit="false" - xmit_interval="100" - xmit_table_num_rows="50" - xmit_table_msgs_per_row="1024" - xmit_table_max_compaction_time="30000" - resend_last_seqno="true" - /> - <UNICAST3 xmit_interval="100" - xmit_table_num_rows="50" - xmit_table_msgs_per_row="1024" - xmit_table_max_compaction_time="30000" - conn_expiry_timeout="0" - /> - <pbcast.STABLE stability_delay="500" - desired_avg_gossip="5000" - max_bytes="1M" - /> - <pbcast.GMS print_local_addr="false" - install_view_locally_first="true" - join_timeout="${jgroups.join_timeout:5000}" - /> - <MFC max_credits="2m" - min_threshold="0.40" - /> - <FRAG3/> -</config> diff --git a/testsuites/performance/performance-context-metrics/src/test/resources/infinispan/infinispan.xml b/testsuites/performance/performance-context-metrics/src/test/resources/infinispan/infinispan.xml deleted file mode 100644 index 5b416f50d..000000000 --- a/testsuites/performance/performance-context-metrics/src/test/resources/infinispan/infinispan.xml +++ /dev/null @@ -1,41 +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========================================================= ---> - -<infinispan xmlns="urn:infinispan:config:8.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="urn:infinispan:config:8.0 http://infinispan.org/schemas/infinispan-config-8.0.xsd"> - <jgroups> - <stack-file name="external-file" path="infinispan/default-jgroups-tcp.xml" /> - </jgroups> - - <cache-container name="ApexCacheContainer" default-cache="TestContext_0.0.1"> - <transport cluster="apexCluster" stack="external-file" /> - <jmx /> - <replicated-cache name="LargeContextMap_0.0.1" mode="SYNC" statistics="true"> - <state-transfer enabled="true" /> - </replicated-cache> - <replicated-cache name="LongSameTypeContextMap_0.0.1" mode="SYNC" statistics="true"> - <state-transfer enabled="true" /> - </replicated-cache> - <replicated-cache name="TestContext_0.0.1" mode="SYNC"> - <state-transfer enabled="true" /> - </replicated-cache> - </cache-container> -</infinispan> diff --git a/testsuites/performance/pom.xml b/testsuites/performance/pom.xml index 8682871cd..501cf658d 100644 --- a/testsuites/performance/pom.xml +++ b/testsuites/performance/pom.xml @@ -1,6 +1,7 @@ <!-- ============LICENSE_START======================================================= Copyright (C) 2018 Ericsson. All rights reserved. + Modifications Copyright (C) 2019 Nordix Foundation. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -48,7 +49,6 @@ </property> </activation> <modules> - <module>performance-context-metrics</module> <module>performance-benchmark-test</module> </modules> </profile> @@ -68,4 +68,4 @@ </distributionManagement> </profile> </profiles> -</project>
\ No newline at end of file +</project> |