workflow version API 51/55351/1
authorayalaben <ayala.benzvi@amdocs.com>
Tue, 26 Jun 2018 06:29:06 +0000 (09:29 +0300)
committerayalaben <ayala.benzvi@amdocs.com>
Tue, 26 Jun 2018 06:29:06 +0000 (09:29 +0300)
Change-Id: Iadbf5325091084b4feca386740d6655845904d88
Issue-ID: SDC-1445
Signed-off-by: ayalaben <ayala.benzvi@amdocs.com>
13 files changed:
workflow-bdd/features/Version_Create_Update.feature [new file with mode: 0644]
workflow-bdd/resources/json/createWorkflow.json [new file with mode: 0644]
workflow-bdd/stepDefinitions/Workflow_Steps.js [new file with mode: 0644]
workflow-designer-be/src/main/java/org/onap/sdc/workflow/api/WorkflowController.java
workflow-designer-be/src/main/java/org/onap/sdc/workflow/api/WorkflowVersionController.java [new file with mode: 0644]
workflow-designer-be/src/main/java/org/onap/sdc/workflow/api/exceptionshandlers/CustomizedResponseEntityExceptionHandler.java
workflow-designer-be/src/main/java/org/onap/sdc/workflow/api/impl/WorkflowVersionControllerImpl.java [new file with mode: 0644]
workflow-designer-be/src/main/java/org/onap/sdc/workflow/services/WorkflowVersionManager.java [new file with mode: 0644]
workflow-designer-be/src/main/java/org/onap/sdc/workflow/services/exceptions/VersionNotFoundException.java [new file with mode: 0644]
workflow-designer-be/src/main/java/org/onap/sdc/workflow/services/impl/WorkflowVersionManagerImpl.java [new file with mode: 0644]
workflow-designer-be/src/test/java/org/onap/sdc/workflow/api/WorkflowVersionControllerTest.java [new file with mode: 0644]
workflow-designer-be/src/test/java/org/onap/sdc/workflow/services/WorkflowManagerTest.java [new file with mode: 0644]
workflow-designer-be/src/test/java/org/onap/sdc/workflow/services/WorkflowVersionManagerTest.java [new file with mode: 0644]

diff --git a/workflow-bdd/features/Version_Create_Update.feature b/workflow-bdd/features/Version_Create_Update.feature
new file mode 100644 (file)
index 0000000..2cb0580
--- /dev/null
@@ -0,0 +1,28 @@
+Feature: Workflow Versions
+
+  Background: Init
+    Given I want to create a Workflow
+
+  Scenario: Create and get version
+    When I want to create input data
+    Then I want to update the input property "description" with value "workflow version description"
+    Then I want to create for path "/workflows/{item.id}/versions" with the input data from the context
+    Then I want to copy to property "versionId" from response data path "id"
+    Then I want to get path "/workflows/{item.id}/versions/{versionId}"
+    Then I want to check that property "id" in the response equals to value of saved property "versionId"
+
+    When I want to get path "/workflows/{item.id}/versions"
+    Then I want to check that element in the response list with "id" equals to value of saved property "versionId" exists
+
+
+  Scenario: Update version
+    When I want to create input data
+    Then I want to update the input property "description" with value "workflow version description"
+    Then I want to create for path "/workflows/{item.id}/versions" with the input data from the context
+    Then I want to copy to property "versionId" from response data path "id"
+
+    Then I want to update the input property "description" with value "workflow version description updated"
+    Then I want to set property "desc" to value "workflow version description updated"
+    Then I want to update for path "/workflows/{item.id}/versions/{versionId}" with the input data from the context
+    Then I want to get path "/workflows/{item.id}/versions/{versionId}"
+    Then I want to check that property "description" in the response equals to value of saved property "desc"
\ No newline at end of file
diff --git a/workflow-bdd/resources/json/createWorkflow.json b/workflow-bdd/resources/json/createWorkflow.json
new file mode 100644 (file)
index 0000000..074899e
--- /dev/null
@@ -0,0 +1 @@
+{"name":"RANDOM","description":"Workflow Description","category":"category"}
\ No newline at end of file
diff --git a/workflow-bdd/stepDefinitions/Workflow_Steps.js b/workflow-bdd/stepDefinitions/Workflow_Steps.js
new file mode 100644 (file)
index 0000000..59c95d8
--- /dev/null
@@ -0,0 +1,19 @@
+/**
+ * @module WORKFLOW
+ * @description Creates a new WORKFLOW with a random name and saves the id and versionId on the context item object and the context vlm object<br>
+ *     Input data  will be taken from the 'resources/json/createWorkflow.json' file.
+ * @step I want to create a Workflow
+ **/
+
+const {Then, When, Given} = require('cucumber');
+const assert = require('assert');
+const util = require('./Utils.js');
+
+When('I want to create a Workflow', function()  {
+    let inputData = util.getJSONFromFile('resources/json/createWorkflow.json');
+    inputData.name = util.random();
+    let path = '/workflows';
+    return util.request(this.context, 'POST', path, inputData).then(result => {
+        this.context.item ={id : result.data.id};
+});
+});
\ No newline at end of file
index 95f11cd..41f4767 100644 (file)
@@ -22,18 +22,17 @@ public interface WorkflowController {
 
     @GetMapping(produces = MediaType.APPLICATION_JSON_VALUE)
     @ApiOperation("List workflows")
-    CollectionWrapper<Workflow> list(@RequestHeader(USER_ID_HEADER_PARAM) String user);
+    CollectionWrapper<Workflow> list(String user);
 
     @PostMapping(consumes = MediaType.APPLICATION_JSON_VALUE)
     @ApiOperation("Create workflow")
-    ResponseEntity<?> create(@RequestBody Workflow workflow, @RequestHeader(USER_ID_HEADER_PARAM) String user);
+    ResponseEntity<?> create(Workflow workflow, String user);
 
     @GetMapping(path = "/{id}")
     @ApiOperation("Get workflow")
-    Workflow get(@PathVariable("id") String id, @RequestHeader(USER_ID_HEADER_PARAM) String user);
+    Workflow get(String id, String user);
 
     @PutMapping(path = "/{id}", consumes = MediaType.APPLICATION_JSON_VALUE)
     @ApiOperation("Update workflow")
-    Workflow update(@RequestBody Workflow workflow, @PathVariable("id") String id,
-            @RequestHeader(USER_ID_HEADER_PARAM) String user);
+    Workflow update(Workflow workflow, String id, String user);
 }
