X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=ONAP-PAP-REST%2Fsrc%2Ftest%2Fjava%2Forg%2Fonap%2Fpolicy%2Fpap%2Fxacml%2Frest%2Fcontroller%2FClosedLoopDictionaryControllerTest.java;h=bd521a9d949d6edbed5d84e6952f55d22ccb7767;hb=ef9258807505ff24e8221bae25d06ab65029397c;hp=d1af82c9382da627263c40e4c16ec4934087b884;hpb=1ef83d84ac1f803280686cca6960d1dc20695ace;p=policy%2Fengine.git diff --git a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/controller/ClosedLoopDictionaryControllerTest.java b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/controller/ClosedLoopDictionaryControllerTest.java index d1af82c93..bd521a9d9 100644 --- a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/controller/ClosedLoopDictionaryControllerTest.java +++ b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/controller/ClosedLoopDictionaryControllerTest.java @@ -27,7 +27,6 @@ import static org.mockito.Mockito.when; import java.io.BufferedReader; import java.io.StringReader; import java.util.ArrayList; -import java.util.Date; import java.util.List; import javax.servlet.http.HttpServletRequest; @@ -81,147 +80,6 @@ public class ClosedLoopDictionaryControllerTest { logger.info("setUp: exit"); } - public List testVSCLAction(){ - List objectData = new ArrayList<>(); - - VSCLAction data = new VSCLAction(); - data.setId(1); - assertTrue(1 == data.getId()); - data.setVsclaction("Test"); - assertTrue("Test".equals(data.getVsclaction())); - data.setDescription("Test"); - assertTrue("Test".equals(data.getDescription())); - data.setCreatedDate(new Date()); - assertTrue(data.getCreatedDate()!= null); - data.setModifiedDate(new Date()); - assertTrue(data.getModifiedDate()!= null); - data.setUserCreatedBy(userInfo); - assertTrue(data.getUserCreatedBy()!= null); - data.setUserModifiedBy(userInfo); - assertTrue(data.getUserModifiedBy()!= null); - objectData.add(data); - - return objectData; - } - - public List testVNFType(){ - List objectData = new ArrayList<>(); - - VNFType data = new VNFType(); - data.setId(1); - assertTrue(1 == data.getId()); - data.setVnftype("Test"); - assertTrue("Test".equals(data.getVnftype())); - data.setDescription("Test"); - assertTrue("Test".equals(data.getDescription())); - data.setCreatedDate(new Date()); - assertTrue(data.getCreatedDate()!= null); - data.setModifiedDate(new Date()); - assertTrue(data.getModifiedDate()!= null); - data.setUserCreatedBy(userInfo); - assertTrue(data.getUserCreatedBy()!= null); - data.setUserModifiedBy(userInfo); - assertTrue(data.getUserModifiedBy()!= null); - objectData.add(data); - - return objectData; - } - - public List testPEPOptions(){ - List objectData = new ArrayList<>(); - - PEPOptions data = new PEPOptions(); - data.setId(1); - assertTrue(1 == data.getId()); - data.setPepName("Test"); - assertTrue("Test".equals(data.getPepName())); - data.setDescription("Test"); - assertTrue("Test".equals(data.getDescription())); - data.setCreatedDate(new Date()); - assertTrue(data.getCreatedDate()!= null); - data.setModifiedDate(new Date()); - assertTrue(data.getModifiedDate()!= null); - data.setUserCreatedBy(userInfo); - assertTrue(data.getUserCreatedBy()!= null); - data.setUserModifiedBy(userInfo); - assertTrue(data.getUserModifiedBy()!= null); - objectData.add(data); - - return objectData; - } - - public List testVarbindDictionary(){ - List objectData = new ArrayList<>(); - - VarbindDictionary data = new VarbindDictionary(); - data.setId(1); - assertTrue(1 == data.getId()); - data.setVarbindName("Test"); - assertTrue("Test".equals(data.getVarbindName())); - data.setVarbindDescription("Test"); - assertTrue("Test".equals(data.getVarbindDescription())); - data.setVarbindOID("Test"); - assertTrue("Test".equals(data.getVarbindOID())); - data.setCreatedDate(new Date()); - assertTrue(data.getCreatedDate()!= null); - data.setModifiedDate(new Date()); - assertTrue(data.getModifiedDate()!= null); - data.setUserCreatedBy(userInfo); - assertTrue(data.getUserCreatedBy()!= null); - data.setUserModifiedBy(userInfo); - assertTrue(data.getUserModifiedBy()!= null); - objectData.add(data); - - return objectData; - } - - public List testClosedLoopD2Services(){ - List objectData = new ArrayList<>(); - - ClosedLoopD2Services data = new ClosedLoopD2Services(); - data.setId(1); - assertTrue(1 == data.getId()); - data.setServiceName("Test"); - assertTrue("Test".equals(data.getServiceName())); - data.setDescription("Test"); - assertTrue("Test".equals(data.getDescription())); - data.setCreatedDate(new Date()); - assertTrue(data.getCreatedDate()!= null); - data.setModifiedDate(new Date()); - assertTrue(data.getModifiedDate()!= null); - data.setUserCreatedBy(userInfo); - assertTrue(data.getUserCreatedBy()!= null); - data.setUserModifiedBy(userInfo); - assertTrue(data.getUserModifiedBy()!= null); - objectData.add(data); - - return objectData; - } - - - public List testClosedLoopSite(){ - List objectData = new ArrayList<>(); - - ClosedLoopSite data = new ClosedLoopSite(); - data.setId(1); - assertTrue(1 == data.getId()); - data.setSiteName("Test"); - assertTrue("Test".equals(data.getSiteName())); - data.setDescription("Test"); - assertTrue("Test".equals(data.getDescription())); - data.setCreatedDate(new Date()); - assertTrue(data.getCreatedDate()!= null); - data.setModifiedDate(new Date()); - assertTrue(data.getModifiedDate()!= null); - data.setUserCreatedBy(userInfo); - assertTrue(data.getUserCreatedBy()!= null); - data.setUserModifiedBy(userInfo); - assertTrue(data.getUserModifiedBy()!= null); - objectData.add(data); - - return objectData; - } - @Test public void testGetVSCLActionDictionaryByNameEntityData(){ when(commonClassDao.getDataByColumn(VSCLAction.class, "vsclaction")).thenReturn(data); @@ -236,7 +94,7 @@ public class ClosedLoopDictionaryControllerTest { @Test public void testGetVSCLActionDictionaryEntityData(){ - when(commonClassDao.getData(VSCLAction.class)).thenReturn(testVSCLAction()); + when(commonClassDao.getData(VSCLAction.class)).thenReturn(new ArrayList<>()); controller.getVSCLActionDictionaryEntityData(response); try { assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("vsclActionDictionaryDatas")); @@ -260,7 +118,7 @@ public class ClosedLoopDictionaryControllerTest { @Test public void testGetVNFTypeDictionaryEntityData(){ - when(commonClassDao.getData(VNFType.class)).thenReturn(testVNFType()); + when(commonClassDao.getData(VNFType.class)).thenReturn(new ArrayList<>()); controller.getVNFTypeDictionaryEntityData(response); try { assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("vnfTypeDictionaryDatas")); @@ -284,7 +142,7 @@ public class ClosedLoopDictionaryControllerTest { @Test public void testGetPEPOptionsDictionaryEntityData(){ - when(commonClassDao.getData(PEPOptions.class)).thenReturn(testPEPOptions()); + when(commonClassDao.getData(PEPOptions.class)).thenReturn(new ArrayList<>()); controller.getPEPOptionsDictionaryEntityData(response); try { assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("pepOptionsDictionaryDatas")); @@ -308,7 +166,7 @@ public class ClosedLoopDictionaryControllerTest { @Test public void testGetVarbindDictionaryEntityData(){ - when(commonClassDao.getData(VarbindDictionary.class)).thenReturn(testVarbindDictionary()); + when(commonClassDao.getData(VarbindDictionary.class)).thenReturn(new ArrayList<>()); controller.getVarbindDictionaryEntityData(response); try { assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("varbindDictionaryDatas")); @@ -332,7 +190,7 @@ public class ClosedLoopDictionaryControllerTest { @Test public void testGetClosedLoopServiceDictionaryEntityData(){ - when(commonClassDao.getData(ClosedLoopD2Services.class)).thenReturn(testClosedLoopD2Services()); + when(commonClassDao.getData(ClosedLoopD2Services.class)).thenReturn(new ArrayList<>()); controller.getClosedLoopServiceDictionaryEntityData(response); try { assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("closedLoopServiceDictionaryDatas")); @@ -356,7 +214,7 @@ public class ClosedLoopDictionaryControllerTest { @Test public void testGetClosedLoopSiteDictionaryEntityData(){ - when(commonClassDao.getData(ClosedLoopSite.class)).thenReturn(testClosedLoopSite()); + when(commonClassDao.getData(ClosedLoopSite.class)).thenReturn(new ArrayList<>()); controller.getClosedLoopSiteDictionaryEntityData(response); try { assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("closedLoopSiteDictionaryDatas"));