Remove SDC query
[clamp.git] / src / test / java / org / onap / clamp / clds / it / CldsServiceItCase.java
index ff65f42..347de4a 100644 (file)
@@ -26,13 +26,10 @@ package org.onap.clamp.clds.it;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
 
 import java.io.IOException;
 import java.io.InputStream;
-import java.security.GeneralSecurityException;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Properties;
@@ -41,9 +38,7 @@ import javax.servlet.http.HttpServletRequest;
 import javax.ws.rs.NotFoundException;
 import javax.xml.transform.TransformerException;
 
-import org.apache.commons.codec.DecoderException;
 import org.apache.commons.lang3.RandomStringUtils;
-import org.json.JSONException;
 import org.json.simple.parser.ParseException;
 import org.junit.Before;
 import org.junit.Test;
@@ -55,7 +50,6 @@ import org.onap.clamp.clds.model.CldsEvent;
 import org.onap.clamp.clds.model.CldsInfo;
 import org.onap.clamp.clds.model.CldsModel;
 import org.onap.clamp.clds.model.CldsMonitoringDetails;
-import org.onap.clamp.clds.model.CldsServiceData;
 import org.onap.clamp.clds.model.CldsTemplate;
 import org.onap.clamp.clds.model.DcaeEvent;
 import org.onap.clamp.clds.service.CldsService;
@@ -161,12 +155,12 @@ public class CldsServiceItCase {
     }
 
     @Test
-    public void testGetCLDSDetails() throws IOException {
-        List<CldsMonitoringDetails> cldsMonitoringDetailsList = cldsService.getCLDSDetails();
+    public void testGetCldsDetails() throws IOException {
+        List<CldsMonitoringDetails> cldsMonitoringDetailsList = cldsService.getCldsDetails();
         assertNotNull(cldsMonitoringDetailsList);
     }
 
-    @Test
+    @Test(expected = NotFoundException.class)
     public void testCompleteFlow() throws TransformerException, ParseException {
         SecurityContext securityContext = Mockito.mock(SecurityContext.class);
         Mockito.when(securityContext.getAuthentication()).thenReturn(authentication);
@@ -260,13 +254,8 @@ public class CldsServiceItCase {
         assertNotNull(responseEntity);
         assertTrue(responseEntity.getStatusCode().equals(HttpStatus.OK));
         assertNotNull(responseEntity.getBody());
-        try {
-            cldsService.getModel(randomNameModel);
-            fail("Should have raised an NotFoundException exception");
-        } catch (NotFoundException ne) {
-
-        }
-
+        // This will raise an exception
+        cldsService.getModel(randomNameModel);
     }
 
     @Test
@@ -277,7 +266,8 @@ public class CldsServiceItCase {
         dcaeEvent.setResourceUUID("1");
         dcaeEvent.setServiceUUID("2");
         assertEquals(cldsService.postDcaeEvent("false", dcaeEvent),
-            "event=created serviceUUID=2 resourceUUID=1 artifactName=ClosedLoop_with-enough-characters_TestArtifact.yml instance count=0 isTest=false");
+            "event=created serviceUUID=2 resourceUUID=1 artifactName="
+                + "ClosedLoop_with-enough-characters_TestArtifact.yml instance count=0 isTest=false");
     }
 
     @Test
@@ -286,35 +276,4 @@ public class CldsServiceItCase {
             ResourceFileUtil.getResourceAsString("example/sdc/expected-result/sdc-properties-global.json"),
             cldsService.getSdcProperties(), true);
     }
-
-    @Test
-    public void testGetSdcServices() throws GeneralSecurityException, DecoderException, JSONException, IOException {
-        String result = cldsService.getSdcServices();
-        JSONAssert.assertEquals(
-            ResourceFileUtil.getResourceAsString("example/sdc/expected-result/all-sdc-services.json"), result, true);
-    }
-
-    @Test
-    public void testGetSdcPropertiesByServiceUuidForRefresh()
-        throws GeneralSecurityException, DecoderException, JSONException, IOException {
-        SecurityContext securityContext = Mockito.mock(SecurityContext.class);
-        Mockito.when(securityContext.getAuthentication()).thenReturn(authentication);
-
-        cldsService.setSecurityContext(securityContext);
-        // Test basic functionalities
-        String result = cldsService.getSdcPropertiesByServiceUUIDForRefresh("4cc5b45a-1f63-4194-8100-cd8e14248c92",
-            false);
-        JSONAssert.assertEquals(
-            ResourceFileUtil.getResourceAsString("example/sdc/expected-result/sdc-properties-4cc5b45a.json"), result,
-            true);
-        // Now test the Cache effect
-        CldsServiceData cldsServiceDataCache = cldsDao.getCldsServiceCache("c95b0e7c-c1f0-4287-9928-7964c5377a46");
-        // Should not be there, so should be null
-        assertNull(cldsServiceDataCache);
-        cldsService.getSdcPropertiesByServiceUUIDForRefresh("c95b0e7c-c1f0-4287-9928-7964c5377a46", true);
-        // Should be there now, so should NOT be null
-        cldsServiceDataCache = cldsDao.getCldsServiceCache("c95b0e7c-c1f0-4287-9928-7964c5377a46");
-        assertNotNull(cldsServiceDataCache);
-        cldsDao.clearServiceCache();
-    }
 }