diff --git a/workflow-designer-be/src/main/java/org/onap/sdc/workflow/api/WorkflowVersionController.java b/workflow-designer-be/src/main/java/org/onap/sdc/workflow/api/WorkflowVersionController.java
new file mode 100644 (file)
index 0000000..eb57353
--- /dev/null
@@ -0,0 +1,41 @@
+package org.onap.sdc.workflow.api;
+
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import java.util.Collection;
+import org.onap.sdc.workflow.api.types.CollectionWrapper;
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.springframework.core.io.Resource;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PatchMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.multipart.MultipartFile;
+
+@RequestMapping("/workflows/{id}/versions")
+@Api("Workflow versions")
+public interface WorkflowVersionController {
+
+
+    @GetMapping
+    @ApiOperation("List workflow versions")
+    CollectionWrapper<Version> list(String id, String user);
+
+    @PostMapping
+    @ApiOperation("Create workflow version")
+    ResponseEntity<?> create(String id, Version version, String user);
+
+    @GetMapping("/{versionId}")
+    @ApiOperation("Get workflow version")
+    Version get(String id,String versionId, String user);
+
+    @PutMapping("/{versionId}")
+    @ApiOperation("Update workflow version")
+    void update(String id, String versionId,Version version, String user);
+
+
+}
index c29d2ab..978be19 100644 (file)
@@ -4,6 +4,7 @@ import static org.springframework.http.HttpStatus.NOT_FOUND;
 import static org.springframework.http.HttpStatus.UNPROCESSABLE_ENTITY;
 
 import org.onap.sdc.workflow.services.exceptions.UniqueValueViolationException;
+import org.onap.sdc.workflow.services.exceptions.VersionNotFoundException;
 import org.onap.sdc.workflow.services.exceptions.WorkflowNotFoundException;
 import org.springframework.http.ResponseEntity;
 import org.springframework.web.bind.annotation.ControllerAdvice;
@@ -21,9 +22,9 @@ public class CustomizedResponseEntityExceptionHandler extends ResponseEntityExce
         return new ResponseEntity<>(exception.getMessage(), UNPROCESSABLE_ENTITY);
     }
 
-    @ExceptionHandler(WorkflowNotFoundException.class)
+    @ExceptionHandler({WorkflowNotFoundException.class, VersionNotFoundException.class})
     public final ResponseEntity<String> handleWorkflowNotFoundException(
-            WorkflowNotFoundException exception) {
+            Exception exception) {
         return new ResponseEntity<>(exception.getMessage(), NOT_FOUND);
     }
 }
