Get unit tests working 05/13605/1
authorMichael Hwang <mhwang@research.att.com>
Tue, 19 Sep 2017 21:28:07 +0000 (17:28 -0400)
committerMichael Hwang <mhwang@research.att.com>
Tue, 19 Sep 2017 21:28:44 +0000 (17:28 -0400)
Including fixing of broken test

Change-Id: Ie5fa6a2c4bd59b7552480899616590c7944e5aa4
Issue-Id: DCAEGEN2-60
Signed-off-by: Michael Hwang <mhwang@research.att.com>
pom.xml
src/test/java/DcaeServiceTypesApiServiceImplTests.java

diff --git a/pom.xml b/pom.xml
index b68f6d8..39f882a 100644 (file)
--- a/pom.xml
+++ b/pom.xml
                     <stagingProfileId>176c31dfe190a</stagingProfileId>
                 </configuration>
             </plugin>
+
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <version>2.20.1</version>
+                <dependencies>
+                    <dependency>
+                        <groupId>org.apache.maven.surefire</groupId>
+                        <artifactId>surefire-junit47</artifactId>
+                        <version>2.20.1</version>
+                    </dependency>
+                </dependencies>
+            </plugin>
         </plugins>
     </build>
 
index ce0011b..c4ada1f 100644 (file)
@@ -47,6 +47,7 @@ import org.slf4j.LoggerFactory;
 
 import java.util.Arrays;
 import java.util.Objects;
+import java.util.UUID;
 
 
 /**
@@ -204,10 +205,12 @@ public class DcaeServiceTypesApiServiceImplTests {
         minimalFixture.setOwner("tester");
         minimalFixture.setBlueprintTemplate("{ blueprint template goes here }");
 
-        String expectedTypeId = String.format("%s:%s", minimalFixture.getTypeName(), minimalFixture.getTypeVersion());
+        UUID expectedTypeIdUUID = UUID.randomUUID();
 
-        when(mockTypesDAO.getByTypeId(expectedTypeId)).thenReturn(new DCAEServiceTypeObject());
-        when(mockServicesDAO.countByType(DCAEServiceObject.DCAEServiceStatus.RUNNING, expectedTypeId)).thenReturn(10);
+        DCAEServiceTypeObject fakeExistingType = new DCAEServiceTypeObject();
+        fakeExistingType.setTypeId(expectedTypeIdUUID.toString());
+        when(mockTypesDAO.getByRequestFromNotASDC(minimalFixture)).thenReturn(fakeExistingType);
+        when(mockServicesDAO.countByType(DCAEServiceObject.DCAEServiceStatus.RUNNING, fakeExistingType.getTypeId())).thenReturn(10);
 
         try {
             Response response = api.dcaeServiceTypesTypeIdPost(minimalFixture, uriInfo, null);