From: liamfallon Date: Fri, 22 Feb 2019 17:30:59 +0000 (+0000) Subject: Change versions of Zookeeper and C3P0 X-Git-Tag: 2.1.0~45 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=1ba6a3268b220cc99e9ed993553fa6f34f111a39;p=policy%2Fapex-pdp.git Change versions of Zookeeper and C3P0 This review changes the versions of Zookeeper and C3P0 to resolve security issues. It also merges the context test utils module into the context test because that module was misplaced and put an incompatible Zookeeper dependency in the APEX context module. Issue-ID: POLICY-1540 Change-Id: I86048ae1fc8b818611f423d6fd1f4a9fcc3f76f9 Signed-off-by: liamfallon --- 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 @@ - - - 4.0.0 - - org.onap.policy.apex-pdp.context - context - 2.1.0-SNAPSHOT - - - context-test-utils - ${project.artifactId} - [${project.parent.artifactId}] module contain default distributor tests and common test utils - - - - org.onap.policy.apex-pdp.model - context-model - ${project.version} - - - org.onap.policy.apex-pdp.context - context-management - ${project.version} - - - com.google.code.gson - gson - - - org.apache.derby - derby - ${version.derby} - test - - - junit - junit - compile - - - org.apache.curator - curator-test - 4.0.0 - - - log4j - log4j - - - org.apache.zookeeper - zookeeper - - - - - org.apache.zookeeper - zookeeper - 3.5.4-beta - - - - log4j - log4j - - - org.slf4j - slf4j-log4j12 - - - - - - - - apexSite - - - apexSite - - - - - ${project.artifactId}-site - ${apex.adsite.prefix}/modules/${project.parent.artifactId}/${project.artifactId}/ - - - - - \ 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 deleted file mode 100644 index 915d6e59d..000000000 Binary files a/context/context-test-utils/src/site/images/logos.png and /dev/null differ diff --git a/context/context-test-utils/src/site/site.xml b/context/context-test-utils/src/site/site.xml deleted file mode 100644 index eff32000e..000000000 --- a/context/context-test-utils/src/site/site.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - \ 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 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 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 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 getContextAlbumInitValues() { - final Map 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 testMap = new HashMap(); - testMap.put("key", "This is a policy context string"); - - final Map valueMap0 = new HashMap(); - 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 valueMap1 = new HashMap(); - 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 valueMap2 = new HashMap(); - 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 @@ + org.apache.zookeeper zookeeper - 3.5.4-beta + 3.4.13 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-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 @@ - - + + 4.0.0 org.onap.policy.apex-pdp.plugins.plugins-persistence.plugins-persistence-jpa @@ -72,6 +66,17 @@ org.hibernate hibernate-c3p0 ${version.hibernate} + + + com.mchange + c3p0 + + + + + com.mchange + c3p0 + 0.9.5.3 diff --git a/pom.xml b/pom.xml index 147cefdbd..749566459 100644 --- a/pom.xml +++ b/pom.xml @@ -43,7 +43,7 @@ 1.4 1.1.1 2.26 - 5.3.6.Final + 5.3.7.Final 1.4.0-SNAPSHOT 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 @@ - - - 4.0.0 - - org.onap.policy.apex-pdp.testsuites.performance - performance - 2.1.0-SNAPSHOT - - - performance-context-metrics - ${project.artifactId} - [${project.parent.artifactId}] module to calculate metrics using various plugins - - - - org.onap.policy.common - utils - - - org.onap.policy.apex-pdp.core - core-infrastructure - ${project.version} - - - org.onap.policy.apex-pdp.context - context-test-utils - ${project.version} - - - org.onap.policy.apex-pdp.plugins.plugins-context.plugins-context-distribution - plugins-context-distribution-hazelcast - ${project.version} - - - org.onap.policy.apex-pdp.plugins.plugins-context.plugins-context-distribution - plugins-context-distribution-infinispan - ${project.version} - - - org.onap.policy.apex-pdp.plugins.plugins-context.plugins-context-locking - plugins-context-locking-curator - ${project.version} - - - org.onap.policy.apex-pdp.plugins.plugins-context.plugins-context-locking - plugins-context-locking-hazelcast - ${project.version} - - - org.apache.curator - curator-test - 3.2.0 - test - - - - - - apexSite - - - apexSite - - - - - ${project.artifactId}-site - ${apex.adsite.prefix}/modules/testsuites/${project.parent.artifactId}/${project.artifactId}/ - - - - - \ 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 result = concurrentContext.testConcurrentContext(); - - long total = 0; - for (final Entry 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 deleted file mode 100644 index 915d6e59d..000000000 Binary files a/testsuites/performance/performance-context-metrics/src/site/images/logos.png and /dev/null differ 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 @@ - - - - - - - - - - - - - - - - \ 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 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 @@ - - - - - - HazelcastGroup3.0EVAL - password3.0EVAL - - - 5706 - - - 224.2.2.10 - 54327 - - - 127.0.0.1 - - - - - 127.0.0.* - - - - false - slf4j - - false - 60 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - - - 2 - - 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 @@ - - - - - - - - - - - - - - - - - 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 @@ - - - - - - - - - - - - - - - - - - - - - - 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 @@