diff --git a/workflow-designer-be/src/main/java/org/onap/sdc/workflow/api/impl/WorkflowVersionControllerImpl.java b/workflow-designer-be/src/main/java/org/onap/sdc/workflow/api/impl/WorkflowVersionControllerImpl.java
new file mode 100644 (file)
index 0000000..49c31f5
--- /dev/null
@@ -0,0 +1,63 @@
+package org.onap.sdc.workflow.api.impl;
+
+import static org.onap.sdc.workflow.api.RestConstants.USER_ID_HEADER_PARAM;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Optional;
+import org.onap.sdc.workflow.api.WorkflowVersionController;
+import org.onap.sdc.workflow.api.types.CollectionWrapper;
+import org.onap.sdc.workflow.services.WorkflowVersionManager;
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.openecomp.sdc.versioning.types.VersionCreationMethod;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.core.io.Resource;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestHeader;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
+
+@RestController("workflowsVersionController")
+public class WorkflowVersionControllerImpl implements WorkflowVersionController {
+
+    private final WorkflowVersionManager workflowVersionManager;
+
+    @Autowired
+    public WorkflowVersionControllerImpl(@Qualifier("workflowVersionManager") WorkflowVersionManager workflowVersionManager) {
+        this.workflowVersionManager = workflowVersionManager;
+    }
+
+    @Override
+    public CollectionWrapper<Version> list(@PathVariable("id") String id,@RequestHeader(USER_ID_HEADER_PARAM) String user) {
+        return new CollectionWrapper<>(workflowVersionManager.list(id));
+    }
+
+    @Override
+    public ResponseEntity<?>  create(@PathVariable("id") String id,@RequestBody Version version,
+            @RequestHeader(USER_ID_HEADER_PARAM) String user) {
+
+         Version createdVersion = workflowVersionManager.create(id, version);
+
+        return new ResponseEntity<>(createdVersion, HttpStatus.CREATED);
+    }
+
+    @Override
+    public Version get(@PathVariable("id") String id,@PathVariable("versionId") String versionId,
+            @RequestHeader(USER_ID_HEADER_PARAM)  String user) {
+        Version version = new Version(versionId);
+        return workflowVersionManager.get(id,version);
+    }
+
+    @Override
+    public void update(@PathVariable("id") String id, @PathVariable("versionId") String versionId,
+            @RequestBody Version version, @RequestHeader(USER_ID_HEADER_PARAM) String user) {
+
+        version.setId(versionId);
+        workflowVersionManager.update(id,version);
+    }
+
+}
diff --git a/workflow-designer-be/src/main/java/org/onap/sdc/workflow/services/WorkflowVersionManager.java b/workflow-designer-be/src/main/java/org/onap/sdc/workflow/services/WorkflowVersionManager.java
new file mode 100644 (file)
index 0000000..b288b28
--- /dev/null
@@ -0,0 +1,16 @@
+package org.onap.sdc.workflow.services;
+
+import java.util.Collection;
+import org.openecomp.sdc.versioning.dao.types.Version;
+
+public interface WorkflowVersionManager {
+
+    Collection<Version> list(String id);
+
+    Version get(String id, Version version);
+
+    Version create(String id, Version version);
+
+    void update(String id,Version version);
+
+}
diff --git a/workflow-designer-be/src/main/java/org/onap/sdc/workflow/services/exceptions/VersionNotFoundException.java b/workflow-designer-be/src/main/java/org/onap/sdc/workflow/services/exceptions/VersionNotFoundException.java
new file mode 100644 (file)
index 0000000..d98a15d
--- /dev/null
@@ -0,0 +1,7 @@
+package org.onap.sdc.workflow.services.exceptions;
+
+public class VersionNotFoundException extends RuntimeException {
+
+    public VersionNotFoundException(String workflowId, String versioId) {
+        super(String.format("version with id '%s' does not exist for workflow with id %s",versioId,workflowId));
+    }  }
diff --git a/workflow-designer-be/src/main/java/org/onap/sdc/workflow/services/impl/WorkflowVersionManagerImpl.java b/workflow-designer-be/src/main/java/org/onap/sdc/workflow/services/impl/WorkflowVersionManagerImpl.java
new file mode 100644 (file)
index 0000000..cda1791
--- /dev/null
@@ -0,0 +1,60 @@
+package org.onap.sdc.workflow.services.impl;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Objects;
+import java.util.Optional;
+import org.onap.sdc.workflow.services.WorkflowVersionManager;
+import org.onap.sdc.workflow.services.exceptions.VersionNotFoundException;
+import org.openecomp.sdc.versioning.VersioningManager;
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.openecomp.sdc.versioning.types.VersionCreationMethod;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service("workflowVersionManager")
+public class WorkflowVersionManagerImpl  implements WorkflowVersionManager {
+
+    private final VersioningManager versioningManager;
+
+    @Autowired
+    public WorkflowVersionManagerImpl(VersioningManager versioningManager) {
+        this.versioningManager = versioningManager;
+    }
+
+    @Override
+    public Collection<Version> list(String id) {
+        return versioningManager.list(id);
+    }
+
+    @Override
+    public Version get(String id,Version version) {
+
+        try {
+            return versioningManager.get(id, version);
+        } catch (Exception e){
+            throw new VersionNotFoundException(id,version.getId());
+        }
+    }
+
+    @Override
+    public Version create(String id, Version version) {
+        if (Objects.nonNull(getLatestVersion(id)))
+            version.setBaseId(getLatestVersion(id).getId());
+        return versioningManager.create(id,version, VersionCreationMethod.major);
+    }
+
+    @Override
+    public void update(String id,Version version) {
+
+        versioningManager.updateVersion(id,version);
+    }
+
+    private Version getLatestVersion(String itemId) {
+        List<Version> list = versioningManager.list(itemId);
+        Optional<Version> max = list.stream().max(Version::compareTo);
+
+        return max.orElse(null);
+    }
+
+}
diff --git a/workflow-designer-be/src/test/java/org/onap/sdc/workflow/api/WorkflowVersionControllerTest.java b/workflow-designer-be/src/test/java/org/onap/sdc/workflow/api/WorkflowVersionControllerTest.java
new file mode 100644 (file)
index 0000000..96c31c8
--- /dev/null
@@ -0,0 +1,118 @@
+package org.onap.sdc.workflow.api;
+
+import static org.hamcrest.Matchers.equalTo;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.collection.IsCollectionWithSize.hasSize;
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.springframework.http.MediaType.APPLICATION_JSON;
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.put;
+import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
+
+import com.google.gson.Gson;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.sdc.workflow.api.impl.WorkflowVersionControllerImpl;
+import org.onap.sdc.workflow.services.WorkflowVersionManager;
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.springframework.http.HttpStatus;
+import org.springframework.mock.web.MockHttpServletResponse;
+import org.springframework.test.web.servlet.MockMvc;
+import org.springframework.test.web.servlet.setup.MockMvcBuilders;
+
+@RunWith(MockitoJUnitRunner.class)
+public class WorkflowVersionControllerTest {
+
+    private static final String USER_ID = "cs0008";
+    private static final String ITEM1_ID = "item_id_1";
+    private static final String VERSION1_ID = "version_id_1";
+    private static final String VERSION2_ID = "version_id_2";
+    private List<Version> versionList;
+
+    private static final Gson GSON = new Gson();
+
+    private MockMvc mockMvc;
+
+    @Mock
+    private WorkflowVersionManager workflowVersionManagerMock;
+
+    @InjectMocks
+    private WorkflowVersionControllerImpl workflowVersionController;
+
+    @Before
+    public void setUp() {
+        versionList = Arrays.asList( new Version(VERSION1_ID),new Version(VERSION2_ID));
+        mockMvc = MockMvcBuilders.standaloneSetup(workflowVersionController).build();
+    }
+
+    @Test
+    public void shouldReturnVersionListOfWorkflow() throws Exception {
+
+        doReturn(versionList).when(workflowVersionManagerMock).list(ITEM1_ID);
+        mockMvc.perform(get("/workflows/item_id_1/versions").header(RestConstants.USER_ID_HEADER_PARAM, USER_ID)
+                                                            .contentType(APPLICATION_JSON)).andExpect(status().isOk())
+               .andExpect(jsonPath("$.results", hasSize(2)))
+               .andExpect(jsonPath("$.results[0].id", equalTo(VERSION1_ID)))
+               .andExpect(jsonPath("$.results[1].id", equalTo(VERSION2_ID)));
+
+        verify(workflowVersionManagerMock, times(1)).list(ITEM1_ID);
+    }
+
+
+    @Test
+    public void shouldCreateWorkflowVersion() throws Exception {
+
+        Version version = new Version();
+        version.setDescription("VersionDescription");
+        mockMvc.perform(post("/workflows/item_id_1/versions").header(RestConstants.USER_ID_HEADER_PARAM, USER_ID)
+                                                             .contentType(APPLICATION_JSON)
+                                                             .content(GSON.toJson(version)))
+               .andExpect(status().isCreated());
+
+        verify(workflowVersionManagerMock, times(1)).create(ITEM1_ID, version);
+    }
+
+
+    @Test
+    public void shouldReturnWorkflowVersionWhenExists() throws Exception {
+        Version version = new Version(VERSION1_ID);
+        doReturn(version).when(workflowVersionManagerMock).get(ITEM1_ID, version);
+        mockMvc.perform(
+                get("/workflows/item_id_1/versions/" + VERSION1_ID).header(RestConstants.USER_ID_HEADER_PARAM, USER_ID)
+                                                                   .contentType(APPLICATION_JSON)).andDo(print())
+               .andExpect(status().isOk()).andExpect(jsonPath("$.id", is(version.getId())));
+        verify(workflowVersionManagerMock, times(1)).get(ITEM1_ID, version);
+    }
+
+    @Test
+    public void shouldUpdateWorkflowVersion() throws Exception {
+        Version version = new Version();
+        version.setDescription("Updated");
+
+        MockHttpServletResponse result = mockMvc.perform(
+                put("/workflows/item_id_1/versions/" + VERSION1_ID).header(RestConstants.USER_ID_HEADER_PARAM, USER_ID)
+                                                                   .contentType(APPLICATION_JSON)
+                                                                   .content(GSON.toJson(version))).andReturn()
+                                                .getResponse();
+
+        assertEquals(HttpStatus.OK.value(), result.getStatus());
+        version.setId(VERSION1_ID);
+        verify(workflowVersionManagerMock, times(1)).update(ITEM1_ID, version);
+
+    }
+
+}
diff --git a/workflow-designer-be/src/test/java/org/onap/sdc/workflow/services/WorkflowManagerTest.java b/workflow-designer-be/src/test/java/org/onap/sdc/workflow/services/WorkflowManagerTest.java
new file mode 100644 (file)
index 0000000..02035a1
--- /dev/null
@@ -0,0 +1,41 @@
+package org.onap.sdc.workflow.services;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.sdc.workflow.services.impl.WorkflowManagerImpl;
+import org.openecomp.sdc.versioning.ItemManager;
+import org.springframework.test.web.servlet.MockMvc;
+import org.springframework.test.web.servlet.setup.MockMvcBuilders;
+
+@RunWith(MockitoJUnitRunner.class)
+public class WorkflowManagerTest {
+
+    private MockMvc mockMvc;
+
+    @Mock
+    private ItemManager itemManager;
+
+    @Mock
+    private UniqueValueService uniqueValueService;
+
+    @InjectMocks
+    private WorkflowManagerImpl workflowManager;
+
+
+    @Before
+    public void setUp(){
+        mockMvc = MockMvcBuilders.standaloneSetup(workflowManager).build();
+    }
+
+
+    @Test
+    public void testCreate(){
+
+    }
+
+}
diff --git a/workflow-designer-be/src/test/java/org/onap/sdc/workflow/services/WorkflowVersionManagerTest.java b/workflow-designer-be/src/test/java/org/onap/sdc/workflow/services/WorkflowVersionManagerTest.java
new file mode 100644 (file)
index 0000000..d903126
--- /dev/null
@@ -0,0 +1,70 @@
+package org.onap.sdc.workflow.services;
+
+import static org.hamcrest.Matchers.equalTo;
+import static org.hamcrest.collection.IsCollectionWithSize.hasSize;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.springframework.http.MediaType.APPLICATION_JSON;
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
+
+import java.util.Arrays;
+import java.util.List;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.sdc.workflow.api.RestConstants;
+import org.onap.sdc.workflow.services.impl.WorkflowVersionManagerImpl;
+import org.openecomp.sdc.versioning.VersioningManager;
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.TestConfiguration;
+import org.springframework.context.annotation.Bean;
+import org.springframework.test.web.servlet.MockMvc;
+import org.springframework.test.web.servlet.setup.MockMvcBuilders;
+
+@RunWith(MockitoJUnitRunner.class)
+public class WorkflowVersionManagerTest {
+
+    private static final String USER_ID = "cs0008";
+    private static final String ITEM1_ID = "item_id_1";
+    private static final String VERSION1_ID = "version_id_1";
+    private static final String VERSION2_ID = "version_id_2";
+    private List<Version> versionList;
+
+    @Mock
+    private static VersioningManager versioningManagerMock;
+
+    @TestConfiguration
+    static class WorkflowVersionManagerTestContextConfiguration {
+
+        @Bean
+        public WorkflowVersionManager WorkflowVersionManagerImpl() {
+            return new WorkflowVersionManagerImpl(versioningManagerMock);
+        }
+    }
+
+    @Autowired
+    private WorkflowVersionManager workflowVersionManager;
+
+
+
+    @Before
+    public void setUp(){
+        versionList = Arrays.asList( new Version(VERSION1_ID),new Version(VERSION2_ID));
+
+    }
+
+
+    @Test
+    public void shouldReturnWorkflowVersionList(){
+
+
+    }
+
+}