diff options
author | 2016-10-27 09:28:49 +0000 | |
---|---|---|
committer | 2016-10-27 09:28:49 +0000 | |
commit | fb734fa273373b0719b3db32332370df5223b8f6 (patch) | |
tree | 0697e064615d3b1662252ae9d1e0cf65a7452af0 /catalog-core/catalog-mgr | |
parent | 5f6c112e62c87f0b6aa86df22888b70ad68d2207 (diff) | |
parent | e1ae56c72fa016eddcb52f8046524c20f09cc1a6 (diff) |
Merge "TOSCA-152 Add metadata and service Template original Id property for service Template table"
Diffstat (limited to 'catalog-core/catalog-mgr')
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 Binary files differindex 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 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)
);
|