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