summaryrefslogtreecommitdiffstats
path: root/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-eclipselink
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@ericsson.com>2018-09-08 15:22:21 +0100
committerliamfallon <liam.fallon@ericsson.com>2018-09-08 15:30:42 +0100
commitb766ce707a431c834518df91d3334475f90d0fdd (patch)
tree5c764397baca3239551d445eb9233bcae480499a /plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-eclipselink
parent07922e8590597e7a74a2059a1b344c92f04771c5 (diff)
Address level 4-6 security issues
Remove commons-compress and chage version of dom4j Also fix checkstyle in affected modules Issue-ID: POLICY-1065 Change-Id: Id37e54a54997656674af37dfd924aec5f69e410a Signed-off-by: liamfallon <liam.fallon@ericsson.com>
Diffstat (limited to 'plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-eclipselink')
-rw-r--r--plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-eclipselink/src/test/java/org/onap/policy/apex/plugins/persistence/jpa/eclipselink/EclipselinkApexDaoTest.java43
1 files changed, 22 insertions, 21 deletions
diff --git a/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-eclipselink/src/test/java/org/onap/policy/apex/plugins/persistence/jpa/eclipselink/EclipselinkApexDaoTest.java b/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-eclipselink/src/test/java/org/onap/policy/apex/plugins/persistence/jpa/eclipselink/EclipselinkApexDaoTest.java
index 4a27bcfa7..21b58f878 100644
--- a/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-eclipselink/src/test/java/org/onap/policy/apex/plugins/persistence/jpa/eclipselink/EclipselinkApexDaoTest.java
+++ b/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-eclipselink/src/test/java/org/onap/policy/apex/plugins/persistence/jpa/eclipselink/EclipselinkApexDaoTest.java
@@ -40,7 +40,7 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey;
import org.onap.policy.apex.model.basicmodel.dao.DaoParameters;
/**
- * Junit tests for class EclipselinkApexDao
+ * Junit tests for class EclipselinkApexDao.
*
* @author Dinh Danh Le (dinh.danh.le@ericsson.com)
*
@@ -48,19 +48,24 @@ import org.onap.policy.apex.model.basicmodel.dao.DaoParameters;
public class EclipselinkApexDaoTest {
- private static final List<AxArtifactKey> TEST_ARTIKEYS = Arrays.asList(new AxArtifactKey[] {
- new AxArtifactKey("ABC", "0.0.1"), new AxArtifactKey("DEF", "0.1.1"), new AxArtifactKey("XYZ", "1.1.1")});
+ private static final List<AxArtifactKey> TEST_ARTIKEYS = Arrays.asList(new AxArtifactKey[]
+ { new AxArtifactKey("ABC", "0.0.1"), new AxArtifactKey("DEF", "0.1.1"), new AxArtifactKey("XYZ", "1.1.1") });
- private final DaoParameters DaoParameters = new DaoParameters();
+ private final DaoParameters daoParameters = new DaoParameters();
private EclipselinkApexDao eclipselinkApexDao = null;
+ /**
+ * Setup the tests.
+ *
+ * @throws ApexException Exceptions from test setup
+ */
@Before
public void setup() throws ApexException {
- DaoParameters.setPluginClass(EclipselinkApexDao.class.getCanonicalName());
- DaoParameters.setPersistenceUnit("DAOTest");
+ daoParameters.setPluginClass(EclipselinkApexDao.class.getCanonicalName());
+ daoParameters.setPersistenceUnit("DAOTest");
eclipselinkApexDao = new EclipselinkApexDao();
- eclipselinkApexDao.init(DaoParameters);
+ eclipselinkApexDao.init(daoParameters);
}
@After
@@ -115,7 +120,6 @@ public class EclipselinkApexDaoTest {
}
}
-
@Test
public void test_getArtifactByReferenceKey() {
final AxArtifactKey artifactKey = new AxArtifactKey("XXX", "0.0.1");
@@ -133,12 +137,11 @@ public class EclipselinkApexDaoTest {
assertNull(eclipselinkApexDao.getArtifact(ReferenceKeyTestEntity.class, anotherReferenceKey));
// assert return only one entity when finding an entity with correct key
- final ReferenceKeyTestEntity retEntity =
- eclipselinkApexDao.getArtifact(ReferenceKeyTestEntity.class, referenceKey);
+ final ReferenceKeyTestEntity retEntity = eclipselinkApexDao.getArtifact(ReferenceKeyTestEntity.class,
+ referenceKey);
assertEquals(referenceKey, retEntity.getKey());
}
-
@Test
public void test_getArtifactByArtifactKey() {
final AxArtifactKey artifactKey = new AxArtifactKey("XXX", "0.0.1");
@@ -152,12 +155,12 @@ public class EclipselinkApexDaoTest {
assertNull(eclipselinkApexDao.getArtifact(ArtifactKeyTestEntity.class, otherArtifactKey));
// assert return only one entity when finding an entity with correct key
- final ArtifactKeyTestEntity retEntity = eclipselinkApexDao.getArtifact(ArtifactKeyTestEntity.class, artifactKey);
+ final ArtifactKeyTestEntity retEntity = eclipselinkApexDao.getArtifact(ArtifactKeyTestEntity.class,
+ artifactKey);
assertNotNull(retEntity);
assertEquals(artifactKey, retEntity.getKey());
}
-
@Test
public void test_deleteByArtifactKey() {
// initialize a list of (3) entities corresponding to the list of testArtiKeys
@@ -177,7 +180,6 @@ public class EclipselinkApexDaoTest {
assertEquals(100.0, remainingEntities.get(0).getDoubleValue(), 0.0);
}
-
@Test
public void test_deleteByReferenceKey() {
// prepare 2 AxArtifactKeys
@@ -185,9 +187,12 @@ public class EclipselinkApexDaoTest {
final AxArtifactKey owner1Key = new AxArtifactKey("Owner1", "0.0.1");
// prepare a list of (3) AxReferenceKeys corresponding to owner0Key
- final List<AxReferenceKey> refKey0s =
- Arrays.asList(new AxReferenceKey[] {new AxReferenceKey(owner0Key, "Entity01"),
- new AxReferenceKey(owner0Key, "Entity02"), new AxReferenceKey(owner0Key, "Entity03")});
+ final List<AxReferenceKey> refKey0s = Arrays.asList(new AxReferenceKey[] {
+ new AxReferenceKey(owner0Key, "Entity01"),
+ new AxReferenceKey(owner0Key, "Entity02"),
+ new AxReferenceKey(owner0Key, "Entity03")
+ });
+
// prepare 2 more AxReferenceKeys corresponding to owner1Key
final AxReferenceKey refKey11 = new AxReferenceKey(owner1Key, "Entity11");
final AxReferenceKey refKey12 = new AxReferenceKey(owner1Key, "Entity12");
@@ -218,7 +223,6 @@ public class EclipselinkApexDaoTest {
assertEquals(0, eclipselinkApexDao.getAll(ReferenceKeyTestEntity.class).size());
}
-
@Test
public void test_getAllByArtifactKey() {
@@ -228,7 +232,6 @@ public class EclipselinkApexDaoTest {
final AxReferenceKey refKey0 = new AxReferenceKey(artiKey0, "Entity0");
final AxReferenceKey refKey1 = new AxReferenceKey(artiKey1, "Entity1");
-
// test with null class with known key --> return an empty list
assertNotNull(eclipselinkApexDao.getAll(null, artiKey1));
assertTrue(eclipselinkApexDao.getAll(null, artiKey1).equals(Collections.emptyList()));
@@ -246,6 +249,4 @@ public class EclipselinkApexDaoTest {
assertEquals(200.0, retEntity.getDoubleValue(), 0);
}
-
-
}