Add collaboration feature
[sdc.git] / openecomp-be / backend / openecomp-sdc-vendor-software-product-manager / src / test / java / org / openecomp / sdc / vendorsoftwareproduct / impl / OrchestrationTemplateProcessCsarHandlerTest.java
1 package org.openecomp.sdc.vendorsoftwareproduct.impl;
2
3 import org.junit.Before;
4 import org.junit.Test;
5 import org.openecomp.core.enrichment.factory.EnrichmentManagerFactory;
6 import org.openecomp.core.factory.impl.AbstractFactoryBase;
7 import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
8 import org.openecomp.sdc.vendorsoftwareproduct.dao.PackageInfoDaoFactory;
9 import org.openecomp.sdc.vendorsoftwareproduct.dao.type.OrchestrationTemplateCandidateData;
10 import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
11 import org.openecomp.sdc.vendorsoftwareproduct.factory.CandidateServiceFactory;
12 import org.openecomp.sdc.vendorsoftwareproduct.impl.mock.CandidateServiceFactoryMock;
13 import org.openecomp.sdc.vendorsoftwareproduct.impl.mock.NoSqlDbFactoryMock;
14 import org.openecomp.sdc.vendorsoftwareproduct.impl.mock.PackageInfoDaoFactoryImplMock;
15 import org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.process.OrchestrationTemplateProcessCsarHandler;
16 import org.openecomp.sdc.vendorsoftwareproduct.types.OrchestrationTemplateActionResponse;
17 import org.openecomp.sdc.versioning.dao.types.Version;
18
19 import java.nio.ByteBuffer;
20
21 import static org.junit.Assert.assertFalse;
22
23 public class OrchestrationTemplateProcessCsarHandlerTest {
24
25
26   @Before
27   public void insertMocks() {
28     EnrichmentManagerFactory.getInstance();
29     AbstractFactoryBase.registerFactory(NoSqlDbFactory.class, NoSqlDbFactoryMock.class);
30     AbstractFactoryBase
31         .registerFactory(PackageInfoDaoFactory.class, PackageInfoDaoFactoryImplMock.class);
32     AbstractFactoryBase
33         .registerFactory(PackageInfoDaoFactory.class, PackageInfoDaoFactoryImplMock.class);
34     AbstractFactoryBase
35         .registerFactory(CandidateServiceFactory.class, CandidateServiceFactoryMock.class);
36   }
37
38
39   @Test
40   public void validateErrorHandling() {
41     VspDetails vspDetails = new VspDetails("dummyId", new Version(1, 0));
42     OrchestrationTemplateCandidateData orchestrationTemplateCandidateData =
43         new OrchestrationTemplateCandidateData(ByteBuffer.wrap("".getBytes()), "", "zip", "file");
44     OrchestrationTemplateProcessCsarHandler handler = new OrchestrationTemplateProcessCsarHandler();
45     OrchestrationTemplateActionResponse response =
46         handler.process(vspDetails, orchestrationTemplateCandidateData);
47     assertFalse(response.getErrors().isEmpty());
48   }
49 }