2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.onap.dcaegen2.platform.mod.web.service.deploymentartifact;
23 import org.onap.dcaegen2.platform.mod.model.deploymentartifact.DeploymentArtifact;
24 import org.onap.dcaegen2.platform.mod.model.deploymentartifact.DeploymentArtifactStatus;
25 import org.onap.dcaegen2.platform.mod.objectmothers.DeploymentArtifactObjectMother;
26 import org.junit.jupiter.api.BeforeEach;
27 import org.junit.jupiter.api.extension.ExtendWith;
28 import org.mockito.Mock;
29 import org.mockito.junit.jupiter.MockitoExtension;
31 @ExtendWith(MockitoExtension.class)
32 public class SearchDeploymentArtifactsTest {
34 private DeploymentArtifactServiceImpl service;
37 private DeploymentArtifactGateway repository;
39 private DeploymentArtifact artifact_1;
40 private DeploymentArtifact artifact_2;
41 private DeploymentArtifact artifact_3;
45 service = new DeploymentArtifactServiceImpl();
46 service.setDeploymentArtifactGateway(repository);
49 artifact_1 = DeploymentArtifactObjectMother.createDeploymentArtifactDAO(DeploymentArtifactStatus.IN_DEV);
50 artifact_1.getMsInstanceInfo().setRelease("2008");
51 artifact_2 = DeploymentArtifactObjectMother.createDeploymentArtifactDAO(DeploymentArtifactStatus.DEV_COMPLETE);
52 artifact_2.getMsInstanceInfo().setRelease("2010");
53 artifact_3 = DeploymentArtifactObjectMother.createDeploymentArtifactDAO(DeploymentArtifactStatus.DEV_COMPLETE);
54 artifact_3.getMsInstanceInfo().setRelease("2008");
59 // void findArtifacts_filteredWithRelease() throws Exception {
60 // List<DeploymentArtifact> artifacts = Arrays.asList(artifact_1, artifact_3);
61 // when(repository.findByReleaseOrStatusOfMsInstance("2008", null)).thenReturn(artifacts);
64 // DeploymentArtifactSearch search = new DeploymentArtifactSearch();
65 // DeploymentArtifactFilter filter = new DeploymentArtifactFilter();
66 // filter.setRelease("2008");
67 // search.setFilter(filter);
69 // List<DeploymentArtifact> result = core.searchDeploymentArtifacts(search);
72 // assertThat(result.size()).isEqualTo(2);
76 // void findArtifacts_filteredWithStatus() throws Exception{
77 // List<DeploymentArtifact> artifacts = Arrays.asList(artifact_2, artifact_3);
78 // when(repository.findByReleaseOrStatusOfMsInstance(null, DeploymentArtifactStatus.DEV_COMPLETE))
79 // .thenReturn(artifacts);
81 // DeploymentArtifactSearch search = new DeploymentArtifactSearch();
82 // DeploymentArtifactFilter filter = new DeploymentArtifactFilter();
83 // filter.setStatus(DeploymentArtifactStatus.DEV_COMPLETE);
84 // search.setFilter(filter);
86 // List<DeploymentArtifact> result = core.searchDeploymentArtifacts(search);
87 // assertThat(result.size()).isEqualTo(2);