aboutsummaryrefslogtreecommitdiffstats
path: root/workflow-designer-be/src/test/java/org
diff options
context:
space:
mode:
authorayalaben <ayala.benzvi@amdocs.com>2018-08-21 14:45:28 +0300
committerayalaben <ayala.benzvi@amdocs.com>2018-08-22 10:29:56 +0300
commit628397661a8b023a17316f9a501c8bd8af107a3d (patch)
treedd2d7864d0f85f4e4973ce5ac2da670a8ceb11a1 /workflow-designer-be/src/test/java/org
parent26103fb6434f652e98cb8943d9124a29a9f7c5d3 (diff)
Search Workflow by name
Change-Id: Ib45a028638293052865039a1f7bd6bf8b48e8e36 Issue-ID: SDC-1662 Signed-off-by: ayalaben <ayala.benzvi@amdocs.com>
Diffstat (limited to 'workflow-designer-be/src/test/java/org')
-rw-r--r--workflow-designer-be/src/test/java/org/onap/sdc/workflow/api/WorkflowControllerTest.java22
-rw-r--r--workflow-designer-be/src/test/java/org/onap/sdc/workflow/services/impl/WorkflowManagerImplTest.java34
2 files changed, 29 insertions, 27 deletions
diff --git a/workflow-designer-be/src/test/java/org/onap/sdc/workflow/api/WorkflowControllerTest.java b/workflow-designer-be/src/test/java/org/onap/sdc/workflow/api/WorkflowControllerTest.java
index f8f86f1f..258e9c51 100644
--- a/workflow-designer-be/src/test/java/org/onap/sdc/workflow/api/WorkflowControllerTest.java
+++ b/workflow-designer-be/src/test/java/org/onap/sdc/workflow/api/WorkflowControllerTest.java
@@ -104,7 +104,7 @@ public class WorkflowControllerTest {
result.andExpect(jsonPath(String.format("$.items[%s].id", i), is(String.valueOf(i + 1))));
}
- verify(workflowManagerMock).list(any(), requestSpecArg.capture());
+ verify(workflowManagerMock).list(any(), any(), requestSpecArg.capture());
assertRequestSpec(requestSpecArg.getValue(), DEFAULT_OFFSET, DEFAULT_LIMIT, Collections.emptyList());
}
@@ -114,7 +114,7 @@ public class WorkflowControllerTest {
mockMvc.perform(get(RestPath.getWorkflowsPathAllQueryParams(DEFAULT_SORT_VALUE, "2", "1"))
.header(USER_ID_HEADER, USER_ID).contentType(APPLICATION_JSON)).andDo(print())
.andExpect(status().isOk()).andExpect(jsonPath("$.items", hasSize(3)));
- verify(workflowManagerMock).list(any(), requestSpecArg.capture());
+ verify(workflowManagerMock).list(any(), any(), requestSpecArg.capture());
assertRequestSpec(requestSpecArg.getValue(), 1, 2, Collections.singletonList(new Sort("name", true)));
}
@@ -124,7 +124,7 @@ public class WorkflowControllerTest {
mockMvc.perform(get(RestPath.getWorkflowsPathAllQueryParams(DEFAULT_SORT_VALUE, "-2", "1"))
.header(USER_ID_HEADER, USER_ID).contentType(APPLICATION_JSON)).andDo(print())
.andExpect(status().isOk()).andExpect(jsonPath("$.items", hasSize(3)));
- verify(workflowManagerMock).list(any(), requestSpecArg.capture());
+ verify(workflowManagerMock).list(any(), any(), requestSpecArg.capture());
assertRequestSpec(requestSpecArg.getValue(), 1, DEFAULT_LIMIT,
Collections.singletonList(new Sort("name", true)));
}
@@ -135,7 +135,7 @@ public class WorkflowControllerTest {
mockMvc.perform(get(RestPath.getWorkflowsPathAllQueryParams(DEFAULT_SORT_VALUE, "2", "-1"))
.header(USER_ID_HEADER, USER_ID).contentType(APPLICATION_JSON)).andDo(print())
.andExpect(status().isOk()).andExpect(jsonPath("$.items", hasSize(3)));
- verify(workflowManagerMock).list(any(), requestSpecArg.capture());
+ verify(workflowManagerMock).list(any(), any(), requestSpecArg.capture());
assertRequestSpec(requestSpecArg.getValue(), DEFAULT_OFFSET, 2,
Collections.singletonList(new Sort("name", true)));
}
@@ -146,7 +146,7 @@ public class WorkflowControllerTest {
mockMvc.perform(get(RestPath.getWorkflowsPathAllQueryParams(DEFAULT_SORT_VALUE, "abc", "0"))
.header(USER_ID_HEADER, USER_ID).contentType(APPLICATION_JSON)).andDo(print())
.andExpect(status().isOk()).andExpect(jsonPath("$.items", hasSize(3)));
- verify(workflowManagerMock).list(any(), requestSpecArg.capture());
+ verify(workflowManagerMock).list(any(), any(), requestSpecArg.capture());
assertRequestSpec(requestSpecArg.getValue(), 0, DEFAULT_LIMIT,
Collections.singletonList(new Sort("name", true)));
}
@@ -157,7 +157,7 @@ public class WorkflowControllerTest {
mockMvc.perform(get(RestPath.getWorkflowsPathAllQueryParams(DEFAULT_SORT_VALUE, "2", "abc"))
.header(USER_ID_HEADER, USER_ID).contentType(APPLICATION_JSON)).andDo(print())
.andExpect(jsonPath("$.items", hasSize(3)));
- verify(workflowManagerMock).list(any(), requestSpecArg.capture());
+ verify(workflowManagerMock).list(any(), any(), requestSpecArg.capture());
assertRequestSpec(requestSpecArg.getValue(), DEFAULT_OFFSET, 2,
Collections.singletonList(new Sort("name", true)));
}
@@ -168,7 +168,7 @@ public class WorkflowControllerTest {
mockMvc.perform(get(RestPath.getWorkflowsPathNoSortAndLimit("1")).header(USER_ID_HEADER, USER_ID)
.contentType(APPLICATION_JSON)).andDo(print())
.andExpect(jsonPath("$.items", hasSize(3)));
- verify(workflowManagerMock).list(any(), requestSpecArg.capture());
+ verify(workflowManagerMock).list(any(), any(), requestSpecArg.capture());
assertRequestSpec(requestSpecArg.getValue(), 1, DEFAULT_LIMIT, Collections.emptyList());
}
@@ -178,7 +178,7 @@ public class WorkflowControllerTest {
mockMvc.perform(get(RestPath.getWorkflowsPathNoSortAndOffset("1")).header(USER_ID_HEADER, USER_ID)
.contentType(APPLICATION_JSON)).andDo(print())
.andExpect(status().isOk()).andExpect(jsonPath("$.items", hasSize(3)));
- verify(workflowManagerMock).list(any(), requestSpecArg.capture());
+ verify(workflowManagerMock).list(any(), any(), requestSpecArg.capture());
assertRequestSpec(requestSpecArg.getValue(), DEFAULT_OFFSET, 1, Collections.emptyList());
}
@@ -251,8 +251,10 @@ public class WorkflowControllerTest {
}
private void mockManagerList3() {
- doReturn(new Page<>(Arrays.asList(createWorkflow(1, true), createWorkflow(2, true), createWorkflow(3, true)),
- new PagingRequest(DEFAULT_OFFSET, DEFAULT_LIMIT), 3)).when(workflowManagerMock).list(any(), any());
+ doReturn(new Page<>(Arrays.asList(createWorkflow(1, true),
+ createWorkflow(2, true), createWorkflow(3, true)),
+ new PagingRequest(DEFAULT_OFFSET, DEFAULT_LIMIT), 3)).when(workflowManagerMock)
+ .list(any(), any(), any());
}
private static void assertRequestSpec(RequestSpec actual, int expectedOffset, int expectedLimit,
diff --git a/workflow-designer-be/src/test/java/org/onap/sdc/workflow/services/impl/WorkflowManagerImplTest.java b/workflow-designer-be/src/test/java/org/onap/sdc/workflow/services/impl/WorkflowManagerImplTest.java
index 2b93075b..e2df4ec0 100644
--- a/workflow-designer-be/src/test/java/org/onap/sdc/workflow/services/impl/WorkflowManagerImplTest.java
+++ b/workflow-designer-be/src/test/java/org/onap/sdc/workflow/services/impl/WorkflowManagerImplTest.java
@@ -25,8 +25,6 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
-import org.onap.sdc.workflow.services.types.Workflow;
-import org.onap.sdc.workflow.services.types.WorkflowVersionState;
import org.onap.sdc.workflow.services.UniqueValueService;
import org.onap.sdc.workflow.services.exceptions.EntityNotFoundException;
import org.onap.sdc.workflow.services.impl.mappers.VersionStateMapper;
@@ -37,6 +35,8 @@ import org.onap.sdc.workflow.services.types.PagingRequest;
import org.onap.sdc.workflow.services.types.RequestSpec;
import org.onap.sdc.workflow.services.types.Sort;
import org.onap.sdc.workflow.services.types.SortingRequest;
+import org.onap.sdc.workflow.services.types.Workflow;
+import org.onap.sdc.workflow.services.types.WorkflowVersionState;
import org.openecomp.sdc.versioning.ItemManager;
import org.openecomp.sdc.versioning.types.Item;
import org.openecomp.sdc.versioning.types.ItemStatus;
@@ -80,7 +80,7 @@ public class WorkflowManagerImplTest {
doReturn(ITEMS).when(itemManagerMock).list(any());
mockItemToWorkflowMaps();
RequestSpec requestSpec = createRequestSpec(0, 20, true);
- Page<Workflow> workflows = workflowManager.list(null, requestSpec);
+ Page<Workflow> workflows = workflowManager.list(null,null, requestSpec);
Map<String, Workflow> workflowById =
workflows.getItems().stream().collect(Collectors.toMap(Workflow::getId, Function.identity()));
@@ -102,7 +102,7 @@ public class WorkflowManagerImplTest {
RequestSpec requestSpec = createRequestSpec(0, 20, true);
Page<Workflow> workflows =
- workflowManager.list(Collections.singleton(WorkflowVersionState.CERTIFIED), requestSpec);
+ workflowManager.list(null,Collections.singleton(WorkflowVersionState.CERTIFIED), requestSpec);
Map<String, Workflow> workflowById =
workflows.getItems().stream().collect(Collectors.toMap(Workflow::getId, Function.identity()));
@@ -172,7 +172,7 @@ public class WorkflowManagerImplTest {
public void listWhenRequestSpecIsNull() {
doReturn(ITEMS).when(itemManagerMock).list(any());
mockItemToWorkflowMaps();
- Page<Workflow> workflows = workflowManager.list(null, null);
+ Page<Workflow> workflows = workflowManager.list(null,null, null);
assertEquals(ITEMS.size(), workflows.getItems().size());
assertPaging(workflows.getPaging(), DEFAULT_OFFSET, DEFAULT_LIMIT, ITEMS.size());
@@ -187,7 +187,7 @@ public class WorkflowManagerImplTest {
public void listWhenPagingIsNull() {
doReturn(ITEMS).when(itemManagerMock).list(any());
mockItemToWorkflowMaps();
- Page<Workflow> workflows = workflowManager.list(null, new RequestSpec(null,
+ Page<Workflow> workflows = workflowManager.list(null,null, new RequestSpec(null,
SortingRequest.builder().sort(new Sort(SORT_FIELD_NAME, true)).build()));
assertEquals(ITEMS.size(), workflows.getItems().size());
@@ -200,7 +200,7 @@ public class WorkflowManagerImplTest {
mockItemToWorkflowMaps();
RequestSpec requestSpec = new RequestSpec(new PagingRequest(-2, -8),
SortingRequest.builder().sort(new Sort(SORT_FIELD_NAME, true)).build());
- Page<Workflow> workflows = workflowManager.list(null, requestSpec);
+ Page<Workflow> workflows = workflowManager.list(null,null, requestSpec);
assertEquals(ITEMS.size(), workflows.getItems().size());
assertPaging(workflows.getPaging(), DEFAULT_OFFSET, DEFAULT_LIMIT, ITEMS.size());
@@ -211,7 +211,7 @@ public class WorkflowManagerImplTest {
doReturn(ITEMS).when(itemManagerMock).list(any());
mockItemToWorkflowMaps();
RequestSpec requestSpec = new RequestSpec(new PagingRequest(2, 8), null);
- Page<Workflow> workflows = workflowManager.list(null, requestSpec);
+ Page<Workflow> workflows = workflowManager.list(null,null, requestSpec);
assertEquals(3, workflows.getItems().size());
assertPaging(workflows.getPaging(), requestSpec.getPaging().getOffset(), requestSpec.getPaging().getLimit(),
@@ -228,7 +228,7 @@ public class WorkflowManagerImplTest {
doReturn(ITEMS).when(itemManagerMock).list(any());
mockItemToWorkflowMaps();
RequestSpec requestSpec = new RequestSpec(new PagingRequest(2, 8), SortingRequest.builder().build());
- Page<Workflow> workflows = workflowManager.list(null, requestSpec);
+ Page<Workflow> workflows = workflowManager.list(null,null, requestSpec);
assertEquals(3, workflows.getItems().size());
assertPaging(workflows.getPaging(), requestSpec.getPaging().getOffset(), requestSpec.getPaging().getLimit(),
@@ -245,7 +245,7 @@ public class WorkflowManagerImplTest {
RequestSpec requestSpec = createRequestSpec(0, 5, true);
doReturn(ITEMS).when(itemManagerMock).list(any());
mockItemToWorkflowMaps();
- Page<Workflow> workflows = workflowManager.list(null, requestSpec);
+ Page<Workflow> workflows = workflowManager.list(null,null, requestSpec);
assertEquals(5, workflows.getItems().size());
assertPaging(workflows.getPaging(), requestSpec.getPaging().getOffset(), requestSpec.getPaging().getLimit(),
@@ -257,7 +257,7 @@ public class WorkflowManagerImplTest {
RequestSpec requestSpec = createRequestSpec(0, 3, true);
doReturn(ITEMS).when(itemManagerMock).list(any());
mockItemToWorkflowMaps();
- Page<Workflow> workflows = workflowManager.list(null, requestSpec);
+ Page<Workflow> workflows = workflowManager.list(null,null, requestSpec);
assertEquals(3, workflows.getItems().size());
assertPaging(workflows.getPaging(), requestSpec.getPaging().getOffset(), requestSpec.getPaging().getLimit(),
ITEMS.size());
@@ -269,7 +269,7 @@ public class WorkflowManagerImplTest {
RequestSpec requestSpec = createRequestSpec(3, 1, true);
doReturn(ITEMS).when(itemManagerMock).list(any());
mockItemToWorkflowMaps();
- Page<Workflow> workflows = workflowManager.list(null, requestSpec);
+ Page<Workflow> workflows = workflowManager.list(null,null, requestSpec);
assertEquals(1, workflows.getItems().size());
assertPaging(workflows.getPaging(), requestSpec.getPaging().getOffset(), requestSpec.getPaging().getLimit(),
ITEMS.size());
@@ -280,7 +280,7 @@ public class WorkflowManagerImplTest {
RequestSpec requestSpec = createRequestSpec(0, 10, true);
doReturn(ITEMS).when(itemManagerMock).list(any());
mockItemToWorkflowMaps();
- Page<Workflow> workflows = workflowManager.list(null, requestSpec);
+ Page<Workflow> workflows = workflowManager.list(null,null, requestSpec);
assertEquals(5, workflows.getItems().size());
assertPaging(workflows.getPaging(), requestSpec.getPaging().getOffset(), requestSpec.getPaging().getLimit(),
ITEMS.size());
@@ -291,7 +291,7 @@ public class WorkflowManagerImplTest {
RequestSpec requestSpec = createRequestSpec(6, 3, true);
doReturn(ITEMS).when(itemManagerMock).list(any());
mockItemToWorkflowMaps();
- Page<Workflow> workflows = workflowManager.list(null, requestSpec);
+ Page<Workflow> workflows = workflowManager.list(null,null, requestSpec);
assertEquals(0, workflows.getItems().size());
assertPaging(workflows.getPaging(), requestSpec.getPaging().getOffset(), requestSpec.getPaging().getLimit(),
ITEMS.size());
@@ -302,7 +302,7 @@ public class WorkflowManagerImplTest {
doReturn(ITEMS).when(itemManagerMock).list(any());
mockItemToWorkflowMaps();
RequestSpec requestSpec = createRequestSpec(0, 5555, true);
- Page<Workflow> workflows = workflowManager.list(null, requestSpec);
+ Page<Workflow> workflows = workflowManager.list(null,null, requestSpec);
assertEquals(ITEMS.size(), workflows.getItems().size());
assertPaging(workflows.getPaging(), requestSpec.getPaging().getOffset(), MAX_LIMIT, ITEMS.size());
@@ -313,7 +313,7 @@ public class WorkflowManagerImplTest {
RequestSpec requestSpec = createRequestSpec(10, 10, true);
doReturn(ITEMS).when(itemManagerMock).list(any());
mockItemToWorkflowMaps();
- Page<Workflow> workflows = workflowManager.list(null, requestSpec);
+ Page<Workflow> workflows = workflowManager.list(null,null, requestSpec);
assertEquals(0, workflows.getItems().size());
assertPaging(workflows.getPaging(), requestSpec.getPaging().getOffset(), requestSpec.getPaging().getLimit(),
ITEMS.size());
@@ -324,7 +324,7 @@ public class WorkflowManagerImplTest {
RequestSpec requestSpec = createRequestSpec(2, 1, false);
doReturn(ITEMS).when(itemManagerMock).list(any());
mockItemToWorkflowMaps();
- Page<Workflow> workflows = workflowManager.list(null, requestSpec);
+ Page<Workflow> workflows = workflowManager.list(null,null, requestSpec);
assertEquals(1, workflows.getItems().size());
assertPaging(workflows.getPaging(), requestSpec.getPaging().getOffset(), requestSpec.getPaging().getLimit(),
ITEMS.size());