aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandler.java27
-rw-r--r--src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarInstallerImpl.java2
-rw-r--r--src/test/java/org/onap/clamp/clds/it/CldsDaoItCase.java14
-rw-r--r--src/test/java/org/onap/clamp/clds/it/CldsServiceItCase.java25
-rw-r--r--src/test/java/org/onap/clamp/clds/it/sdc/controller/installer/CsarInstallerItCase.java5
-rw-r--r--src/test/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandlerTest.java27
6 files changed, 48 insertions, 52 deletions
diff --git a/src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandler.java b/src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandler.java
index 88354386..1b7cb28c 100644
--- a/src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandler.java
+++ b/src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandler.java
@@ -18,12 +18,11 @@
* limitations under the License.
* ============LICENSE_END============================================
* ===================================================================
- *
+ *
*/
package org.onap.clamp.clds.sdc.controller.installer;
-import com.att.aft.dme2.internal.apache.commons.io.IOUtils;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
@@ -40,6 +39,7 @@ import java.util.Map;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
+import org.apache.commons.io.IOUtils;
import org.onap.clamp.clds.exception.sdc.controller.CsarHandlerException;
import org.onap.clamp.clds.exception.sdc.controller.SdcArtifactInstallerException;
import org.onap.sdc.api.notification.IArtifactInfo;
@@ -91,7 +91,7 @@ public class CsarHandler {
}
public synchronized void save(IDistributionClientDownloadResult resultArtifact)
- throws SdcArtifactInstallerException, SdcToscaParserException {
+ throws SdcArtifactInstallerException, SdcToscaParserException {
try {
logger.info("Writing CSAR file to: " + csarFilePath + " UUID " + artifactElement.getArtifactUUID() + ")");
Path path = Paths.get(csarFilePath);
@@ -104,12 +104,12 @@ public class CsarHandler {
this.loadDcaeBlueprint();
} catch (IOException e) {
throw new SdcArtifactInstallerException(
- "Exception caught when trying to write the CSAR on the file system to " + csarFilePath, e);
+ "Exception caught when trying to write the CSAR on the file system to " + csarFilePath, e);
}
}
private IResourceInstance searchForResourceByInstanceName(String blueprintResourceInstanceName)
- throws SdcArtifactInstallerException {
+ throws SdcArtifactInstallerException {
for (IResourceInstance resource : this.sdcNotification.getResources()) {
String filteredString = resource.getResourceInstanceName().replaceAll("-", "");
filteredString = filteredString.replaceAll(" ", "");
@@ -118,7 +118,7 @@ public class CsarHandler {
}
}
throw new SdcArtifactInstallerException("Error when searching for " + blueprintResourceInstanceName
- + " as ResourceInstanceName in Sdc notification and did not find it");
+ + " as ResourceInstanceName in Sdc notification and did not find it");
}
private void loadDcaeBlueprint() throws IOException, SdcArtifactInstallerException {
@@ -129,21 +129,20 @@ public class CsarHandler {
if (entry.getName().contains(BLUEPRINT_TYPE)) {
BlueprintArtifact blueprintArtifact = new BlueprintArtifact();
blueprintArtifact.setBlueprintArtifactName(
- entry.getName().substring(entry.getName().lastIndexOf('/') + 1, entry.getName().length()));
+ entry.getName().substring(entry.getName().lastIndexOf('/') + 1, entry.getName().length()));
blueprintArtifact
- .setBlueprintInvariantServiceUuid(this.getSdcNotification().getServiceInvariantUUID());
+ .setBlueprintInvariantServiceUuid(this.getSdcNotification().getServiceInvariantUUID());
try (InputStream stream = zipFile.getInputStream(entry)) {
blueprintArtifact.setDcaeBlueprint(IOUtils.toString(stream));
}
blueprintArtifact.setResourceAttached(searchForResourceByInstanceName(entry.getName().substring(
- entry.getName().indexOf(RESOURCE_INSTANCE_NAME_PREFIX)
- + RESOURCE_INSTANCE_NAME_PREFIX.length(),
- entry.getName().indexOf(RESOURCE_INSTANCE_NAME_SUFFIX))));
+ entry.getName().indexOf(RESOURCE_INSTANCE_NAME_PREFIX) + RESOURCE_INSTANCE_NAME_PREFIX.length(),
+ entry.getName().indexOf(RESOURCE_INSTANCE_NAME_SUFFIX))));
this.mapOfBlueprints.put(blueprintArtifact.getResourceAttached().getResourceInstanceName(),
- blueprintArtifact);
+ blueprintArtifact);
logger.info("Found a blueprint entry in the CSAR " + blueprintArtifact.getBlueprintArtifactName()
- + " for resource instance Name "
- + blueprintArtifact.getResourceAttached().getResourceInstanceName());
+ + " for resource instance Name "
+ + blueprintArtifact.getResourceAttached().getResourceInstanceName());
}
}
logger.info(this.mapOfBlueprints.size() + " blueprint(s) will be converted to closed loop");
diff --git a/src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarInstallerImpl.java b/src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarInstallerImpl.java
index 36947aa9..382c1d77 100644
--- a/src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarInstallerImpl.java
+++ b/src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarInstallerImpl.java
@@ -23,7 +23,6 @@
package org.onap.clamp.clds.sdc.controller.installer;
-import com.att.aft.dme2.internal.apache.commons.io.IOUtils;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
import com.fasterxml.jackson.databind.node.ObjectNode;
@@ -38,6 +37,7 @@ import java.util.Map.Entry;
import javax.annotation.PostConstruct;
import javax.xml.transform.TransformerException;
+import org.apache.commons.io.IOUtils;
import org.json.simple.parser.ParseException;
import org.onap.clamp.clds.client.DcaeInventoryServices;
import org.onap.clamp.clds.config.sdc.BlueprintParserFilesConfiguration;
diff --git a/src/test/java/org/onap/clamp/clds/it/CldsDaoItCase.java b/src/test/java/org/onap/clamp/clds/it/CldsDaoItCase.java
index f4ab0744..12fa2932 100644
--- a/src/test/java/org/onap/clamp/clds/it/CldsDaoItCase.java
+++ b/src/test/java/org/onap/clamp/clds/it/CldsDaoItCase.java
@@ -18,7 +18,7 @@
* limitations under the License.
* ============LICENSE_END============================================
* ===================================================================
- *
+ *
*/
package org.onap.clamp.clds.it;
@@ -27,7 +27,6 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
-import com.att.aft.dme2.internal.apache.commons.lang.RandomStringUtils;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
@@ -39,6 +38,7 @@ import java.util.List;
import javax.ws.rs.NotFoundException;
import org.apache.commons.codec.DecoderException;
+import org.apache.commons.lang3.RandomStringUtils;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -74,9 +74,9 @@ public class CldsDaoItCase {
/**
* Setup the variable before the tests execution.
- *
+ *
* @throws IOException
- * In case of issues when opening the files
+ * In case of issues when opening the files
*/
@Before
public void setupBefore() throws IOException {
@@ -152,7 +152,7 @@ public class CldsDaoItCase {
newModel.setTemplateId(newTemplate.getId());
newModel.setDocText(newTemplate.getPropText());
CldsEvent.insEvent(cldsDao, newModel, "user", CldsEvent.ACTION_RESTART, CldsEvent.ACTION_STATE_COMPLETED,
- "process-instance-id");
+ "process-instance-id");
}
@Test
@@ -168,7 +168,7 @@ public class CldsDaoItCase {
@Test
public void testCldsServiceCache() throws GeneralSecurityException, DecoderException, IOException {
CldsServiceData cldsServiceData = sdcCatalogServices
- .getCldsServiceDataWithAlarmConditions("4cc5b45a-1f63-4194-8100-cd8e14248c92");
+ .getCldsServiceDataWithAlarmConditions("4cc5b45a-1f63-4194-8100-cd8e14248c92");
// Test not in cache so should be null
CldsServiceData cldsServiceDataCache = cldsDao.getCldsServiceCache("4cc5b45a-1f63-4194-8100-cd8e14248c92");
assertNull(cldsServiceDataCache);
@@ -181,7 +181,7 @@ public class CldsDaoItCase {
assertNotNull(cldsServiceDataCache.getAgeOfRecord());
assertEquals(4, cldsServiceDataCache.getCldsVfs().get(0).getCldsVfcs().size());
assertEquals("07e266fc-49ab-4cd7-8378-ca4676f1b9ec",
- cldsServiceDataCache.getCldsVfs().get(0).getVfInvariantResourceUUID());
+ cldsServiceDataCache.getCldsVfs().get(0).getVfInvariantResourceUUID());
assertEquals(0, cldsServiceDataCache.getCldsVfs().get(0).getCldsKPIList().size());
// Second update
cldsServiceData.setCldsVfs(null);
diff --git a/src/test/java/org/onap/clamp/clds/it/CldsServiceItCase.java b/src/test/java/org/onap/clamp/clds/it/CldsServiceItCase.java
index baf4673c..e8d52c0e 100644
--- a/src/test/java/org/onap/clamp/clds/it/CldsServiceItCase.java
+++ b/src/test/java/org/onap/clamp/clds/it/CldsServiceItCase.java
@@ -30,19 +30,19 @@ import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import com.att.aft.dme2.internal.apache.commons.lang.RandomStringUtils;
-
import java.io.IOException;
import java.io.InputStream;
import java.security.GeneralSecurityException;
import java.util.LinkedList;
import java.util.List;
import java.util.Properties;
+
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;
@@ -68,10 +68,9 @@ import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
-import org.springframework.security.core.authority.SimpleGrantedAuthority;
+import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.context.SecurityContext;
-import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@@ -216,22 +215,22 @@ public class CldsServiceItCase {
assertTrue(CldsModel.STATUS_ACTIVE.equals(((CldsModel) responseEntity.getBody()).getStatus()));
assertTrue(CldsModel.STATUS_ACTIVE.equals(cldsService.getModel(randomNameModel).getStatus()));
- responseEntity = cldsService.putModelAndProcessAction(CldsEvent.ACTION_STOP,
- randomNameModel, "false", cldsService.getModel(randomNameModel));
+ responseEntity = cldsService.putModelAndProcessAction(CldsEvent.ACTION_STOP, randomNameModel, "false",
+ cldsService.getModel(randomNameModel));
assertTrue(responseEntity.getStatusCode().equals(HttpStatus.OK));
assertNotNull(responseEntity.getBody());
assertTrue(CldsModel.STATUS_STOPPED.equals(((CldsModel) responseEntity.getBody()).getStatus()));
assertTrue(CldsModel.STATUS_STOPPED.equals(cldsService.getModel(randomNameModel).getStatus()));
- responseEntity = cldsService.putModelAndProcessAction(CldsEvent.ACTION_RESTART,
- randomNameModel, "false", cldsService.getModel(randomNameModel));
+ responseEntity = cldsService.putModelAndProcessAction(CldsEvent.ACTION_RESTART, randomNameModel, "false",
+ cldsService.getModel(randomNameModel));
assertTrue(responseEntity.getStatusCode().equals(HttpStatus.OK));
assertNotNull(responseEntity.getBody());
assertTrue(CldsModel.STATUS_ACTIVE.equals(((CldsModel) responseEntity.getBody()).getStatus()));
assertTrue(CldsModel.STATUS_ACTIVE.equals(cldsService.getModel(randomNameModel).getStatus()));
- responseEntity = cldsService.putModelAndProcessAction(CldsEvent.ACTION_UPDATE,
- randomNameModel, "false", cldsService.getModel(randomNameModel));
+ responseEntity = cldsService.putModelAndProcessAction(CldsEvent.ACTION_UPDATE, randomNameModel, "false",
+ cldsService.getModel(randomNameModel));
assertTrue(responseEntity.getStatusCode().equals(HttpStatus.OK));
assertNotNull(responseEntity.getBody());
assertTrue(CldsModel.STATUS_ACTIVE.equals(((CldsModel) responseEntity.getBody()).getStatus()));
@@ -244,15 +243,15 @@ public class CldsServiceItCase {
assertTrue(CldsModel.STATUS_DISTRIBUTED.equals(((CldsModel) responseEntity.getBody()).getStatus()));
assertTrue(CldsModel.STATUS_DISTRIBUTED.equals(cldsService.getModel(randomNameModel).getStatus()));
- responseEntity = cldsService.putModelAndProcessAction(CldsEvent.ACTION_DELETE,
- randomNameModel, "false", cldsService.getModel(randomNameModel));
+ responseEntity = cldsService.putModelAndProcessAction(CldsEvent.ACTION_DELETE, randomNameModel, "false",
+ cldsService.getModel(randomNameModel));
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) {
+ } catch (NotFoundException ne) {
}
diff --git a/src/test/java/org/onap/clamp/clds/it/sdc/controller/installer/CsarInstallerItCase.java b/src/test/java/org/onap/clamp/clds/it/sdc/controller/installer/CsarInstallerItCase.java
index 4dd44437..276f5091 100644
--- a/src/test/java/org/onap/clamp/clds/it/sdc/controller/installer/CsarInstallerItCase.java
+++ b/src/test/java/org/onap/clamp/clds/it/sdc/controller/installer/CsarInstallerItCase.java
@@ -29,15 +29,14 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import com.att.aft.dme2.internal.apache.commons.io.IOUtils;
-import com.att.aft.dme2.internal.apache.commons.lang.RandomStringUtils;
-
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.RandomStringUtils;
import org.json.JSONException;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/src/test/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandlerTest.java b/src/test/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandlerTest.java
index 6d2074c0..725b1ff1 100644
--- a/src/test/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandlerTest.java
+++ b/src/test/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandlerTest.java
@@ -18,7 +18,7 @@
* limitations under the License.
* ============LICENSE_END============================================
* ===================================================================
- *
+ *
*/
package org.onap.clamp.clds.sdc.controller.installer;
@@ -28,8 +28,6 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import com.att.aft.dme2.internal.apache.commons.io.IOUtils;
-
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
@@ -38,6 +36,7 @@ import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
+import org.apache.commons.io.IOUtils;
import org.junit.Test;
import org.mockito.Mockito;
import org.onap.clamp.clds.exception.sdc.controller.CsarHandlerException;
@@ -111,13 +110,13 @@ public class CsarHandlerTest {
private IDistributionClientDownloadResult buildFakeSdcResut() throws IOException {
IDistributionClientDownloadResult resultArtifact = Mockito.mock(IDistributionClientDownloadResult.class);
Mockito.when(resultArtifact.getArtifactPayload()).thenReturn(
- IOUtils.toByteArray(ResourceFileUtil.getResourceAsStream("example/sdc/service-Simsfoimap0112.csar")));
+ IOUtils.toByteArray(ResourceFileUtil.getResourceAsStream("example/sdc/service-Simsfoimap0112.csar")));
return resultArtifact;
}
@Test
public void testSave()
- throws SdcArtifactInstallerException, SdcToscaParserException, CsarHandlerException, IOException {
+ throws SdcArtifactInstallerException, SdcToscaParserException, CsarHandlerException, IOException {
CsarHandler csar = new CsarHandler(buildFakeSdcNotification(), "test-controller", "/tmp/csar-handler-tests");
// Test the save
csar.save(buildFakeSdcResut());
@@ -131,11 +130,11 @@ public class CsarHandlerTest {
assertTrue(blueprint.contains("DCAE-VES-PM-EVENT-v1"));
// Test additional properties from Sdc notif
assertEquals(BLUEPRINT1_NAME,
- csar.getMapOfBlueprints().get(RESOURCE1_INSTANCE_NAME).getBlueprintArtifactName());
- assertEquals(RESOURCE1_UUID, csar.getMapOfBlueprints().get(RESOURCE1_INSTANCE_NAME).getResourceAttached()
- .getResourceInvariantUUID());
+ csar.getMapOfBlueprints().get(RESOURCE1_INSTANCE_NAME).getBlueprintArtifactName());
+ assertEquals(RESOURCE1_UUID,
+ csar.getMapOfBlueprints().get(RESOURCE1_INSTANCE_NAME).getResourceAttached().getResourceInvariantUUID());
assertEquals(SERVICE_UUID,
- csar.getMapOfBlueprints().get(RESOURCE1_INSTANCE_NAME).getBlueprintInvariantServiceUuid());
+ csar.getMapOfBlueprints().get(RESOURCE1_INSTANCE_NAME).getBlueprintInvariantServiceUuid());
// Do some cleanup
Path path = Paths.get(SDC_FOLDER + "/test-controller/" + CSAR_ARTIFACT_NAME);
Files.deleteIfExists(path);
@@ -143,7 +142,7 @@ public class CsarHandlerTest {
@Test
public void testDoubleSave()
- throws SdcArtifactInstallerException, SdcToscaParserException, CsarHandlerException, IOException {
+ throws SdcArtifactInstallerException, SdcToscaParserException, CsarHandlerException, IOException {
CsarHandler csar = new CsarHandler(buildFakeSdcNotification(), "test-controller", "/tmp/csar-handler-tests");
// Test the save
csar.save(buildFakeSdcResut());
@@ -157,11 +156,11 @@ public class CsarHandlerTest {
assertTrue(blueprint.contains("DCAE-VES-PM-EVENT-v1"));
// Test additional properties from Sdc notif
assertEquals(BLUEPRINT1_NAME,
- csar.getMapOfBlueprints().get(RESOURCE1_INSTANCE_NAME).getBlueprintArtifactName());
- assertEquals(RESOURCE1_UUID, csar.getMapOfBlueprints().get(RESOURCE1_INSTANCE_NAME).getResourceAttached()
- .getResourceInvariantUUID());
+ csar.getMapOfBlueprints().get(RESOURCE1_INSTANCE_NAME).getBlueprintArtifactName());
+ assertEquals(RESOURCE1_UUID,
+ csar.getMapOfBlueprints().get(RESOURCE1_INSTANCE_NAME).getResourceAttached().getResourceInvariantUUID());
assertEquals(SERVICE_UUID,
- csar.getMapOfBlueprints().get(RESOURCE1_INSTANCE_NAME).getBlueprintInvariantServiceUuid());
+ csar.getMapOfBlueprints().get(RESOURCE1_INSTANCE_NAME).getBlueprintInvariantServiceUuid());
Path path = Paths.get(SDC_FOLDER + "/test-controller/" + CSAR_ARTIFACT_NAME);
// A double save should simply overwrite the existing
csar.save(buildFakeSdcResut());