Implant vid-app-common org.onap.vid.job (main and test)
[vid.git] / vid-app-common / src / test / java / org / onap / vid / job / impl / JobWorkerTest.java
index e58b6ba..e234ee9 100644 (file)
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
 package org.onap.vid.job.impl;
 
 import com.google.common.collect.ImmutableMap;
@@ -13,13 +33,14 @@ import org.onap.vid.job.command.HttpCallCommand;
 import org.onap.vid.job.command.JobCommandFactory;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
+import org.togglz.core.manager.FeatureManager;
 
 import java.util.Map;
 import java.util.UUID;
 
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.Matchers.*;
-import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Matchers.any;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
@@ -31,6 +52,9 @@ public class JobWorkerTest {
     @Mock
     private JobCommandFactory jobCommandFactory;
 
+    @Mock
+    private FeatureManager featureManager;
+
     private final JobCommand jobCommand = mock(JobCommand.class);
     private Job jobUnderTest;
     private JobAdapter.AsyncJobRequest originalData;
@@ -47,12 +71,14 @@ public class JobWorkerTest {
             public final String foobar = "aux";
         };
 
-        originalType = JobType.ServiceInstantiation;
-        jobUnderTest = new JobAdapterImpl().createJob(
+        originalType = JobType.MacroServiceInstantiation;
+        jobUnderTest = new JobAdapterImpl(featureManager).createServiceInstantiationJob(
                 originalType,
                 originalData,
                 UUID.randomUUID(),
                 "my user id",
+                "VNF_API",
+                "optimisticUniqueServiceInstanceName",
                 RandomUtils.nextInt()
         );
     }
@@ -62,7 +88,7 @@ public class JobWorkerTest {
 
         assertNextJobAfterExecuteJob(null, new String[]{"status"}, allOf(
                 hasProperty("status", is(Job.JobStatus.STOPPED)),
-                hasProperty("data", hasEntry("request", originalData)),
+                hasProperty("sharedData", hasProperty("request", is(originalData))),
                 hasProperty("type", is(originalType)))
         );
     }