1 package org.openecomp.sdc.vendorsoftwareproduct.impl;
3 import org.junit.Before;
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;
19 import java.nio.ByteBuffer;
21 import static org.junit.Assert.assertFalse;
23 public class OrchestrationTemplateProcessCsarHandlerTest {
27 public void insertMocks() {
28 EnrichmentManagerFactory.getInstance();
29 AbstractFactoryBase.registerFactory(NoSqlDbFactory.class, NoSqlDbFactoryMock.class);
31 .registerFactory(PackageInfoDaoFactory.class, PackageInfoDaoFactoryImplMock.class);
33 .registerFactory(PackageInfoDaoFactory.class, PackageInfoDaoFactoryImplMock.class);
35 .registerFactory(CandidateServiceFactory.class, CandidateServiceFactoryMock.class);
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());