aboutsummaryrefslogtreecommitdiffstats
path: root/services/activity-spec/activity-spec-web
diff options
context:
space:
mode:
authorshrikantawachar <shrikant.awachar@amdocs.com>2018-03-22 15:01:28 +0530
committerOren Kleks <orenkle@amdocs.com>2018-03-22 15:02:46 +0000
commit79550d5dc1c5bcb79123128aa37b381a368e38d9 (patch)
tree0b8391355c6bcd5cafb2ae48ed2871fc905ca8e5 /services/activity-spec/activity-spec-web
parent473f768e025412d43afa1f403ba638b913ffce83 (diff)
Enhance Activity Spec
Enhance Activity Spec to include additional fields type and content. Change-Id: Ic39aa21ef265bf07a5522a2f46f84d378316c7aa Issue-ID: SDC-1048 Signed-off-by: shrikantawachar <shrikant.awachar@amdocs.com>
Diffstat (limited to 'services/activity-spec/activity-spec-web')
-rw-r--r--services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/mapping/MapActivitySpecRequestDtoToActivitySpecEntity.java10
-rw-r--r--services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/mapping/MapActivitySpecToActivitySpecGetResponse.java10
-rw-r--r--services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/types/ActivitySpecGetResponse.java6
-rw-r--r--services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/types/ActivitySpecRequestDto.java6
-rw-r--r--services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/be/dao/impl/ActivitySpecDaoZusammenImpl.java12
-rw-r--r--services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/be/dao/types/ActivitySpecEntity.java6
-rw-r--r--services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/be/datatypes/ActivitySpecData.java6
-rw-r--r--services/activity-spec/activity-spec-web/activity-spec-service/src/test/java/org/openecomp/activityspec/be/dao/impl/ActivitySpecZusammenDaoImplTest.java6
-rw-r--r--services/activity-spec/activity-spec-web/activity-spec-service/src/test/java/org/openecomp/activityspec/be/impl/ActivitySpecManagerImplTest.java10
-rw-r--r--services/activity-spec/activity-spec-web/activity-spec-service/src/test/java/org/openecomp/activityspec/mocks/ItemManagerMock.java16
10 files changed, 55 insertions, 33 deletions
diff --git a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/mapping/MapActivitySpecRequestDtoToActivitySpecEntity.java b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/mapping/MapActivitySpecRequestDtoToActivitySpecEntity.java
index 2062fe273b..2364d59629 100644
--- a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/mapping/MapActivitySpecRequestDtoToActivitySpecEntity.java
+++ b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/mapping/MapActivitySpecRequestDtoToActivitySpecEntity.java
@@ -35,17 +35,19 @@ public class MapActivitySpecRequestDtoToActivitySpecEntity
target.setDescription(source.getDescription());
target.setCategoryList(source.getCategoryList() == null ? new ArrayList<String>()
: source.getCategoryList());
- if (Objects.nonNull(source.getInputParameters())) {
- target.setInputParameters(source.getInputParameters().stream()
+ if (Objects.nonNull(source.getInputs())) {
+ target.setInputs(source.getInputs().stream()
.map(activitySpecParameterDto -> new MapDtoToActivityParameter()
.applyMapping(activitySpecParameterDto, ActivitySpecParameter.class))
.collect(Collectors.toList()));
}
- if (Objects.nonNull(source.getOutputParameters())) {
- target.setOutputParameters(source.getOutputParameters().stream()
+ if (Objects.nonNull(source.getOutputs())) {
+ target.setOutputs(source.getOutputs().stream()
.map(activitySpecParameterDto -> new MapDtoToActivityParameter()
.applyMapping(activitySpecParameterDto, ActivitySpecParameter.class))
.collect(Collectors.toList()));
}
+ target.setType(source.getType());
+ target.setContent(source.getContent());
}
}
diff --git a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/mapping/MapActivitySpecToActivitySpecGetResponse.java b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/mapping/MapActivitySpecToActivitySpecGetResponse.java
index 25e0f6e9c4..697e1bd667 100644
--- a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/mapping/MapActivitySpecToActivitySpecGetResponse.java
+++ b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/mapping/MapActivitySpecToActivitySpecGetResponse.java
@@ -32,18 +32,20 @@ public class MapActivitySpecToActivitySpecGetResponse extends MappingBase<Activi
target.setName(source.getName());
target.setDescription(source.getDescription());
target.setCategoryList(source.getCategoryList());
- if (Objects.nonNull(source.getInputParameters())) {
- target.setInputParameters(source.getInputParameters().stream().map(
+ if (Objects.nonNull(source.getInputs())) {
+ target.setInputs(source.getInputs().stream().map(
activitySpecParameter -> new MapActivityParameterToDto()
.applyMapping(activitySpecParameter, ActivitySpecParameterDto
.class)).collect(Collectors.toList()));
}
- if (Objects.nonNull(source.getOutputParameters())) {
- target.setOutputParameters(source.getOutputParameters().stream().map(
+ if (Objects.nonNull(source.getOutputs())) {
+ target.setOutputs(source.getOutputs().stream().map(
activitySpecParameter -> new MapActivityParameterToDto()
.applyMapping(activitySpecParameter, ActivitySpecParameterDto
.class)).collect(Collectors.toList()));
}
target.setStatus(source.getStatus());
+ target.setType(source.getType());
+ target.setContent(source.getContent());
}
}
diff --git a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/types/ActivitySpecGetResponse.java b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/types/ActivitySpecGetResponse.java
index cf3fa969fa..9453935559 100644
--- a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/types/ActivitySpecGetResponse.java
+++ b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/types/ActivitySpecGetResponse.java
@@ -23,7 +23,9 @@ public class ActivitySpecGetResponse {
private String name;
private String description;
private List<String> categoryList;
- private List<ActivitySpecParameterDto> inputParameters;
- private List<ActivitySpecParameterDto> outputParameters;
+ private List<ActivitySpecParameterDto> inputs;
+ private List<ActivitySpecParameterDto> outputs;
private String status;
+ private String type;
+ private String content;
}
diff --git a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/types/ActivitySpecRequestDto.java b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/types/ActivitySpecRequestDto.java
index 77ea393ce3..67455f9c9e 100644
--- a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/types/ActivitySpecRequestDto.java
+++ b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/types/ActivitySpecRequestDto.java
@@ -32,6 +32,8 @@ public class ActivitySpecRequestDto {
private String description;
private List<String> categoryList;
- private List<ActivitySpecParameterDto> inputParameters;
- private List<ActivitySpecParameterDto> outputParameters;
+ private List<ActivitySpecParameterDto> inputs;
+ private List<ActivitySpecParameterDto> outputs;
+ private String type;
+ private String content;
}
diff --git a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/be/dao/impl/ActivitySpecDaoZusammenImpl.java b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/be/dao/impl/ActivitySpecDaoZusammenImpl.java
index d9d495a01a..0dabcca984 100644
--- a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/be/dao/impl/ActivitySpecDaoZusammenImpl.java
+++ b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/be/dao/impl/ActivitySpecDaoZusammenImpl.java
@@ -112,8 +112,10 @@ public class ActivitySpecDaoZusammenImpl implements ActivitySpecDao {
private void enrichEntityFromElementData(ActivitySpecEntity entity, InputStream data) {
ActivitySpecData activitySpecData = JsonUtil.json2Object(data, ActivitySpecData.class);
if (Objects.nonNull(activitySpecData)) {
- entity.setInputParameters(activitySpecData.getInputParameters());
- entity.setOutputParameters(activitySpecData.getOutputParameters());
+ entity.setInputs(activitySpecData.getInputs());
+ entity.setOutputs(activitySpecData.getOutputs());
+ entity.setType(activitySpecData.getType());
+ entity.setContent(activitySpecData.getContent());
}
}
@@ -127,8 +129,10 @@ public class ActivitySpecDaoZusammenImpl implements ActivitySpecDao {
private void enrichElementDataFromEntity(ZusammenElement element, ActivitySpecEntity entity) {
ActivitySpecData activitySpecData = new ActivitySpecData();
- activitySpecData.setInputParameters(entity.getInputParameters());
- activitySpecData.setOutputParameters(entity.getOutputParameters());
+ activitySpecData.setInputs(entity.getInputs());
+ activitySpecData.setOutputs(entity.getOutputs());
+ activitySpecData.setType(entity.getType());
+ activitySpecData.setContent(entity.getContent());
element.setData(new ByteArrayInputStream(JsonUtil.object2Json(activitySpecData).getBytes()));
}
diff --git a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/be/dao/types/ActivitySpecEntity.java b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/be/dao/types/ActivitySpecEntity.java
index b21e424a2f..2f261f8fa9 100644
--- a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/be/dao/types/ActivitySpecEntity.java
+++ b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/be/dao/types/ActivitySpecEntity.java
@@ -29,8 +29,10 @@ public class ActivitySpecEntity {
private String description;
private List<String> categoryList;
- private List<ActivitySpecParameter> inputParameters;
- private List<ActivitySpecParameter> outputParameters;
+ private List<ActivitySpecParameter> inputs;
+ private List<ActivitySpecParameter> outputs;
+ private String type;
+ private String content;
//Not to be maintained in activityspec element
private String status;
diff --git a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/be/datatypes/ActivitySpecData.java b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/be/datatypes/ActivitySpecData.java
index e884bfc784..ad70376aa2 100644
--- a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/be/datatypes/ActivitySpecData.java
+++ b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/be/datatypes/ActivitySpecData.java
@@ -21,7 +21,9 @@ import java.util.List;
@lombok.Data
public class ActivitySpecData {
- private List<ActivitySpecParameter> inputParameters = Collections.emptyList();
- private List<ActivitySpecParameter> outputParameters = Collections.emptyList();
+ private List<ActivitySpecParameter> inputs = Collections.emptyList();
+ private List<ActivitySpecParameter> outputs = Collections.emptyList();
+ private String type;
+ private String content;
}
diff --git a/services/activity-spec/activity-spec-web/activity-spec-service/src/test/java/org/openecomp/activityspec/be/dao/impl/ActivitySpecZusammenDaoImplTest.java b/services/activity-spec/activity-spec-web/activity-spec-service/src/test/java/org/openecomp/activityspec/be/dao/impl/ActivitySpecZusammenDaoImplTest.java
index e6b8123823..b03f4544d2 100644
--- a/services/activity-spec/activity-spec-web/activity-spec-service/src/test/java/org/openecomp/activityspec/be/dao/impl/ActivitySpecZusammenDaoImplTest.java
+++ b/services/activity-spec/activity-spec-web/activity-spec-service/src/test/java/org/openecomp/activityspec/be/dao/impl/ActivitySpecZusammenDaoImplTest.java
@@ -94,7 +94,7 @@ public class ActivitySpecZusammenDaoImplTest {
inputParams.setValue("localhost");
List<ActivitySpecParameter> inputs = new ArrayList<>();
inputs.add(inputParams);
- entity.setInputParameters(inputs);
+ entity.setInputs(inputs);
}
@AfterMethod
@@ -130,8 +130,8 @@ public class ActivitySpecZusammenDaoImplTest {
.getElement(context, elementContext, zusammenAdaptor.elementId);
final InputStream data = testElement.get().getData();
final ActivitySpecData activitySpecData = JsonUtil.json2Object(data, ActivitySpecData.class);
- Assert.assertEquals(activitySpecData.getInputParameters().get(0).getName(),
- entity.getInputParameters().get(0).getName());
+ Assert.assertEquals(activitySpecData.getInputs().get(0).getName(),
+ entity.getInputs().get(0).getName());
}
@Test
diff --git a/services/activity-spec/activity-spec-web/activity-spec-service/src/test/java/org/openecomp/activityspec/be/impl/ActivitySpecManagerImplTest.java b/services/activity-spec/activity-spec-web/activity-spec-service/src/test/java/org/openecomp/activityspec/be/impl/ActivitySpecManagerImplTest.java
index ce0f2883fa..3576ae81c7 100644
--- a/services/activity-spec/activity-spec-web/activity-spec-service/src/test/java/org/openecomp/activityspec/be/impl/ActivitySpecManagerImplTest.java
+++ b/services/activity-spec/activity-spec-web/activity-spec-service/src/test/java/org/openecomp/activityspec/be/impl/ActivitySpecManagerImplTest.java
@@ -47,7 +47,7 @@ import java.util.List;
public class ActivitySpecManagerImplTest {
private static final String STRING_TYPE = "String";
- ActivitySpecEntity activitySpec;
+ private ActivitySpecEntity activitySpec;
private ActivitySpecEntity retrieved;
private ActivitySpecEntity input;
private ActivitySpecEntity activitySpecToCreate;
@@ -106,13 +106,13 @@ public class ActivitySpecManagerImplTest {
List<ActivitySpecParameter> inputs = new ArrayList<>();
inputs.add(inputParams);
inputs.add(inputParams1);
- activitySpecToCreate.setInputParameters(inputs);
+ activitySpecToCreate.setInputs(inputs);
ActivitySpecParameter outputParams = new ActivitySpecParameter("status", STRING_TYPE);
outputParams.setValue("started");
List<ActivitySpecParameter> outputs = new ArrayList<>();
outputs.add(outputParams);
- activitySpecToCreate.setOutputParameters(outputs);
+ activitySpecToCreate.setOutputs(outputs);
activitySpec = activitySpecManager.createActivitySpec
(activitySpecToCreate);
@@ -239,7 +239,7 @@ public class ActivitySpecManagerImplTest {
Assert.assertEquals(actual.getName(), expected.getName());
Assert.assertEquals(actual.getDescription(), expected.getDescription());
Assert.assertEquals(actual.getCategoryList(), expected.getCategoryList());
- Assert.assertEquals(actual.getInputParameters(), expected.getInputParameters());
- Assert.assertEquals(actual.getOutputParameters(), expected.getOutputParameters());
+ Assert.assertEquals(actual.getInputs(), expected.getInputs());
+ Assert.assertEquals(actual.getOutputs(), expected.getOutputs());
}
}
diff --git a/services/activity-spec/activity-spec-web/activity-spec-service/src/test/java/org/openecomp/activityspec/mocks/ItemManagerMock.java b/services/activity-spec/activity-spec-web/activity-spec-service/src/test/java/org/openecomp/activityspec/mocks/ItemManagerMock.java
index 667a97b3a4..2a0586c003 100644
--- a/services/activity-spec/activity-spec-web/activity-spec-service/src/test/java/org/openecomp/activityspec/mocks/ItemManagerMock.java
+++ b/services/activity-spec/activity-spec-web/activity-spec-service/src/test/java/org/openecomp/activityspec/mocks/ItemManagerMock.java
@@ -18,9 +18,7 @@ package org.openecomp.activityspec.mocks;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
-import java.util.stream.Collectors;
import org.openecomp.sdc.versioning.dao.types.VersionStatus;
import org.openecomp.sdc.versioning.types.Item;
import org.openecomp.sdc.versioning.ItemManager;
@@ -30,15 +28,14 @@ import java.util.function.Predicate;
public class ItemManagerMock implements ItemManager {
- public String id;
- public Item item;
+ private String id;
+ private Item item;
@Override
public Collection<Item> list(Predicate<Item> predicate) {
List<Item> items = new ArrayList<>();
items.add(item);
- Collection<Item> collection = items;
return items;
}
@@ -61,6 +58,15 @@ public class ItemManagerMock implements ItemManager {
}
+ @Override
+ public void archive(Item item) {
+
+ }
+
+ @Override
+ public void restore(Item item) {
+
+ }
@Override