aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/db/entity/ServiceTemplateData.java21
-rw-r--r--catalog-core/catalog-mgr/src/test/java/org/openo/commontosca/catalog/db/resource/TemplateManagerTest.java16
-rw-r--r--catalog-core/catalog-mgr/src/test/java/org/openo/commontosca/catalog/db/util/H2DbServerUtil.java2
-rw-r--r--catalog-core/catalog-mgr/src/test/resources/db/catalog.mv.dbbin12288 -> 16384 bytes
-rw-r--r--catalog-core/catalog-mgr/src/test/resources/sql/catalog-resource-createObj-mysql.sql4
5 files changed, 40 insertions, 3 deletions
diff --git a/catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/db/entity/ServiceTemplateData.java b/catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/db/entity/ServiceTemplateData.java
index ddaa5fce..7348b868 100644
--- a/catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/db/entity/ServiceTemplateData.java
+++ b/catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/db/entity/ServiceTemplateData.java
@@ -56,6 +56,12 @@ public class ServiceTemplateData extends BaseData {
@Column(name = "OPERATIONS")
private String operations;
+ @Column(name = "METADATA")
+ private String metadata;
+
+ @Column(name = "SERVICETEMPLATEORIGINALID")
+ private String serviceTemplateOriginalId;
+
public String getRowData() {
return rowData;
}
@@ -136,4 +142,19 @@ public class ServiceTemplateData extends BaseData {
return serviceTemplateId;
}
+ public String getMetadata() {
+ return metadata;
+ }
+
+ public void setMetadata(String metadata) {
+ this.metadata = metadata;
+ }
+
+ public String getServiceTemplateOriginalId() {
+ return serviceTemplateOriginalId;
+ }
+
+ public void setServiceTemplateOriginalId(String serviceTemplateOriginalId) {
+ this.serviceTemplateOriginalId = serviceTemplateOriginalId;
+ }
}
diff --git a/catalog-core/catalog-mgr/src/test/java/org/openo/commontosca/catalog/db/resource/TemplateManagerTest.java b/catalog-core/catalog-mgr/src/test/java/org/openo/commontosca/catalog/db/resource/TemplateManagerTest.java
index 93faff11..b977832f 100644
--- a/catalog-core/catalog-mgr/src/test/java/org/openo/commontosca/catalog/db/resource/TemplateManagerTest.java
+++ b/catalog-core/catalog-mgr/src/test/java/org/openo/commontosca/catalog/db/resource/TemplateManagerTest.java
@@ -75,6 +75,8 @@ public class TemplateManagerTest {
serviceData.setOperations("SDFSDFDSERWERWE");
serviceData.setVendor("ZTE");
serviceData.setVersion("v1.0");
+ serviceData.setMetadata("metadata");
+ serviceData.setServiceTemplateOriginalId("NS_01");
NodeTemplateData nodeData = new NodeTemplateData();
nodeData.setName("node");
nodeData.setNodeTemplateId("30001");
@@ -112,6 +114,8 @@ public class TemplateManagerTest {
serviceData.setServiceTemplateId("20001");
serviceData.setVendor("ZTE");
serviceData.setVersion("v1.0");
+ serviceData.setMetadata("metadata");
+ serviceData.setServiceTemplateOriginalId("NS_01");
NodeTemplateData nodeData = new NodeTemplateData();
nodeData.setName("node");
nodeData.setServiceTemplateId("20001");
@@ -136,7 +140,17 @@ public class TemplateManagerTest {
}
Assert.assertTrue(list.size() > 0);
}
-
+ @Test
+ public void testQueryServiceTemplateByIdAndMetadataIsNotNull() {
+ ArrayList<ServiceTemplateData> list = new ArrayList<ServiceTemplateData>();
+ try {
+ list = manager.queryServiceTemplateById("20001");
+ } catch (CatalogResourceException e1) {
+ Assert.fail("Exception" + e1.getMessage());
+ }
+ Assert
+ .assertTrue(list.size() > 0 && "NS_01".equals(list.get(0).getServiceTemplateOriginalId()));
+ }
@Test
public void testQueryServiceTemplate() {
diff --git a/catalog-core/catalog-mgr/src/test/java/org/openo/commontosca/catalog/db/util/H2DbServerUtil.java b/catalog-core/catalog-mgr/src/test/java/org/openo/commontosca/catalog/db/util/H2DbServerUtil.java
index d609182c..327de491 100644
--- a/catalog-core/catalog-mgr/src/test/java/org/openo/commontosca/catalog/db/util/H2DbServerUtil.java
+++ b/catalog-core/catalog-mgr/src/test/java/org/openo/commontosca/catalog/db/util/H2DbServerUtil.java
@@ -56,7 +56,7 @@ public class H2DbServerUtil {
/**
* test.
*/
- public static void main() {
+ public static void main(String args[]) {
H2DbServer.startUp();
H2DbServerUtil.initTable();
H2DbServer.shutDown();
diff --git a/catalog-core/catalog-mgr/src/test/resources/db/catalog.mv.db b/catalog-core/catalog-mgr/src/test/resources/db/catalog.mv.db
index b1d596f4..02d0712e 100644
--- a/catalog-core/catalog-mgr/src/test/resources/db/catalog.mv.db
+++ b/catalog-core/catalog-mgr/src/test/resources/db/catalog.mv.db
Binary files differ
diff --git a/catalog-core/catalog-mgr/src/test/resources/sql/catalog-resource-createObj-mysql.sql b/catalog-core/catalog-mgr/src/test/resources/sql/catalog-resource-createObj-mysql.sql
index b2d5edf8..209c2598 100644
--- a/catalog-core/catalog-mgr/src/test/resources/sql/catalog-resource-createObj-mysql.sql
+++ b/catalog-core/catalog-mgr/src/test/resources/sql/catalog-resource-createObj-mysql.sql
@@ -46,7 +46,9 @@ CREATE TABLE catalog_service_template_table (
INPUTS LONGTEXT NULL,
ROWDATA LONGTEXT NULL,
OPERATIONS LONGTEXT NULL,
- DOWNLOADURI VARCHAR(200) NULL,
+ DOWNLOADURI VARCHAR(200) NULL,
+ SERVICETEMPLATEORIGINALID VARCHAR(100) NULL,
+ METADATA LONGTEXT NULL,
CONSTRAINT CATALOG_SERVICE_TEMPLATE_TABLE_OID PRIMARY KEY(SERVICETEMPLATEID)
);