summaryrefslogtreecommitdiffstats
path: root/catalog-be/src/test/java/org
diff options
context:
space:
mode:
authorKrupaNagabhushan <krupa.nagabhushan@est.tech>2022-10-26 17:26:54 +0100
committerKrupaNagabhushan <krupa.nagabhushan@est.tech>2023-01-19 15:23:12 +0000
commit3943534cd3409c0cca6588f36527df34345d74f2 (patch)
treefc10c05a93fe853f21f1f3beddf5d0557d7bad1d /catalog-be/src/test/java/org
parent8edfa4dee9fed9be5b38133847c60136294eba80 (diff)
Download data type from UI
Issue-ID: SDC-4332 Signed-off-by: KrupaNagabhushan <krupa.nagabhushan@est.tech> Change-Id: If31f7a95eb2d568e716760a33ef2641bad09cf68
Diffstat (limited to 'catalog-be/src/test/java/org')
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/servlets/TypesFetchServletTest.java12
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaExportHandlerTest.java10
2 files changed, 22 insertions, 0 deletions
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/TypesFetchServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/TypesFetchServletTest.java
index d7f23f1b21..3de087ff32 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/TypesFetchServletTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/TypesFetchServletTest.java
@@ -63,9 +63,11 @@ import org.openecomp.sdc.be.impl.WebAppContextWrapper;
import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.Resource;
import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.be.model.operations.impl.DataTypeOperation;
import org.openecomp.sdc.be.model.operations.impl.ModelOperation;
import org.openecomp.sdc.be.servlets.builder.ServletResponseBuilder;
import org.openecomp.sdc.be.servlets.exception.OperationExceptionMapper;
+import org.openecomp.sdc.be.tosca.ToscaExportHandler;
import org.openecomp.sdc.be.user.Role;
import org.openecomp.sdc.be.user.UserBusinessLogic;
import org.openecomp.sdc.common.api.ConfigurationSource;
@@ -119,6 +121,10 @@ class TypesFetchServletTest extends JerseyTest {
private ResponseFormatManager responseFormatManager;
@Mock
private ModelOperation modelOperation;
+ @Mock
+ private DataTypeOperation dataTypeOperation;
+ @Mock
+ private ToscaExportHandler toscaExportHandler;
private final Path rootPath = Path.of("/v1/catalog");
private final Path nodeTypesPath = rootPath.resolve("nodeTypes");
@@ -218,6 +224,8 @@ class TypesFetchServletTest extends JerseyTest {
bind(interfaceOperationBusinessLogic).to(InterfaceOperationBusinessLogic.class);
bind(artifactTypeBusinessLogic).to(ArtifactTypeBusinessLogic.class);
bind(modelOperation).to(ModelOperation.class);
+ bind(dataTypeOperation).to(DataTypeOperation.class);
+ bind(toscaExportHandler).to(ToscaExportHandler.class);
}
})
.register(new OperationExceptionMapper(
@@ -264,6 +272,10 @@ class TypesFetchServletTest extends JerseyTest {
.thenReturn(artifactTypeBusinessLogic);
when(webApplicationContext.getBean(ModelOperation.class))
.thenReturn(modelOperation);
+ when(webApplicationContext.getBean(DataTypeOperation.class))
+ .thenReturn(dataTypeOperation);
+ when(webApplicationContext.getBean(ToscaExportHandler.class))
+ .thenReturn(toscaExportHandler);
}
void initConfig() {
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaExportHandlerTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaExportHandlerTest.java
index 736fcbcd7f..7d16c906c4 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaExportHandlerTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaExportHandlerTest.java
@@ -291,6 +291,16 @@ class ToscaExportHandlerTest extends BaseConfDependent {
}
@Test
+ void testExportDataType() {
+ DataTypeDefinition dataTypeDefinition = new DataTypeDefinition();
+ dataTypeDefinition.setUniqueId("uniqueId");
+ Either<ToscaRepresentation, ToscaError> result;
+ when(applicationDataTypeCache.getAll(null)).thenReturn(Either.left(new HashMap<>()));
+ result = testSubject.exportDataType(dataTypeDefinition);
+ assertNotNull(result);
+ }
+
+ @Test
void testConvertInterfaceNodeTypeProperties() {
Resource component = getNewResource();