X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=vid-app-common%2Fsrc%2Ftest%2Fjava%2Forg%2Fonap%2Fvid%2Fjob%2Fimpl%2FDeleteOldJobsWorkerTest.java;fp=vid-app-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fvid%2Fjob%2Fcommand%2FALaCarteServiceInstantiationCommand.java;h=229e0cab1f4c0b80130c48f0adeda56db8667e86;hb=e601bbdc43bae9a08e2e10c5139a6f76b47860d7;hp=38d5ede8a63d0485800c1cbb7fd5301542b02b18;hpb=76c6ee4a697617ec4cdee2f3b48bc83136c858c5;p=vid.git diff --git a/vid-app-common/src/main/java/org/onap/vid/job/command/ALaCarteServiceInstantiationCommand.java b/vid-app-common/src/test/java/org/onap/vid/job/impl/DeleteOldJobsWorkerTest.java similarity index 52% rename from vid-app-common/src/main/java/org/onap/vid/job/command/ALaCarteServiceInstantiationCommand.java rename to vid-app-common/src/test/java/org/onap/vid/job/impl/DeleteOldJobsWorkerTest.java index 38d5ede8a..229e0cab1 100644 --- a/vid-app-common/src/main/java/org/onap/vid/job/command/ALaCarteServiceInstantiationCommand.java +++ b/vid-app-common/src/test/java/org/onap/vid/job/impl/DeleteOldJobsWorkerTest.java @@ -7,9 +7,9 @@ * 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. @@ -18,24 +18,26 @@ * ============LICENSE_END========================================================= */ -package org.onap.vid.job.command; +package org.onap.vid.job.impl; -import org.onap.vid.changeManagement.RequestDetailsWrapper; -import org.onap.vid.job.JobCommand; -import org.onap.vid.mso.model.ServiceInstantiationRequestDetails; -import org.springframework.beans.factory.config.ConfigurableBeanFactory; -import org.springframework.context.annotation.Scope; -import org.springframework.stereotype.Component; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import org.onap.vid.job.JobsBrokerService; +import org.quartz.JobExecutionException; +import org.testng.annotations.Test; -@Component -@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) -public class ALaCarteServiceInstantiationCommand extends ServiceInstantiationCommand implements JobCommand { +public class DeleteOldJobsWorkerTest { - @Override - protected RequestDetailsWrapper generateServiceInstantiationRequest() { - return asyncInstantiationBL.generateALaCarteServiceInstantiationRequest( - getSharedData().getJobUuid(), getRequest(), optimisticUniqueServiceInstanceName, getSharedData().getUserId() - ); + @Test + public void whenExecuteInternal_thenCallToDeleteOldFinalJobs() throws JobExecutionException { + JobsBrokerService mockBroker = mock(JobsBrokerService.class); + long secondsAgo = 42L; + DeleteOldJobsWorker underTest = new DeleteOldJobsWorker(); + underTest.setJobsBrokerService(mockBroker); + underTest.setSecondsAgo(secondsAgo); + underTest.executeInternal(null); + verify(mockBroker).deleteOldFinalJobs(secondsAgo); } + }