diff --git a/src/main/java/org/etsi/osl/tmf/JsonUtils.java b/src/main/java/org/etsi/osl/tmf/JsonUtils.java index 92689cb88df7613f9b78841e3bbc64d9054e3701..ff2221ee9692313a8a7073cfa2e0a37deaac4904 100644 --- a/src/main/java/org/etsi/osl/tmf/JsonUtils.java +++ b/src/main/java/org/etsi/osl/tmf/JsonUtils.java @@ -5,6 +5,7 @@ import java.io.InputStream; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; /** * @author ctranoris @@ -12,27 +13,31 @@ import com.fasterxml.jackson.databind.ObjectMapper; */ public class JsonUtils { - static byte[] toJson(Object object) throws IOException { + public static byte[] toJson(Object object) throws IOException { ObjectMapper mapper = new ObjectMapper(); mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); + mapper.registerModule(new JavaTimeModule()); return mapper.writeValueAsBytes(object); } - static String toJsonString(Object object) throws IOException { + public static String toJsonString(Object object) throws IOException { ObjectMapper mapper = new ObjectMapper(); mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); + mapper.registerModule(new JavaTimeModule()); return mapper.writeValueAsString(object); } public static T toJsonObj(String content, Class valueType) throws IOException { ObjectMapper mapper = new ObjectMapper(); mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); + mapper.registerModule(new JavaTimeModule()); return mapper.readValue(content, valueType); } - static T toJsonObj(InputStream content, Class valueType) throws IOException { + public static T toJsonObj(InputStream content, Class valueType) throws IOException { ObjectMapper mapper = new ObjectMapper(); mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); + mapper.registerModule(new JavaTimeModule()); return mapper.readValue(content, valueType); } diff --git a/src/main/java/org/etsi/osl/tmf/ri639/reposervices/ResourceRepoService.java b/src/main/java/org/etsi/osl/tmf/ri639/reposervices/ResourceRepoService.java index 15a45d92b343515f30c6e5de55f9b22a3823910d..55db1280b24b88784f07f590bd3cb35878d92c7f 100644 --- a/src/main/java/org/etsi/osl/tmf/ri639/reposervices/ResourceRepoService.java +++ b/src/main/java/org/etsi/osl/tmf/ri639/reposervices/ResourceRepoService.java @@ -416,7 +416,7 @@ public class ResourceRepoService { if (resourceCharacteristicChanged) { Note n = new Note(); n.setText("Resource characteristics changed : " + charsChanged); - n.setAuthor( "RI6398-API" ); + n.setAuthor( "RI639-API" ); n.setDate( OffsetDateTime.now(ZoneOffset.UTC).toString() ); resource.addNoteItem( n ); @@ -425,7 +425,7 @@ public class ResourceRepoService { if (resourceStateChanged) { Note n = new Note(); n.setText("Resource resourceStateChanged changed to " + resource.getResourceStatus().toString() ); - n.setAuthor( "RI6398-API" ); + n.setAuthor( "RI639-API" ); n.setDate( OffsetDateTime.now(ZoneOffset.UTC).toString() ); resource.addNoteItem( n ); diff --git a/src/test/java/org/etsi/osl/services/api/AlarmManagementIntegrationTest.java b/src/test/java/org/etsi/osl/services/api/AlarmManagementIntegrationTest.java index 8b600163a413040729a298146c3019530425def4..df10383d21e92755af3a08e5f41653dc8fdc7b2e 100644 --- a/src/test/java/org/etsi/osl/services/api/AlarmManagementIntegrationTest.java +++ b/src/test/java/org/etsi/osl/services/api/AlarmManagementIntegrationTest.java @@ -35,6 +35,7 @@ import java.util.ArrayList; import org.apache.camel.ProducerTemplate; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; + import org.etsi.osl.tmf.OpenAPISpringBoot; import org.etsi.osl.tmf.am642.model.AffectedService; import org.etsi.osl.tmf.am642.model.Alarm; @@ -46,6 +47,8 @@ import org.etsi.osl.tmf.am642.model.Comment; import org.etsi.osl.tmf.am642.model.PerceivedSeverityType; import org.etsi.osl.tmf.am642.model.ProbableCauseType; import org.etsi.osl.tmf.am642.reposervices.AlarmRepoService; +import org.etsi.osl.tmf.JsonUtils; + import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/src/test/java/org/etsi/osl/services/api/CustomerIntegrationTest.java b/src/test/java/org/etsi/osl/services/api/CustomerIntegrationTest.java index c710490b31445406a3e2576ee12d54e42ef667f0..48d79bb7d8ec00c3ceda4bd864f73c581bb4f390 100644 --- a/src/test/java/org/etsi/osl/services/api/CustomerIntegrationTest.java +++ b/src/test/java/org/etsi/osl/services/api/CustomerIntegrationTest.java @@ -31,6 +31,7 @@ import java.util.UUID; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; + import org.etsi.osl.tmf.OpenAPISpringBoot; import org.etsi.osl.tmf.cm629.model.Customer; import org.etsi.osl.tmf.cm629.model.CustomerCreate; @@ -39,6 +40,8 @@ import org.etsi.osl.tmf.cm629.service.CustomerRepoService; import org.etsi.osl.tmf.pm632.model.ContactMedium; import org.etsi.osl.tmf.pm632.model.MediumCharacteristic; import org.etsi.osl.tmf.prm669.model.RelatedParty; +import org.etsi.osl.tmf.JsonUtils; + import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; diff --git a/src/test/java/org/etsi/osl/services/api/JsonUtils.java b/src/test/java/org/etsi/osl/services/api/JsonUtils.java deleted file mode 100644 index 404d70455aa61311475a57c78dd2ca94e6e182d5..0000000000000000000000000000000000000000 --- a/src/test/java/org/etsi/osl/services/api/JsonUtils.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.etsi.osl.services.api; - -import java.io.IOException; -import java.io.InputStream; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.databind.ObjectMapper; - -/** - * @author ctranoris - * - */ -public class JsonUtils { - - static byte[] toJson(Object object) throws IOException { - ObjectMapper mapper = new ObjectMapper(); - mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); - return mapper.writeValueAsBytes(object); - } - - static String toJsonString(Object object) throws IOException { - ObjectMapper mapper = new ObjectMapper(); - mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); - return mapper.writeValueAsString(object); - } - - static T toJsonObj(String content, Class valueType) throws IOException { - ObjectMapper mapper = new ObjectMapper(); - mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); - return mapper.readValue(content, valueType); - } - - static T toJsonObj(InputStream content, Class valueType) throws IOException { - ObjectMapper mapper = new ObjectMapper(); - mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); - return mapper.readValue(content, valueType); - } - -} diff --git a/src/test/java/org/etsi/osl/services/api/LCMRulesIntegrationTest.java b/src/test/java/org/etsi/osl/services/api/LCMRulesIntegrationTest.java index 12a12056c025d564b675f476f4e735d7db034adf..760adbe5106d64d181b31d17ba4f1d4ff445eed3 100644 --- a/src/test/java/org/etsi/osl/services/api/LCMRulesIntegrationTest.java +++ b/src/test/java/org/etsi/osl/services/api/LCMRulesIntegrationTest.java @@ -12,6 +12,7 @@ import java.util.List; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; + import org.etsi.osl.tmf.OpenAPISpringBoot; import org.etsi.osl.tmf.common.model.service.ServiceSpecificationRef; import org.etsi.osl.tmf.lcm.model.ELCMRulePhase; @@ -19,6 +20,8 @@ import org.etsi.osl.tmf.lcm.model.LCMRuleSpecification; import org.etsi.osl.tmf.lcm.model.LCMRuleSpecificationCreate; import org.etsi.osl.tmf.lcm.model.LCMRuleSpecificationUpdate; import org.etsi.osl.tmf.lcm.reposervices.LCMRuleSpecificationRepoService; +import org.etsi.osl.tmf.JsonUtils; + import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/src/test/java/org/etsi/osl/services/api/PartyManagementIntegrationTest.java b/src/test/java/org/etsi/osl/services/api/PartyManagementIntegrationTest.java index 7f002413fd37572beaa24a9fdbda1d4f842001a6..a328d446a66d81fa3e942f21e42402674ca041db 100644 --- a/src/test/java/org/etsi/osl/services/api/PartyManagementIntegrationTest.java +++ b/src/test/java/org/etsi/osl/services/api/PartyManagementIntegrationTest.java @@ -35,6 +35,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.etsi.osl.tmf.OpenAPISpringBoot; import org.etsi.osl.tmf.common.model.Any; + import org.etsi.osl.tmf.pm632.model.Characteristic; import org.etsi.osl.tmf.pm632.model.ContactMedium; import org.etsi.osl.tmf.pm632.model.Individual; @@ -44,6 +45,8 @@ import org.etsi.osl.tmf.pm632.model.Organization; import org.etsi.osl.tmf.pm632.model.OrganizationCreate; import org.etsi.osl.tmf.pm632.reposervices.IndividualRepoService; import org.etsi.osl.tmf.pm632.reposervices.OrganizationRepoService; +import org.etsi.osl.tmf.JsonUtils; + import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/src/test/java/org/etsi/osl/services/api/ProductCatalogIntegrationTest.java b/src/test/java/org/etsi/osl/services/api/ProductCatalogIntegrationTest.java index de3915c102e8e3e17563cabba615d77ddb0da24f..fc2b66ebe395c7e0757ea686fa97a90a760f85de 100644 --- a/src/test/java/org/etsi/osl/services/api/ProductCatalogIntegrationTest.java +++ b/src/test/java/org/etsi/osl/services/api/ProductCatalogIntegrationTest.java @@ -34,6 +34,7 @@ import java.util.UUID; import org.apache.commons.io.IOUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; + import org.etsi.osl.tmf.OpenAPISpringBoot; import org.etsi.osl.tmf.pcm620.model.BundledProductOffering; import org.etsi.osl.tmf.pcm620.model.Catalog; @@ -61,6 +62,8 @@ import org.etsi.osl.tmf.pcm620.reposervices.ProductCategoryRepoService; import org.etsi.osl.tmf.pcm620.reposervices.ProductOfferingPriceRepoService; import org.etsi.osl.tmf.pcm620.reposervices.ProductOfferingRepoService; import org.etsi.osl.tmf.pcm620.reposervices.ProductSpecificationRepoService; +import org.etsi.osl.tmf.JsonUtils; + import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/src/test/java/org/etsi/osl/services/api/ResourceCatalogIntegrationTest.java b/src/test/java/org/etsi/osl/services/api/ResourceCatalogIntegrationTest.java index 039a6197096e1c22eb081b4b601bba9269220429..926f88a057a13ce54fea11eea9a5825f2b57029e 100644 --- a/src/test/java/org/etsi/osl/services/api/ResourceCatalogIntegrationTest.java +++ b/src/test/java/org/etsi/osl/services/api/ResourceCatalogIntegrationTest.java @@ -38,6 +38,7 @@ import java.net.URI; import org.apache.commons.io.IOUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; + import org.etsi.osl.tmf.OpenAPISpringBoot; import org.etsi.osl.tmf.common.model.Any; import org.etsi.osl.tmf.common.model.Attachment; @@ -69,6 +70,8 @@ import org.etsi.osl.tmf.rcm634.reposervices.ResourceCandidateRepoService; import org.etsi.osl.tmf.rcm634.reposervices.ResourceCatalogRepoService; import org.etsi.osl.tmf.rcm634.reposervices.ResourceCategoryRepoService; import org.etsi.osl.tmf.rcm634.reposervices.ResourceSpecificationRepoService; +import org.etsi.osl.tmf.JsonUtils; + import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -102,10 +105,11 @@ public class ResourceCatalogIntegrationTest { private static final transient Log logger = LogFactory.getLog( ResourceCatalogIntegrationTest.class.getName()); - private static final int FIXED_BOOTSTRAPS_SPECS = 3; - private static final int FIXED_BOOTSTRAPS_CATEGORIES = 2; + private static final int FIXED_BOOTSTRAPS_SPECS = 7; + private static final int FIXED_BOOTSTRAPS_CATEGORIES = 3; private static final int FIXED_BOOTSTRAPS_PHYSICAL_SPECS = 1; - private static final int FIXED_BOOTSTRAPS_LOGICAL_SPECS = 2; + private static final int FIXED_BOOTSTRAPS_NETWORK_SPECS = 3; + private static final int FIXED_BOOTSTRAPS_LOGICAL_SPECS = 6; @Autowired private MockMvc mvc; @@ -137,9 +141,8 @@ public class ResourceCatalogIntegrationTest { @Test public void _countDefaultProperties() { - assertThat( catalogRepoService.findAll().size() ).isEqualTo( 1 ); - assertThat( categRepoService.findAll().size() ).isEqualTo( 2 ); + assertThat( categRepoService.findAll().size() ).isEqualTo( FIXED_BOOTSTRAPS_CATEGORIES ); assertThat( candidateRepoService.findAll().size() ).isEqualTo( FIXED_BOOTSTRAPS_SPECS ); assertThat( specRepoService.findAll().size() ).isEqualTo( FIXED_BOOTSTRAPS_SPECS ); @@ -148,7 +151,7 @@ public class ResourceCatalogIntegrationTest { assertThat( categRepoService.findByName( "Network Resources" ) ).isNotNull() ; ResourceCategory categ = categRepoService.findByName( "Network Resources" ); - assertThat( categ.getResourceCandidateRefs().size() ).isEqualTo( FIXED_BOOTSTRAPS_SPECS ); + assertThat( categ.getResourceCandidateRefs().size() ).isEqualTo( FIXED_BOOTSTRAPS_NETWORK_SPECS ); } @@ -376,12 +379,11 @@ public class ResourceCatalogIntegrationTest { assertThat( parentRootCategory.getCategoryRefs().get(0).getId() ).isEqualTo( child1Subcategory.getId() ); /** - * add to a resource catalog and delete the service catalog, to chech that categories are still there + * add to a resource catalog and delete the service catalog, to check that categories are still there * */ - - ResourceCatalog catalog = catalogRepoService.findByName( "Catalog" ); - assertThat( catalog.getCategoryRefs().size() ).isEqualTo( 2 ); + ResourceCatalog catalog = catalogRepoService.findByName( "Catalog" ); + assertThat( catalog.getCategoryRefs().size() ).isEqualTo( FIXED_BOOTSTRAPS_CATEGORIES ); ResourceCatalogUpdate scu = new ResourceCatalogUpdate(); scu.setName( catalog.getName() ); for (ResourceCategoryRef iref : catalog.getCategoryRefs()) { @@ -392,7 +394,7 @@ public class ResourceCatalogIntegrationTest { scu.addCategoryItem( categoryItem ); catalog = catalogRepoService.updateCatalog( catalog.getId(), scu); - assertThat( catalog.getCategoryRefs().size() ).isEqualTo( 3 ); + assertThat( catalog.getCategoryRefs().size() ).isEqualTo( FIXED_BOOTSTRAPS_CATEGORIES + 1 ); assertThat( categRepoService.findAll().size() ).isEqualTo( FIXED_BOOTSTRAPS_CATEGORIES + 2 ); assertThat( catalogRepoService.findAll().size() ).isEqualTo( 1 ); catalogRepoService.deleteById( catalog.getId() );//delete @@ -841,7 +843,7 @@ public class ResourceCatalogIntegrationTest { String physsspectext = IOUtils.toString(in, "UTF-8"); PhysicalResourceSpecificationCreate physspeccr2 = JsonUtils.toJsonObj( physsspectext, PhysicalResourceSpecificationCreate.class); phyresponsesSpec1 = (PhysicalResourceSpecification) createResourceSpec( physspeccr2); - + assertThat( specRepoService.findAll().size() ).isEqualTo( FIXED_BOOTSTRAPS_SPECS + 3 ); assertThat( specRepoService.findAllPhysical().size() ).isEqualTo( FIXED_BOOTSTRAPS_PHYSICAL_SPECS + 2 ); diff --git a/src/test/java/org/etsi/osl/services/api/ResourceInventoryIntegrationTest.java b/src/test/java/org/etsi/osl/services/api/ResourceInventoryIntegrationTest.java index 2720c7326ea0a5e80f6b22e8eddafdc5e5ba2f65..ee4d7a4f59c3385015c424b3dbe7d4182e965ca8 100644 --- a/src/test/java/org/etsi/osl/services/api/ResourceInventoryIntegrationTest.java +++ b/src/test/java/org/etsi/osl/services/api/ResourceInventoryIntegrationTest.java @@ -39,6 +39,7 @@ import java.util.ArrayList; import org.apache.commons.io.IOUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; + import org.etsi.osl.tmf.OpenAPISpringBoot; import org.etsi.osl.tmf.common.model.Any; import org.etsi.osl.tmf.common.model.UserPartRoleType; @@ -63,6 +64,8 @@ import org.etsi.osl.tmf.ri639.model.ResourceOperationalStateType; import org.etsi.osl.tmf.ri639.model.ResourceRelationship; import org.etsi.osl.tmf.ri639.model.ResourceUpdate; import org.etsi.osl.tmf.ri639.reposervices.ResourceRepoService; +import org.etsi.osl.tmf.JsonUtils; + import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -291,7 +294,7 @@ public class ResourceInventoryIntegrationTest { assertThat( resourceRepoService.findAll().size() ).isEqualTo( 2 ); assertThat( responseRes2.getEndOperatingDate() ).isNotNull(); - assertThat( responseRes2.getNote().size() ).isEqualTo( 3 ); + assertThat( responseRes2.getNote().size() ).isEqualTo( 4 ); assertThat( responseRes2.getResourceCharacteristic().size() ).isEqualTo( 2 ); assertThat( responseRes2.getResourceCharacteristicByName( "ConfigStatus" ).getValue().getValue() ).isEqualTo( "RUNNING" ) ; assertThat( responseRes2.getResourceCharacteristicByName( "DeploymentRequestID" ).getValue().getValue() ).isEqualTo( "007a008" ) ; @@ -317,7 +320,7 @@ public class ResourceInventoryIntegrationTest { assertThat( resourceRepoService.findAll().size() ).isEqualTo( 2 ); assertThat( responseRes2.getEndOperatingDate() ).isNotNull(); - assertThat( responseRes2.getNote().size() ).isEqualTo( 3 ); + assertThat( responseRes2.getNote().size() ).isEqualTo( 4 ); assertThat( responseRes2.getResourceCharacteristic().size() ).isEqualTo( 2 ); assertThat( responseRes2.getResourceCharacteristicByName( "ConfigStatus" ).getValue().getValue() ).isEqualTo( "RUNNING" ) ; assertThat( responseRes2.getResourceCharacteristicByName( "DeploymentRequestID" ).getValue().getValue() ).isEqualTo( "007a008" ) ; @@ -344,7 +347,7 @@ public class ResourceInventoryIntegrationTest { assertThat( resourceRepoService.findAll().size() ).isEqualTo( 2 ); assertThat( responseRes2.getEndOperatingDate() ).isNotNull(); - assertThat( responseRes2.getNote().size() ).isEqualTo( 4 ); + assertThat( responseRes2.getNote().size() ).isEqualTo( 5 ); assertThat( responseRes2.getResourceCharacteristic().size() ).isEqualTo( 2 ); assertThat( responseRes2.getResourceCharacteristicByName( "ConfigStatus" ).getValue().getValue() ).isEqualTo( "RUNNING" ) ; assertThat( responseRes2.getResourceCharacteristicByName( "DeploymentRequestID" ).getValue().getValue() ).isEqualTo( "007a008" ) ; diff --git a/src/test/java/org/etsi/osl/services/api/ResourceOrderIntegrationTest.java b/src/test/java/org/etsi/osl/services/api/ResourceOrderIntegrationTest.java index 5c529087fc8b141caeb1fb39e08588ffa837ef08..592b6e4d42d9e475a4ed4a2bae0878cab8a091dd 100644 --- a/src/test/java/org/etsi/osl/services/api/ResourceOrderIntegrationTest.java +++ b/src/test/java/org/etsi/osl/services/api/ResourceOrderIntegrationTest.java @@ -18,6 +18,7 @@ import java.util.Set; import org.apache.commons.io.IOUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; + import org.etsi.osl.tmf.OpenAPISpringBoot; import org.etsi.osl.tmf.common.model.Any; import org.etsi.osl.tmf.rcm634.model.LogicalResourceSpecification; @@ -36,6 +37,8 @@ import org.etsi.osl.tmf.ro652.model.ExternalId; import org.etsi.osl.tmf.ro652.model.ResourceOrder; import org.etsi.osl.tmf.ro652.model.ResourceOrderCreate; import org.etsi.osl.tmf.ro652.model.ResourceOrderItem; +import org.etsi.osl.tmf.JsonUtils; + import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; @@ -78,7 +81,7 @@ public class ResourceOrderIntegrationTest { public void testResourceOrderCreate() throws UnsupportedEncodingException, IOException, Exception { - File sspec = new File("src/main/resources/resourceSpecifications/OSMTenantResourceSpecification.json"); + File sspec = new File("src/main/resources/resourceSpecifications/osm-tenant.openslice.io.json"); InputStream in = new FileInputStream(sspec); String sspectext = IOUtils.toString(in, "UTF-8"); @@ -162,7 +165,7 @@ public class ResourceOrderIntegrationTest { assertThat( responseRO.getRequestedCompletionDate()).isNotNull(); assertThat( responseRO.getOrderItem().stream().findFirst().get() ).isNotNull(); assertThat( responseRO.getOrderItem().stream().findFirst().get().getResource().getId() ).isNotNull(); - assertThat( responseRO.getOrderItem().stream().findFirst().get().getResource().getName() ).isEqualTo( "OSM Tenant" ) ; + assertThat( responseRO.getOrderItem().stream().findFirst().get().getResource().getName() ).isEqualTo( "osm-tenant.openslice.io" ) ; } private ResourceSpecification createResourceSpec(ResourceSpecificationUpdate sspeccr1) throws Exception { diff --git a/src/test/java/org/etsi/osl/services/api/ResourcePoolIntegrationTest.java b/src/test/java/org/etsi/osl/services/api/ResourcePoolIntegrationTest.java index 66f37387616ac583075a09b0087a6a821c66364f..a9763dd599bea04a9468e87149304f386a837bff 100644 --- a/src/test/java/org/etsi/osl/services/api/ResourcePoolIntegrationTest.java +++ b/src/test/java/org/etsi/osl/services/api/ResourcePoolIntegrationTest.java @@ -40,6 +40,7 @@ import java.util.Set; import org.apache.commons.io.IOUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; + import org.etsi.osl.tmf.OpenAPISpringBoot; import org.etsi.osl.tmf.common.model.service.ResourceRef; import org.etsi.osl.tmf.rcm634.model.LogicalResourceSpecification; @@ -65,6 +66,8 @@ import org.etsi.osl.tmf.rpm685.model.ResourcePoolCreate; import org.etsi.osl.tmf.rpm685.model.ResourcePoolRef; import org.etsi.osl.tmf.rpm685.model.ResourcePoolUpdate; import org.etsi.osl.tmf.rpm685.reposervices.ResourcePoolRepoService; +import org.etsi.osl.tmf.JsonUtils; + import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/src/test/java/org/etsi/osl/services/api/ServiceCatalogIntegrationTest.java b/src/test/java/org/etsi/osl/services/api/ServiceCatalogIntegrationTest.java index f5da7aa8a7fa6a5cb7591471d40e666b38e40a99..56f3a73432b6c1d228a38b5a7a607811bf887080 100644 --- a/src/test/java/org/etsi/osl/services/api/ServiceCatalogIntegrationTest.java +++ b/src/test/java/org/etsi/osl/services/api/ServiceCatalogIntegrationTest.java @@ -42,6 +42,7 @@ import java.util.UUID; import org.apache.commons.io.IOUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; + import org.etsi.osl.tmf.BootstrapRepository; import org.etsi.osl.tmf.OpenAPISpringBoot; import org.etsi.osl.tmf.common.model.Any; @@ -76,6 +77,8 @@ import org.etsi.osl.tmf.scm633.reposervices.CandidateRepoService; import org.etsi.osl.tmf.scm633.reposervices.CatalogRepoService; import org.etsi.osl.tmf.scm633.reposervices.CategoryRepoService; import org.etsi.osl.tmf.scm633.reposervices.ServiceSpecificationRepoService; +import org.etsi.osl.tmf.JsonUtils; + import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -519,9 +522,9 @@ public class ServiceCatalogIntegrationTest { val.setValueType( EValueType.ARRAY.toString()); val.setValue( new Any("1" ,"a second value") ); responsesSpecUpd.getServiceSpecCharacteristic().get(0).getServiceSpecCharacteristicValue().add(val); - ServiceSpecCharRelationship scrObj = responsesSpecUpd.getServiceSpecCharacteristic().get(0).getServiceSpecCharRelationship().toArray( new ServiceSpecCharRelationship[0])[0]; - ServiceSpecCharRelationship scrObj2 = responsesSpecUpd.getServiceSpecCharacteristic().get(0).getServiceSpecCharRelationship().toArray( new ServiceSpecCharRelationship[0])[1]; - ServiceSpecCharRelationship scrObj3 = responsesSpecUpd.getServiceSpecCharacteristic().get(0).getServiceSpecCharRelationship().toArray( new ServiceSpecCharRelationship[0])[2]; + ServiceSpecCharRelationship scrObj = responsesSpecUpd.getServiceSpecCharacteristic().get(0).getServiceSpecCharRelationship().toArray( new ServiceSpecCharRelationship[3])[0]; + ServiceSpecCharRelationship scrObj2 = responsesSpecUpd.getServiceSpecCharacteristic().get(0).getServiceSpecCharRelationship().toArray( new ServiceSpecCharRelationship[3])[1]; + ServiceSpecCharRelationship scrObj3 = responsesSpecUpd.getServiceSpecCharacteristic().get(0).getServiceSpecCharRelationship().toArray( new ServiceSpecCharRelationship[3])[2]; scrObj3.setName("FORTESTING"); String preid = scrObj3.getId(); responsesSpecUpd.getServiceSpecCharacteristic().get(0).getServiceSpecCharRelationship().remove(scrObj); @@ -792,7 +795,7 @@ public class ServiceCatalogIntegrationTest { assertThat( clonedSpec.findSpecCharacteristicByName("Coverage") ).isNotNull(); assertThat( clonedSpec.findSpecCharacteristicByName("Coverage").getUuid() ).isNotNull(); assertThat( clonedSpec.findSpecCharacteristicByName("Coverage").getUuid() ).isNotEqualTo( responsesSpec3.findSpecCharacteristicByName("Coverage").getUuid() ); - + assertThat(clonedSpec.getServiceSpecCharacteristic().size()).isEqualTo(responsesSpec3.getServiceSpecCharacteristic().size()); assertThat( specRepoService.findAll().size() ).isEqualTo( FIXED_BOOTSTRAPS_SPECS + 4 ); @@ -809,7 +812,7 @@ public class ServiceCatalogIntegrationTest { assertThat( specRepoService.findAll().size() ).isEqualTo( FIXED_BOOTSTRAPS_SPECS + 5 ); - + String responseSpecClonedVINNI = mvc.perform(MockMvcRequestBuilders.get("/serviceCatalogManagement/v4/serviceSpecification/cloneVINNI?serviceName=aVINNIService") .contentType(MediaType.APPLICATION_JSON) .param("addServiceTopology", "true") @@ -827,20 +830,19 @@ public class ServiceCatalogIntegrationTest { .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()) .andReturn().getResponse().getContentAsString(); - clonedSpec = JsonUtils.toJsonObj( responseSpecClonedVINNI, ServiceSpecification.class); - assertThat( clonedSpec.getName() ).isEqualTo( "aVINNIService" ); + assertThat( clonedSpec.getName() ).isEqualTo( "aVINNIService" ); assertThat( specRepoService.findAll().size() ).isEqualTo( FIXED_BOOTSTRAPS_SPECS + 16 ); - + /** * the bundle service characteristics must be same with the total of characteristics of each service in the bundle * */ - - assertThat( clonedSpec.getServiceSpecCharacteristic().size() ).isEqualTo( 70 ); - + + assertThat( clonedSpec.getServiceSpecCharacteristic().size() ).isEqualTo( 71 ); + String responseSpecClonedVINNI2 = mvc.perform(MockMvcRequestBuilders.get("/serviceCatalogManagement/v4/serviceSpecification/cloneVINNI?serviceName=aVINNIService") .contentType(MediaType.APPLICATION_JSON) diff --git a/src/test/java/org/etsi/osl/services/api/ServiceInventoryIntegrationTest.java b/src/test/java/org/etsi/osl/services/api/ServiceInventoryIntegrationTest.java index c8e7164d03121d7cf087b96dc404d95677a42295..d31dd72da06a1f5aa54e6b05338769738e96b750 100644 --- a/src/test/java/org/etsi/osl/services/api/ServiceInventoryIntegrationTest.java +++ b/src/test/java/org/etsi/osl/services/api/ServiceInventoryIntegrationTest.java @@ -38,6 +38,7 @@ import java.time.ZoneOffset; import org.apache.commons.io.IOUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; + import org.etsi.osl.tmf.OpenAPISpringBoot; import org.etsi.osl.tmf.common.model.Any; import org.etsi.osl.tmf.common.model.UserPartRoleType; @@ -59,6 +60,8 @@ import org.etsi.osl.tmf.sim638.model.ServiceActionQueueAction; import org.etsi.osl.tmf.sim638.model.ServiceCreate; import org.etsi.osl.tmf.sim638.model.ServiceUpdate; import org.etsi.osl.tmf.sim638.service.ServiceRepoService; +import org.etsi.osl.tmf.JsonUtils; + import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/src/test/java/org/etsi/osl/services/api/ServiceOrderIntegrationTest.java b/src/test/java/org/etsi/osl/services/api/ServiceOrderIntegrationTest.java index f0ae5a5fc1c3c095c3ab5ac47952a40781dc7727..71849ba8cc2a9d906f51b9867c033a43fda5a5a5 100644 --- a/src/test/java/org/etsi/osl/services/api/ServiceOrderIntegrationTest.java +++ b/src/test/java/org/etsi/osl/services/api/ServiceOrderIntegrationTest.java @@ -40,6 +40,7 @@ import org.apache.camel.builder.RouteBuilder; import org.apache.commons.io.IOUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; + import org.etsi.osl.tmf.OpenAPISpringBoot; import org.etsi.osl.tmf.common.model.Any; import org.etsi.osl.tmf.common.model.UserPartRoleType; @@ -67,6 +68,8 @@ import org.etsi.osl.tmf.so641.model.ServiceOrderStateType; import org.etsi.osl.tmf.so641.model.ServiceOrderUpdate; import org.etsi.osl.tmf.so641.model.ServiceRestriction; import org.etsi.osl.tmf.so641.reposervices.ServiceOrderRepoService; +import org.etsi.osl.tmf.JsonUtils; + import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/src/test/java/org/etsi/osl/services/api/ServiceTestManagementIntegrationTest.java b/src/test/java/org/etsi/osl/services/api/ServiceTestManagementIntegrationTest.java index a3acefa3ba171c057113de8ca65786af1e40e5f6..dc212c3d361682cb426113a5822b96717bf86f7d 100644 --- a/src/test/java/org/etsi/osl/services/api/ServiceTestManagementIntegrationTest.java +++ b/src/test/java/org/etsi/osl/services/api/ServiceTestManagementIntegrationTest.java @@ -35,12 +35,15 @@ import java.io.UnsupportedEncodingException; import org.apache.commons.io.IOUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; + import org.etsi.osl.tmf.OpenAPISpringBoot; import org.etsi.osl.tmf.sim638.service.ServiceRepoService; import org.etsi.osl.tmf.stm653.model.ServiceTestCreate; import org.etsi.osl.tmf.stm653.model.ServiceTestSpecificationCreate; import org.etsi.osl.tmf.stm653.reposervices.ServiceTestRepoService; import org.etsi.osl.tmf.stm653.reposervices.ServiceTestSpecificationRepoService; +import org.etsi.osl.tmf.JsonUtils; + import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith;