diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/DataInjectionCommandLineRunner.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/DataInjectionCommandLineRunner.java index 2ca41ed4..52f8907e 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/DataInjectionCommandLineRunner.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/DataInjectionCommandLineRunner.java @@ -28,6 +28,7 @@ import org.eclipse.tractusx.puris.backend.masterdata.domain.model.Material; import org.eclipse.tractusx.puris.backend.masterdata.domain.model.MaterialPartnerRelation; import org.eclipse.tractusx.puris.backend.masterdata.domain.model.Partner; +import org.eclipse.tractusx.puris.backend.masterdata.domain.model.Site; import org.eclipse.tractusx.puris.backend.masterdata.logic.service.MaterialPartnerRelationService; import org.eclipse.tractusx.puris.backend.masterdata.logic.service.MaterialService; import org.eclipse.tractusx.puris.backend.masterdata.logic.service.PartnerService; @@ -97,6 +98,12 @@ public class DataInjectionCommandLineRunner implements CommandLineRunner { private final String semiconductorMatNbrCustomer = "MNR-7307-AU340474.002"; private final String semiconductorMatNbrSupplier = "MNR-8101-ID146955.001"; + private final String semiconductorMatNbrCatenaX = "860fb504-b884-4009-9313-c6fb6cdc776b"; + + private final String supplierSiteNyBpns = "BPNS1234567890ZZ"; + + private final String supplierSiteLaBpns = "BPNS2222222222SS"; + public DataInjectionCommandLineRunner(ObjectMapper objectMapper) { this.objectMapper = objectMapper; } @@ -251,8 +258,11 @@ private void setupCustomerRole() throws JsonProcessingException { .locationBpna(mySelf.getSites().first().getAddresses().first().getBpna()) .locationBpns(mySelf.getSites().first().getBpns()) .measurementUnit(ItemUnitEnumeration.UNIT_PIECE) - .quantity(20) + .quantity(500) .partner(supplierPartner) + .customerOrderId("CNbr-1") + .customerOrderPositionId("C-Pos-1") + .supplierOrderId("SNbr-1") .build(); var createdMaterialItemStock = materialItemStockService.create(materialItemStock); log.info("Created MaterialItemStock: \n" + createdMaterialItemStock); @@ -278,6 +288,19 @@ private void setupSupplierRole() { Material semiconductorMaterial = getNewSemiconductorMaterialForSupplier(); Partner mySelf = partnerService.getOwnPartnerEntity(); + Site secondSite = new Site( + supplierSiteLaBpns, + "Semiconductor Supplier Inc. Secondary Site", + "BPNA2222222222AA", + "Sunset Blvd. 345", + "90001 Los Angeles", + "USA" + ); + + mySelf.getSites().add(secondSite); + mySelf = partnerService.update(mySelf); + log.info(String.format("Added Site to mySelf Partner: %s", mySelf)); + semiconductorMaterial = materialService.create(semiconductorMaterial); log.info(String.format("Created product: %s", semiconductorMaterial)); @@ -297,20 +320,40 @@ private void setupSupplierRole() { List customerPartners = mprService.findAllCustomersForOwnMaterialNumber(semiconductorMaterial.getOwnMaterialNumber()); log.info(String.format("Found customer partners for semiconductor: %s", customerPartners)); - + Site siteNy = mySelf.getSites().stream().filter(site -> site.getBpns().equals("BPNS1234567890ZZ")).findFirst().get(); + Site siteLa = mySelf.getSites().stream().filter(site -> site.getBpns().equals("BPNS2222222222SS")).findFirst().get(); var productItemStock = ProductItemStock.builder() - .locationBpna(mySelf.getSites().first().getAddresses().first().getBpna()) - .locationBpns(mySelf.getSites().first().getBpns()) + .locationBpna(siteNy.getAddresses().stream().findFirst().get().getBpna()) + .locationBpns(siteNy.getBpns()) .measurementUnit(ItemUnitEnumeration.UNIT_PIECE) - .quantity(40) + .quantity(100) .partner(customerPartner) + .isBlocked(true) + .customerOrderId("CNbr-2") + .customerOrderPositionId("C-Pos-2") + .supplierOrderId("SNbr-2") .material(semiconductorMaterial) .lastUpdatedOnDateTime(new Date()) .build(); productItemStock = productItemStockService.create(productItemStock); log.info("Created ProductItemStock \n" + productItemStock); + var productItemStock2 = ProductItemStock.builder() + .locationBpna(siteLa.getAddresses().stream().findFirst().get().getBpna()) + .locationBpns(siteLa.getBpns()) + .measurementUnit(ItemUnitEnumeration.UNIT_PIECE) + .quantity(400) + .partner(customerPartner) + .customerOrderId("CNbr-2") + .customerOrderPositionId("C-Pos-2") + .supplierOrderId("SNbr-2") + .material(semiconductorMaterial) + .lastUpdatedOnDateTime(new Date()) + .build(); + productItemStock2 = productItemStockService.create(productItemStock2); + log.info("Created ProductItemStock 2\n" + productItemStock2); + ReportedProductItemStock reportedProductItemStock = ReportedProductItemStock.builder() .material(semiconductorMaterial) .locationBpns(customerPartner.getSites().first().getBpns()) @@ -332,15 +375,15 @@ private void setupSupplierRole() { */ private Partner createAndGetCustomerPartner() { Partner customerPartnerEntity = new Partner( - "Scenario Customer", + "Control Unit Creator Inc.", "http://customer-control-plane:8184/api/v1/dsp", "BPNL4444444444XX", "BPNS4444444444XX", - "Hauptwerk Musterhausen", + "Control Unit Creator Production Site", "BPNA4444444444AA", - "Musterstraße 35b", - "77777 Musterhausen", - "Germany" + "13th Street 47", + "10011 New York", + "USA" ); customerPartnerEntity = partnerService.create(customerPartnerEntity); log.info(String.format("Created customer partner: %s", customerPartnerEntity)); @@ -357,20 +400,34 @@ private Partner createAndGetCustomerPartner() { */ private Partner createAndGetSupplierPartner() { Partner supplierPartnerEntity = new Partner( - "Scenario Supplier", + "Semiconductor Supplier Inc.", "http://supplier-control-plane:9184/api/v1/dsp", "BPNL1234567890ZZ", - "BPNS1234567890ZZ", - "Konzernzentrale Dudelsdorf", + supplierSiteNyBpns, + "Semiconductor Supplier Inc. Production Site", "BPNA1234567890AA", - "Heinrich-Supplier-Straße 1", - "77785 Dudelsdorf", - "Germany" + "Wall Street 101", + "10001 New York", + "USA" ); supplierPartnerEntity = partnerService.create(supplierPartnerEntity); log.info(String.format("Created supplier partner: %s", supplierPartnerEntity)); supplierPartnerEntity = partnerService.findByUuid(supplierPartnerEntity.getUuid()); log.info(String.format("Found supplier partner: %s", supplierPartnerEntity)); + + Site secondSite = new Site( + supplierSiteLaBpns, + "Semiconductor Supplier Inc. Secondary Site", + "BPNA2222222222AA", + "Sunset Blvd. 345", + "90001 Los Angeles", + "USA" + ); + + supplierPartnerEntity.getSites().add(secondSite); + Partner updatedSupplierPartner = partnerService.update(supplierPartnerEntity); + log.info(String.format("Added Site to mySelf Partner: %s", updatedSupplierPartner)); + return supplierPartnerEntity; } @@ -402,16 +459,18 @@ private Partner createAndGetNonScenarioCustomer() { private Material getNewSemiconductorMaterialForSupplier() { Material material = new Material(); material.setOwnMaterialNumber(semiconductorMatNbrSupplier); + material.setMaterialNumberCx(semiconductorMatNbrCatenaX); material.setProductFlag(true); - material.setName("semiconductor"); + material.setName("Semiconductor"); return material; } private Material getNewSemiconductorMaterialForCustomer() { Material material = new Material(); material.setOwnMaterialNumber(semiconductorMatNbrCustomer); + material.setMaterialNumberCx(semiconductorMatNbrCatenaX); material.setMaterialFlag(true); - material.setName("semiconductor"); + material.setName("Semiconductor"); return material; } @@ -425,7 +484,7 @@ private Material getNewCentralControlUnitMaterial() { Material material = new Material(); material.setOwnMaterialNumber("MNR-4177-S"); material.setProductFlag(true); - material.setName("central control unit"); + material.setName("Central Control Unit"); return material; } diff --git a/backend/src/main/resources/application.properties b/backend/src/main/resources/application.properties index c0644c79..08e88eba 100755 --- a/backend/src/main/resources/application.properties +++ b/backend/src/main/resources/application.properties @@ -36,19 +36,19 @@ spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true own.bpnl=${OWN_BPNL:BPNL4444444444XX} # Own name (self-description) -own.name=${OWN_NAME:Scenario Customer} +own.name=${OWN_NAME:Control Unit Creator Inc.} # Own BPNS (optional: if this is set, then set own.site.name as well) own.bpns=${OWN_BPNS:BPNS4444444444XX} # Name of Site (see above) -own.site.name=${OWN_SITE:Hauptwerk Musterhausen} +own.site.name=${OWN_SITE:Control Unit Creator Production Site} # If a BPNS is set, then this BPNA will be attached to it. # Otherwise, it will be attached immediately to the BPNL (see above) own.bpna=${OWN_BPNA:BPNA4444444444AA} -own.streetandnumber=${OWN_STREETANDNUMBER:Musterstrasse 35b} -own.zipcodeandcity=${OWN_ZIPCODEANDCITY:77777 Musterhausen} -own.country=${OWN_COUNTRY:Germany} +own.streetandnumber=${OWN_STREETANDNUMBER:13th Street 47} +own.zipcodeandcity=${OWN_ZIPCODEANDCITY:10011 New York} +own.country=${OWN_COUNTRY:USA} server.ssl.enabled=false #server.port=8443 diff --git a/backend/src/test/resources/application.properties b/backend/src/test/resources/application.properties index bf13248b..9d78f438 100755 --- a/backend/src/test/resources/application.properties +++ b/backend/src/test/resources/application.properties @@ -38,19 +38,19 @@ spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true own.bpnl=${OWN_BPNL:BPNL4444444444XX} # Own name (self-description) -own.name=${OWN_NAME:Scenario Customer} +own.name=${OWN_NAME:Control Unit Creator Inc.} # Own BPNS (optional: if this is set, then set own.site.name as well) -own.bpns=${OWN_BPNS:BPNS4444444444XY} +own.bpns=${OWN_BPNS:BPNS4444444444XX} # Name of Site (see above) -own.site.name=${OWN_SITE:Hauptwerk Musterhausen} +own.site.name=${OWN_SITE:Control Unit Creator Production Site} # If a BPNS is set, then this BPNA will be attached to it. # Otherwise, it will be attached immediately to the BPNL (see above) -own.bpna=${OWN_BPNA:BPNA4444444444ZZ} -own.streetandnumber=${OWN_STREETANDNUMBER:Musterstrasse 35b} -own.zipcodeandcity=${OWN_ZIPCODEANDCITY:77777 Musterhausen} -own.country=${OWN_COUNTRY:Germany} +own.bpna=${OWN_BPNA:BPNA4444444444AA} +own.streetandnumber=${OWN_STREETANDNUMBER:13th Street 47} +own.zipcodeandcity=${OWN_ZIPCODEANDCITY:10011 New York} +own.country=${OWN_COUNTRY:USA} # run with: # ./mvnw spring-boot:run -Dspring-boot.run.arguments=--spring.config.location="./src/main/resources/application.properties" diff --git a/local/postman/Local Dev.postman_environment.json b/local/postman/Local Dev.postman_environment.json new file mode 100644 index 00000000..70958d07 --- /dev/null +++ b/local/postman/Local Dev.postman_environment.json @@ -0,0 +1,129 @@ +{ + "id": "c99bfe48-fce6-47f2-8f4b-98a64f9dbecc", + "name": "Local Dev", + "values": [ + { + "key": "CUSTOMER_PURIS_BACKEND_API_KEY", + "value": "", + "type": "default", + "enabled": true + }, + { + "key": "CUSTOMER_EDC_API_KEY", + "value": "", + "type": "default", + "enabled": true + }, + { + "key": "SUPPLIER_PURIS_BACKEND_API_KEY", + "value": "", + "type": "default", + "enabled": true + }, + { + "key": "SUPPLIER_EDC_API_KEY", + "value": "", + "type": "default", + "enabled": true + }, + { + "key": "CUSTOMER_EDC", + "value": "http://localhost:8181", + "type": "default", + "enabled": true + }, + { + "key": "PROTOCOL_PATH", + "value": "api/v1/dsp", + "type": "default", + "enabled": true + }, + { + "key": "MANAGEMENT_PATH", + "value": "management", + "type": "default", + "enabled": true + }, + { + "key": "SUPPLIER_EDC", + "value": "http://localhost:9181", + "type": "default", + "enabled": true + }, + { + "key": "SUPPLIER_BPNL", + "value": "BPNL1234567890ZZ", + "type": "default", + "enabled": true + }, + { + "key": "CUSTOMER_BPNL", + "value": "BPNL4444444444XX", + "type": "default", + "enabled": true + }, + { + "key": "CUSTOMER_EDC_EXT_HOSTNAME", + "value": "http://customer-control-plane:8184", + "type": "default", + "enabled": true + }, + { + "key": "CUSTOMER_PURIS_BACKEND", + "value": "http://localhost:8081", + "type": "default", + "enabled": true + }, + { + "key": "CUSTOMER_BPNS", + "value": "BPNS4444444444XX", + "type": "default", + "enabled": true + }, + { + "key": "CUSTOMER_BPNA", + "value": "BPNA4444444444AA", + "type": "default", + "enabled": true + }, + { + "key": "SUPPLIER_EDC_EXT_HOSTNAME", + "value": "http://supplier-control-plane:9184", + "type": "default", + "enabled": true + }, + { + "key": "SUPPLIER_PURIS_BACKEND", + "value": "http://localhost:8082", + "type": "default", + "enabled": true + }, + { + "key": "SUPPLIER_BPNS", + "value": "BPNS1234567890ZZ", + "type": "default", + "enabled": true + }, + { + "key": "SUPPLIER_BPNA", + "value": "BPNA1234567890AA", + "type": "default", + "enabled": true + }, + { + "key": "SUPPLIER_BPNS2", + "value": "BPNS2222222222SS", + "type": "default", + "enabled": true + }, + { + "key": "SUPPLIER_BPNA2", + "value": "BPNA2222222222AA", + "type": "default", + "enabled": true + } + ], + "_postman_variable_scope": "environment", + "_postman_exported_at": "2024-01-18T16:38:08.553Z", + "_postman_exported_using": "Postman/10.21.14" +} diff --git a/local/postman/README.md b/local/postman/README.md new file mode 100644 index 00000000..b722b1a7 --- /dev/null +++ b/local/postman/README.md @@ -0,0 +1,122 @@ +# Running Integration Tests + +The collection has two folders: +1. One folder to create a test setup and test most of the master data interfaces +2. One folder to test the created assets via catalog requests. + +It creates a setup of a partner and customer that refer to the same material from the other perspective: +- The customer has the material and a material stock +- The supplier has the product and a product stock +- Both partners know each other and each other's EDC +- The setup is ready to trigger the update from customer to supplier + +## Test Data + +The following lists give an overview about the test data in use. When setting up the data, please consider that the +relevant information is the following: +- Material Numbers (Customer, Supplier, Catena-X) +- Partner and Site information (BPNL, BPNS, BPNA) +Note: BPN information depends highly on your environment. + +Items (Material or Product) involved: +- Semiconductor + - Name: Semiconductor + - Material Number Customer: MNR-7307-AU340474.002 + - Material Number Supplier: MNR-8101-ID146955.001 + - Material Number Catena-X: 860fb504-b884-4009-9313-c6fb6cdc776b +- Control Unit + - Name: Central Control Unit + - Material Number Customer: MNR-4177-C + - Material Number Supplier: MNR-4177-S + - Material Number Catena-X: none + +### Customer +Overall the customer has the following information: +- BPNL: BPNL4444444444XX +- Name: Control Unit Creator Inc. +- Site + - BPNS: BPNS4444444444XX + - Site Name: Control Unit Creator Production Site + - Site Address: + - BPNA: BPNA4444444444AA + - Street and Number: 13th Street 47 + - Zip Code, City: 10011 New York + - Country: USA +- Materials available: Semiconductor +- Products available: Control Unit + - Material Stock 1: + - Partner: Semiconductor Supplier (BPNL1234567890ZZ) + - Material: Semiconductor + - Quantity: 500 pieces + - Blocked: true + - Location BPNS: BPNS4444444444XX + - Location BPNA: BPNA4444444444AA + - Order Position Reference: + - Customer Order Number: CNbr-1 + - Customer Order Position Number: C-Pos-1 + - Supplier Order Number: SNbr-1 + +### Supplier +Overall the supplier has the following information: +- BPNL: BPNL1234567890ZZ +- Name: Semiconductor Supplier Inc. +- Site 1 + - BPNS: BPNS1234567890ZZ + - Site Name: Semiconductor Supplier Inc. Production Site + - Site Address: + - BPNA: BPNA1234567890AA + - Street and Number: Wall Street 101 + - Zip Code, City: 10001 New York + - Country: USA +- Site 2 + - BPNS: BPNS2222222222SS + - Site Name: Semiconductor Supplier Inc. Secondary Site + - Site Address: + - BPNA: BPNA2222222222AA + - Street and Number: Sunset Blvd. 345 + - Zip Code, City: 90001 Los Angeles + - Country: USA +- Materials available: none +- Products available: Semiconductor +- Stocks + - Product Stock 1: + - Partner: Control Unit Creator Inc. (BPNL4444444444XX) + - Material: Semiconductor + - Quantity: 100 pieces + - Blocked: true + - Location BPNS: BPNS1234567890ZZ + - Location BPNA: BPNA1234567890AA + - Order Position Reference: + - Customer Order Number: CNbr-2 + - Customer Order Position Number: C-Pos-2 + - Supplier Order Number: SNbr-2 + - Product Stock 2: + - Partner: Control Unit Creator Inc. (BPNL4444444444XX) + - Material: Semiconductor + - Quantity: 400 pieces + - Blocked: false + - Order Position Reference: + - Customer Order Number: CNbr-2 + - Customer Order Position Number: C-Pos-2 + - Supplier Order Number: SNbr-2 + +## Preparations + +To run integration tests import the collection and the environment file to postman. +The environment files has empty fields for the respective key information. The keys are set via environment variables +on folder level. + +One can use the local deployment to run the integration test locally. Follow the instructions in the +[INSTALL.md](../INSTALL.md) until the keys are generated. +- The api keys needed by the environment can be copied from the [environment file](../.env) that is generated by the + [generate-keys.sh](../generate-keys.sh) script. +- Adjust the properties file to run without `puris.demonstrator.role`. Find the properties files for the puris backend +of the [customer](../tractus-x-edc/config/customer/puris-backend.properties) and of the [supplier](../tractus-x-edc/config/supplier/puris-backend.properties) to set the property +`puris.demonstrator.role` to empty value. + +Same settings should be used for other environments. But you also need to update other variables accordingly in the +environment file. + +## Run the integration test + +You can run the integration tests on per folder level using right click > run folder. diff --git a/local/postman/puris-integration-test.postman_collection.json b/local/postman/puris-integration-test.postman_collection.json new file mode 100644 index 00000000..f43c7541 --- /dev/null +++ b/local/postman/puris-integration-test.postman_collection.json @@ -0,0 +1,1476 @@ +{ + "info": { + "_postman_id": "08da5aef-cb4d-46ea-a2e1-a1d47e73c97a", + "name": "puris-integration-test", + "description": "The collection assumes the following roles:\n\n- Customer PURIS (upper tier)\n \n- Supplier PURIS (lower tier)\n \n\nIt creates the opposite partner and the respective view on the semiconductor material or product.\n\nTo run the tests correctly, take the environment and fill the respective secrets:\n\n- CUSTOMER_EDC_API_KEY\n- CUSTOMER_PURIS_BACKEND_API_KEY\n- SUPPLIER_EDC_API_KEY\n- SUPPLIER_PURIS_BACKEND_API_KEY\n \n\nWhen using the another environment, update / create a new environment.", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "26605468" + }, + "item": [ + { + "name": "Test_01-MAD", + "item": [ + { + "name": "CustomerInit", + "item": [ + { + "name": "Create Semiconductor Material", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"response is ok\", function() {", + " pm.response.to.have.status(200);", + "})" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"materialFlag\": true,\n \"productFlag\": false,\n \"ownMaterialNumber\": \"{{MATERIAL_NUMBER_CUSTOMER}}\",\n \"materialNumberCx\": \"{{MATERIAL_NUMBER_CX}}\",\n \"name\": \"Semiconductor\"\n}" + }, + "url": { + "raw": "{{CUSTOMER_PURIS_BACKEND}}/catena/materials", + "host": [ + "{{CUSTOMER_PURIS_BACKEND}}" + ], + "path": [ + "catena", + "materials" + ] + } + }, + "response": [] + }, + { + "name": "Create Control Unit Product", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"response is ok\", function() {", + " pm.response.to.have.status(200);", + "})" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"materialFlag\": false,\n \"productFlag\": true,\n \"ownMaterialNumber\": \"MNR-4177-S\",\n \"materialNumberCx\": null,\n \"name\": \"Central Control Unit\"\n}" + }, + "url": { + "raw": "{{CUSTOMER_PURIS_BACKEND}}/catena/materials", + "host": [ + "{{CUSTOMER_PURIS_BACKEND}}" + ], + "path": [ + "catena", + "materials" + ] + } + }, + "response": [] + }, + { + "name": "Get All Materials", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"response is ok\", function() {", + " pm.response.to.have.status(200);", + "})", + "", + "pm.test(\"Verify response contains two objects\", function () {", + " pm.expect(pm.response.json()).to.be.an(\"array\").with.lengthOf(2);", + "});", + "", + "pm.test(\"Verify ownMaterialNumber values\", function () {", + " var responseJson = pm.response.json();", + "", + " var foundValues = [];", + " ", + " responseJson.forEach(function (obj) {", + " pm.expect(obj).to.have.property(\"ownMaterialNumber\");", + " pm.expect(obj.ownMaterialNumber).to.be.oneOf([\"MNR-4177-S\", pm.collectionVariables.get(\"MATERIAL_NUMBER_CUSTOMER\")]);", + "", + " // Put found value into foundValues to ensure that each value is only found once", + " pm.expect(foundValues).to.not.include(obj.ownMaterialNumber);", + " foundValues.push(obj.ownMaterialNumber);", + " });", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{CUSTOMER_PURIS_BACKEND}}/catena/materials/all", + "host": [ + "{{CUSTOMER_PURIS_BACKEND}}" + ], + "path": [ + "catena", + "materials", + "all" + ] + } + }, + "response": [] + }, + { + "name": "Register Supplier Partner", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"response is ok\", function() {", + " pm.response.to.have.status(200);", + "})" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"name\": \"Semiconductor Supplier Inc.\",\n \"edcUrl\": \"{{SUPPLIER_EDC_EXT_HOSTNAME}}/{{PROTOCOL_PATH}}\",\n \"bpnl\": \"{{SUPPLIER_BPNL}}\",\n \"addresses\": [],\n \"sites\": [\n {\n \"bpns\": \"{{SUPPLIER_BPNS}}\",\n \"name\": \"Semiconductor Supplier Inc. Headquarter\",\n \"addresses\": [\n {\n \"bpna\": \"{{SUPPLIER_BPNA}}\",\n \"streetAndNumber\": \"Wall Street 101\",\n \"zipCodeAndCity\": \"10001 New York\",\n \"country\": \"USA\"\n }\n ]\n }\n ]\n}" + }, + "url": { + "raw": "{{CUSTOMER_PURIS_BACKEND}}/catena/partners", + "host": [ + "{{CUSTOMER_PURIS_BACKEND}}" + ], + "path": [ + "catena", + "partners" + ] + } + }, + "response": [] + }, + { + "name": "Get Supplier Partner", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"response is ok\", function () {", + " pm.response.to.have.status(200);", + "})", + "", + "pm.test(\"Verify partner values (BPNL with one BPNS with one BPNA)\", function () {", + " var responseJson = pm.response.json();", + "", + " pm.expect(responseJson).to.have.property(\"bpnl\");", + " pm.expect(responseJson.bpnl).to.equal(pm.environment.get(\"SUPPLIER_BPNL\"));", + "", + " pm.expect(responseJson.sites).to.be.an(\"array\").with.lengthOf(1);", + "", + " var site = responseJson.sites[0];", + " pm.expect(site).to.have.property(\"bpns\", pm.environment.get(\"SUPPLIER_BPNS\"));", + "", + " pm.expect(site.addresses).to.be.an(\"array\").with.lengthOf(1);", + "", + " var address = site.addresses[0];", + " pm.expect(address).to.have.property(\"bpna\", pm.environment.get(\"SUPPLIER_BPNA\"));", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{CUSTOMER_PURIS_BACKEND}}/catena/partners?partnerBpnl={{SUPPLIER_BPNL}}", + "host": [ + "{{CUSTOMER_PURIS_BACKEND}}" + ], + "path": [ + "catena", + "partners" + ], + "query": [ + { + "key": "partnerBpnl", + "value": "{{SUPPLIER_BPNL}}" + } + ] + } + }, + "response": [] + }, + { + "name": "Add New Site to Supplier Partner", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"response is ok\", function() {", + " pm.response.to.have.status(200);", + "})", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\"bpns\": \"{{SUPPLIER_BPNS2}}\",\n\"name\": \"Semiconductor Supplier Inc. Secondary Site\",\n\"addresses\": [\n {\n \"bpna\": \"{{SUPPLIER_BPNA2}}\",\n \"streetAndNumber\": \"Sunset Blvd. 345\",\n \"zipCodeAndCity\": \"90001 Los Angeles\",\n \"country\": \"USA\"\n }\n]\n}" + }, + "url": { + "raw": "{{CUSTOMER_PURIS_BACKEND}}/catena/partners/putSite?partnerBpnl={{SUPPLIER_BPNL}}", + "host": [ + "{{CUSTOMER_PURIS_BACKEND}}" + ], + "path": [ + "catena", + "partners", + "putSite" + ], + "query": [ + { + "key": "partnerBpnl", + "value": "{{SUPPLIER_BPNL}}" + } + ] + } + }, + "response": [] + }, + { + "name": "Get All Partners", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"response is ok\", function() {", + " pm.response.to.have.status(200);", + "})", + "", + "pm.test(\"Verify response contains two objects (puris owner, supplier partner)\", function () {", + " pm.expect(pm.response.json()).to.be.an(\"array\").with.lengthOf(2);", + "});", + "", + "pm.test(\"Verify supplier partner values (BPNL with one BPNS with one BPNA)\", function () {", + " const responseJson = pm.response.json();", + "", + " var supplierPartners = responseJson.filter(function (partner) {", + " return partner.bpnl === pm.environment.get(\"SUPPLIER_BPNL\");", + " });", + "", + " const supplierPartner = supplierPartners[0];", + " pm.expect(supplierPartner).to.have.property(\"bpnl\");", + "", + " pm.expect(supplierPartner.bpnl).to.equal(pm.environment.get(\"SUPPLIER_BPNL\"));", + "", + " pm.expect(supplierPartner.sites).to.be.an(\"array\").with.lengthOf(2);", + "", + " // check only the newly added site as the other one has been checked earlier", + " var sites = supplierPartner.sites.filter(function (site) {", + " return site.bpns === pm.environment.get(\"SUPPLIER_BPNS2\");", + " });", + "", + " const site = sites[0];", + " pm.expect(site.addresses).to.be.an(\"array\").with.lengthOf(1);", + "", + " var address = site.addresses[0];", + " pm.expect(address).to.have.property(\"bpna\", pm.environment.get(\"SUPPLIER_BPNA2\"));", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{CUSTOMER_PURIS_BACKEND}}/catena/partners/all", + "host": [ + "{{CUSTOMER_PURIS_BACKEND}}" + ], + "path": [ + "catena", + "partners", + "all" + ] + } + }, + "response": [] + }, + { + "name": "Create Material Partner Relation", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"response is ok\", function() {", + " pm.response.to.have.status(200);", + "})" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "url": { + "raw": "{{CUSTOMER_PURIS_BACKEND}}/catena/materialpartnerrelations?partnerBpnl={{SUPPLIER_BPNL}}&ownMaterialNumber={{MATERIAL_NUMBER_CUSTOMER}}&partnerMaterialNumber={{MATERIAL_NUMBER_SUPPLIER}}&partnerSupplies=true&partnerBuys=false", + "host": [ + "{{CUSTOMER_PURIS_BACKEND}}" + ], + "path": [ + "catena", + "materialpartnerrelations" + ], + "query": [ + { + "key": "partnerBpnl", + "value": "{{SUPPLIER_BPNL}}" + }, + { + "key": "ownMaterialNumber", + "value": "{{MATERIAL_NUMBER_CUSTOMER}}" + }, + { + "key": "partnerMaterialNumber", + "value": "{{MATERIAL_NUMBER_SUPPLIER}}" + }, + { + "key": "partnerSupplies", + "value": "true" + }, + { + "key": "partnerBuys", + "value": "false" + } + ] + } + }, + "response": [] + }, + { + "name": "Get Material Partner Mappings", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"response is ok\", function() {", + " pm.response.to.have.status(200);", + "})", + "", + "pm.test(\"Verify material partner mapping\", function () {", + " pm.response.to.have.jsonBody(pm.environment.get(\"SUPPLIER_BPNL\"), pm.collectionVariables.get(\"MATERIAL_NUMBER_SUPPLIER\"))", + " .and.have.jsonBody(pm.environment.get(\"CUSTOMER_BPNL\"), pm.collectionVariables.get(\"MATERIAL_NUMBER_CUSTOMER\"));", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{CUSTOMER_PURIS_BACKEND}}/catena/stockView/materialnumbers-mapping?ownMaterialNumber={{MATERIAL_NUMBER_CUSTOMER}}", + "host": [ + "{{CUSTOMER_PURIS_BACKEND}}" + ], + "path": [ + "catena", + "stockView", + "materialnumbers-mapping" + ], + "query": [ + { + "key": "ownMaterialNumber", + "value": "{{MATERIAL_NUMBER_CUSTOMER}}" + } + ] + } + }, + "response": [] + }, + { + "name": "Get Own Sites", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"response is ok\", function() {", + " pm.response.to.have.status(200);", + "})", + "", + "pm.test(\"Verify own site values (one BPNS with one BPNA)\", function () {", + " const responseJson = pm.response.json();", + "", + " const sites = responseJson.filter(function (site) {", + " return site.bpns === pm.environment.get(\"CUSTOMER_BPNS\");", + " });", + "", + " const site = sites[0];", + " pm.expect(site.addresses).to.be.an(\"array\").with.lengthOf(1);", + "", + " const address = site.addresses[0];", + " pm.expect(address).to.have.property(\"bpna\", pm.environment.get(\"CUSTOMER_BPNA\"));", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{CUSTOMER_PURIS_BACKEND}}/catena/partners/ownSites", + "host": [ + "{{CUSTOMER_PURIS_BACKEND}}" + ], + "path": [ + "catena", + "partners", + "ownSites" + ] + } + }, + "response": [] + }, + { + "name": "Create Semiconductor Material Stock Customer", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"response is ok\", function() {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Verify stock composition (material number with BPNS, BPNA and Partner BPNL)\", function () {", + " var responseJson = pm.response.json();", + "", + " pm.expect(responseJson).to.have.property(\"material\");", + " pm.expect(responseJson.material).to.have.property(\"materialNumberCustomer\");", + " pm.expect(responseJson.material.materialNumberCustomer).to.equal(pm.collectionVariables.get(\"MATERIAL_NUMBER_CUSTOMER\"));", + "", + " pm.expect(responseJson).to.have.property(\"stockLocationBpns\");", + " pm.expect(responseJson.stockLocationBpns).to.equal(pm.environment.get(\"CUSTOMER_BPNS\"));", + "", + " pm.expect(responseJson).to.have.property(\"stockLocationBpna\");", + " pm.expect(responseJson.stockLocationBpna).to.equal(pm.environment.get(\"CUSTOMER_BPNA\"));", + "", + " pm.expect(responseJson).to.have.property(\"partner\");", + " pm.expect(responseJson.partner).to.have.property(\"bpnl\");", + " pm.expect(responseJson.partner.bpnl).to.equal(pm.environment.get(\"SUPPLIER_BPNL\"));", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"material\": {\n \"materialFlag\": true,\n \"productFlag\": false,\n \"materialNumberCustomer\": \"{{MATERIAL_NUMBER_CUSTOMER}}\",\n \"materialNumberCx\": \"{{MATERIAL_NUMBER_CX}}\",\n \"name\": \"Semiconductor\"\n },\n \"quantity\": 500.0,\n \"measurementUnit\": \"unit:piece\",\n \"stockLocationBpns\": \"{{CUSTOMER_BPNS}}\",\n \"stockLocationBpna\": \"{{CUSTOMER_BPNA}}\",\n \"type\": \"MATERIAL\",\n \"lastUpdatedOn\": \"2023-12-18T13:12:48.466+00:00\",\n \"isBlocked\": true,\n \"customerOrderNumber\": \"CNbr-1\",\n \"customerOrderPositionNumber\": \"C-Pos-1\",\n \"supplierOrderNumber\": \"SNbr-1\",\n \"partner\":{\n \"bpnl\": \"{{SUPPLIER_BPNL}}\"\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{CUSTOMER_PURIS_BACKEND}}/catena/stockView/material-stocks", + "host": [ + "{{CUSTOMER_PURIS_BACKEND}}" + ], + "path": [ + "catena", + "stockView", + "material-stocks" + ] + } + }, + "response": [] + }, + { + "name": "Get Semiconductor Material Stock Customer", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"response is ok\", function() {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Verify response contains one stock\", function () {", + " pm.expect(pm.response.json()).to.be.an(\"array\").with.lengthOf(1);", + "});" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"material\": {\n \"materialFlag\": true,\n \"productFlag\": false,\n \"materialNumberCustomer\": \"{{MATERIAL_NUMBER_CUSTOMER}}\",\n \"materialNumberCx\": \"{{MATERIAL_NUMBER_CX}}\",\n \"name\": \"Semiconductor\"\n },\n \"quantity\": 5.0,\n \"measurementUnit\": \"unit:piece\",\n \"stockLocationBpns\": \"{{CUSTOMER_BPNS}}\",\n \"stockLocationBpna\": \"{{CUSTOMER_BPNA}}\",\n \"type\": \"MATERIAL\",\n \"lastUpdatedOn\": \"2023-12-18T13:12:48.466+00:00\",\n \"isBlocked\": true,\n \"customerOrderNumber\": \"\",\n \"customerOrderPositionNumber\": \"\",\n \"supplierOrderNumber\": \"\",\n \"partner\":{\n \"bpnl\": \"{{SUPPLIER_BPNL}}\"\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{CUSTOMER_PURIS_BACKEND}}/catena/stockView/material-stocks", + "host": [ + "{{CUSTOMER_PURIS_BACKEND}}" + ], + "path": [ + "catena", + "stockView", + "material-stocks" + ] + } + }, + "response": [] + } + ], + "auth": { + "type": "apikey", + "apikey": [ + { + "key": "value", + "value": "{{CUSTOMER_PURIS_BACKEND_API_KEY}}", + "type": "string" + }, + { + "key": "key", + "value": "X-API-KEY", + "type": "string" + } + ] + }, + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ] + }, + { + "name": "SupplierInit", + "item": [ + { + "name": "Add New Site to Supplier Partner (MySelf)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"response is ok\", function() {", + " pm.response.to.have.status(200);", + "})", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\"bpns\": \"{{SUPPLIER_BPNS2}}\",\n\"name\": \"Semiconductor Supplier Inc. Secondary Site\",\n\"addresses\": [\n {\n \"bpna\": \"{{SUPPLIER_BPNA2}}\",\n \"streetAndNumber\": \"Sunset Blvd. 345\",\n \"zipCodeAndCity\": \"90001 Los Angeles\",\n \"country\": \"USA\"\n }\n]\n}" + }, + "url": { + "raw": "{{SUPPLIER_PURIS_BACKEND}}/catena/partners/putSite?partnerBpnl={{SUPPLIER_BPNL}}", + "host": [ + "{{SUPPLIER_PURIS_BACKEND}}" + ], + "path": [ + "catena", + "partners", + "putSite" + ], + "query": [ + { + "key": "partnerBpnl", + "value": "{{SUPPLIER_BPNL}}" + } + ] + } + }, + "response": [] + }, + { + "name": "Create Semiconductor Product", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"response is ok\", function() {", + " pm.response.to.have.status(200);", + "})" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"materialFlag\": false,\n \"productFlag\": true,\n \"ownMaterialNumber\": \"{{MATERIAL_NUMBER_SUPPLIER}}\",\n \"materialNumberCx\": \"{{MATERIAL_NUMBER_CX}}\",\n \"name\": \"Semiconductor\"\n}" + }, + "url": { + "raw": "{{SUPPLIER_PURIS_BACKEND}}/catena/materials", + "host": [ + "{{SUPPLIER_PURIS_BACKEND}}" + ], + "path": [ + "catena", + "materials" + ] + } + }, + "response": [] + }, + { + "name": "Get All Materials", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"response is ok\", function() {", + " pm.response.to.have.status(200);", + "})", + "", + "pm.test(\"Verify response contains one material objects\", function () {", + " pm.expect(pm.response.json()).to.be.an(\"array\").with.lengthOf(1);", + "});", + "", + "pm.test(\"Verify ownMaterialNumber values\", function () {", + " const material = pm.response.json()[0];", + "", + " pm.expect(material).to.have.property(\"ownMaterialNumber\");", + " pm.expect(material.ownMaterialNumber).to.equal(pm.collectionVariables.get(\"MATERIAL_NUMBER_SUPPLIER\"));", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{SUPPLIER_PURIS_BACKEND}}/catena/materials/all", + "host": [ + "{{SUPPLIER_PURIS_BACKEND}}" + ], + "path": [ + "catena", + "materials", + "all" + ] + } + }, + "response": [] + }, + { + "name": "Register Customer Partner", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"response is ok\", function() {", + " pm.response.to.have.status(200);", + "})" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"name\": \"Control Unit Creator Inc.\",\n \"edcUrl\": \"{{CUSTOMER_EDC_EXT_HOSTNAME}}/{{PROTOCOL_PATH}}\",\n \"bpnl\": \"{{CUSTOMER_BPNL}}\",\n \"addresses\": [],\n \"sites\": [\n {\n \"bpns\": \"{{CUSTOMER_BPNS}}\",\n \"name\": \"Control Unit Creator Headquarter\",\n \"addresses\": [\n {\n \"bpna\": \"{{CUSTOMER_BPNA}}\",\n \"streetAndNumber\": \"13th Street 47\",\n \"zipCodeAndCity\": \"10011 New York\",\n \"country\": \"USA\"\n }\n ]\n }\n ]\n}" + }, + "url": { + "raw": "{{SUPPLIER_PURIS_BACKEND}}/catena/partners", + "host": [ + "{{SUPPLIER_PURIS_BACKEND}}" + ], + "path": [ + "catena", + "partners" + ] + } + }, + "response": [] + }, + { + "name": "Get Customer Partner", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"response is ok\", function () {", + " pm.response.to.have.status(200);", + "})", + "", + "pm.test(\"Verify partner values (BPNL with one BPNS with one BPNA)\", function () {", + " var responseJson = pm.response.json();", + "", + " pm.expect(responseJson).to.have.property(\"bpnl\");", + " pm.expect(responseJson.bpnl).to.equal(pm.environment.get(\"CUSTOMER_BPNL\"));", + "", + " pm.expect(responseJson.sites).to.be.an(\"array\").with.lengthOf(1);", + "", + " var site = responseJson.sites[0];", + " pm.expect(site).to.have.property(\"bpns\", pm.environment.get(\"CUSTOMER_BPNS\"));", + "", + " pm.expect(site.addresses).to.be.an(\"array\").with.lengthOf(1);", + "", + " var address = site.addresses[0];", + " pm.expect(address).to.have.property(\"bpna\", pm.environment.get(\"CUSTOMER_BPNA\"));", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{SUPPLIER_PURIS_BACKEND}}/catena/partners?partnerBpnl={{CUSTOMER_BPNL}}", + "host": [ + "{{SUPPLIER_PURIS_BACKEND}}" + ], + "path": [ + "catena", + "partners" + ], + "query": [ + { + "key": "partnerBpnl", + "value": "{{CUSTOMER_BPNL}}" + } + ] + } + }, + "response": [] + }, + { + "name": "Create Material Partner Relation", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"response is ok\", function() {", + " pm.response.to.have.status(200);", + "})" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "url": { + "raw": "{{SUPPLIER_PURIS_BACKEND}}/catena/materialpartnerrelations?partnerBpnl={{CUSTOMER_BPNL}}&ownMaterialNumber={{MATERIAL_NUMBER_SUPPLIER}}&partnerMaterialNumber={{MATERIAL_NUMBER_CUSTOMER}}&partnerSupplies=false&partnerBuys=true", + "host": [ + "{{SUPPLIER_PURIS_BACKEND}}" + ], + "path": [ + "catena", + "materialpartnerrelations" + ], + "query": [ + { + "key": "partnerBpnl", + "value": "{{CUSTOMER_BPNL}}" + }, + { + "key": "ownMaterialNumber", + "value": "{{MATERIAL_NUMBER_SUPPLIER}}" + }, + { + "key": "partnerMaterialNumber", + "value": "{{MATERIAL_NUMBER_CUSTOMER}}" + }, + { + "key": "partnerSupplies", + "value": "false" + }, + { + "key": "partnerBuys", + "value": "true" + } + ] + } + }, + "response": [] + }, + { + "name": "Get Material Partner Mappings", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"response is ok\", function() {", + " pm.response.to.have.status(200);", + "})", + "", + "pm.test(\"Verify material partner mapping\", function () {", + " pm.response.to.have.jsonBody(pm.environment.get(\"SUPPLIER_BPNL\"), pm.collectionVariables.get(\"MATERIAL_NUMBER_SUPPLIER\"))", + " .and.have.jsonBody(pm.environment.get(\"CUSTOMER_BPNL\"), pm.collectionVariables.get(\"MATERIAL_NUMBER_CUSTOMER\"));", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{SUPPLIER_PURIS_BACKEND}}/catena/stockView/materialnumbers-mapping?ownMaterialNumber={{MATERIAL_NUMBER_SUPPLIER}}", + "host": [ + "{{SUPPLIER_PURIS_BACKEND}}" + ], + "path": [ + "catena", + "stockView", + "materialnumbers-mapping" + ], + "query": [ + { + "key": "ownMaterialNumber", + "value": "{{MATERIAL_NUMBER_SUPPLIER}}" + } + ] + } + }, + "response": [] + }, + { + "name": "Get Own Sites", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"response is ok\", function() {", + " pm.response.to.have.status(200);", + "})", + "", + "pm.test(\"Verify own site values (one BPNS with one BPNA)\", function () {", + " const responseJson = pm.response.json();", + "", + " const sites = responseJson.filter(function (site) {", + " return site.bpns === pm.environment.get(\"SUPPLIER_BPNS\");", + " });", + "", + " const site = sites[0];", + " pm.expect(site.addresses).to.be.an(\"array\").with.lengthOf(1);", + "", + " const address = site.addresses[0];", + " pm.expect(address).to.have.property(\"bpna\", pm.environment.get(\"SUPPLIER_BPNA\"));", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{SUPPLIER_PURIS_BACKEND}}/catena/partners/ownSites", + "host": [ + "{{SUPPLIER_PURIS_BACKEND}}" + ], + "path": [ + "catena", + "partners", + "ownSites" + ] + } + }, + "response": [] + }, + { + "name": "Create Semiconductor Product Stock Supplier", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"response is ok\", function() {", + " pm.response.to.have.status(200);", + "})" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"material\": {\n \"materialFlag\": false,\n \"productFlag\": true,\n \"materialNumberCustomer\": \"{{MATERIAL_NUMBER_CUSTOMER}}\",\n \"materialNumberSupplier\": \"{{MATERIAL_NUMBER_SUPPLIER}}\",\n \"materialNumberCx\": \"{{MATERIAL_NUMBER_CX}}\",\n \"name\": \"Semiconductor\"\n },\n \"quantity\": 100.0,\n \"measurementUnit\": \"unit:piece\",\n \"stockLocationBpns\": \"{{SUPPLIER_BPNS}}\",\n \"stockLocationBpna\": \"{{SUPPLIER_BPNA}}\",\n \"type\": \"PRODUCT\",\n \"lastUpdatedOn\": \"2023-12-18T14:12:48.466+00:00\",\n \"isBlocked\": true,\n \"customerOrderNumber\": \"CNbr-2\",\n \"customerOrderPositionNumber\": \"C-Pos-2\",\n \"supplierOrderNumber\": \"SNbr-2\",\n \"partner\":{\n \"bpnl\": \"{{CUSTOMER_BPNL}}\"\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{SUPPLIER_PURIS_BACKEND}}/catena/stockView/product-stocks", + "host": [ + "{{SUPPLIER_PURIS_BACKEND}}" + ], + "path": [ + "catena", + "stockView", + "product-stocks" + ] + } + }, + "response": [] + }, + { + "name": "Create Semiconductor Product Stock 2 Supplier", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"response is ok\", function() {", + " pm.response.to.have.status(200);", + "})" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"material\": {\n \"materialFlag\": false,\n \"productFlag\": true,\n \"materialNumberCustomer\": \"{{MATERIAL_NUMBER_CUSTOMER}}\",\n \"materialNumberSupplier\": \"{{MATERIAL_NUMBER_SUPPLIER}}\",\n \"materialNumberCx\": \"{{MATERIAL_NUMBER_CX}}\",\n \"name\": \"Semiconductor\"\n },\n \"quantity\": 400.0,\n \"measurementUnit\": \"unit:piece\",\n \"stockLocationBpns\": \"{{SUPPLIER_BPNS2}}\",\n \"stockLocationBpna\": \"{{SUPPLIER_BPNA2}}\",\n \"type\": \"PRODUCT\",\n \"lastUpdatedOn\": \"2023-12-18T14:12:48.466+00:00\",\n \"isBlocked\": false,\n \"customerOrderNumber\": \"CNbr-2\",\n \"customerOrderPositionNumber\": \"C-Pos-2\",\n \"supplierOrderNumber\": \"SNbr-2\",\n \"partner\":{\n \"bpnl\": \"{{CUSTOMER_BPNL}}\"\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{SUPPLIER_PURIS_BACKEND}}/catena/stockView/product-stocks", + "host": [ + "{{SUPPLIER_PURIS_BACKEND}}" + ], + "path": [ + "catena", + "stockView", + "product-stocks" + ] + } + }, + "response": [] + }, + { + "name": "Get Semiconductor Product Stocks (Supplier)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"response is ok\", function() {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Verify response contains two product stock objects\", function () {", + " pm.expect(pm.response.json()).to.be.an(\"array\").with.lengthOf(2);", + "});", + "", + "pm.test(\"Verify stock composition NY (material number with BPNS, BPNA and Partner BPNL)\", function () {", + "", + " var responseJson = pm.response.json();", + "", + " const stockNy = responseJson.filter(function (stock) {", + " return stock.stockLocationBpns === pm.environment.get(\"SUPPLIER_BPNS\");", + " })[0];", + "", + " pm.expect(stockNy).to.have.property(\"material\");", + " pm.expect(stockNy.material).to.have.property(\"materialNumberCustomer\");", + " pm.expect(stockNy.material.materialNumberSupplier).to.equal(pm.collectionVariables.get(\"MATERIAL_NUMBER_SUPPLIER\"));", + "", + " pm.expect(stockNy).to.have.property(\"stockLocationBpns\");", + " pm.expect(stockNy.stockLocationBpns).to.equal(pm.environment.get(\"SUPPLIER_BPNS\"));", + "", + " pm.expect(stockNy).to.have.property(\"stockLocationBpna\");", + " pm.expect(stockNy.stockLocationBpna).to.equal(pm.environment.get(\"SUPPLIER_BPNA\"));", + "", + " pm.expect(stockNy).to.have.property(\"partner\");", + " pm.expect(stockNy.partner).to.have.property(\"bpnl\");", + " pm.expect(stockNy.partner.bpnl).to.equal(pm.environment.get(\"CUSTOMER_BPNL\"));", + "});", + "", + "pm.test(\"Verify stock composition LA (material number with BPNS, BPNA and Partner BPNL)\", function () {", + "", + " var responseJson = pm.response.json();", + "", + " const stockLa = responseJson.filter(function (stock) {", + " return stock.stockLocationBpns === pm.environment.get(\"SUPPLIER_BPNS2\");", + " })[0];", + "", + " console.log(stockLa);", + "", + " pm.expect(stockLa).to.have.property(\"material\");", + " pm.expect(stockLa.material).to.have.property(\"materialNumberCustomer\");", + " pm.expect(stockLa.material.materialNumberSupplier).to.equal(pm.collectionVariables.get(\"MATERIAL_NUMBER_SUPPLIER\"));", + "", + " pm.expect(stockLa).to.have.property(\"stockLocationBpns\");", + " pm.expect(stockLa.stockLocationBpns).to.equal(pm.environment.get(\"SUPPLIER_BPNS2\"));", + "", + " pm.expect(stockLa).to.have.property(\"stockLocationBpna\");", + " pm.expect(stockLa.stockLocationBpna).to.equal(pm.environment.get(\"SUPPLIER_BPNA2\"));", + "", + " pm.expect(stockLa).to.have.property(\"partner\");", + " pm.expect(stockLa.partner).to.have.property(\"bpnl\");", + " pm.expect(stockLa.partner.bpnl).to.equal(pm.environment.get(\"CUSTOMER_BPNL\"));", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "", + "value": "", + "type": "text" + } + ], + "url": { + "raw": "{{SUPPLIER_PURIS_BACKEND}}/catena/stockView/product-stocks", + "host": [ + "{{SUPPLIER_PURIS_BACKEND}}" + ], + "path": [ + "catena", + "stockView", + "product-stocks" + ] + } + }, + "response": [] + } + ], + "auth": { + "type": "apikey", + "apikey": [ + { + "key": "value", + "value": "{{SUPPLIER_PURIS_BACKEND_API_KEY}}", + "type": "string" + }, + { + "key": "key", + "value": "X-API-KEY", + "type": "string" + } + ] + }, + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ] + } + ] + }, + { + "name": "Test_02-EDC", + "item": [ + { + "name": "Query Catalog for request offer as Customer from Supplier", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"response is ok\", function() {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Verify response contains one data offer\", function () {", + " console.info(pm.response.json());", + " console.info(pm.response.json()['dcat:dataset']);", + " pm.expect(pm.response.json()['dcat:dataset']).to.be.an(\"object\");", + "});", + "", + "pm.test(\"Verify that offer matches search criteria (dct:type, cx-common:version)\", function () {", + " const contractOffer = pm.response.json()['dcat:dataset'];", + "", + " pm.expect(contractOffer).to.exist;", + "", + " pm.expect(contractOffer[\"https://w3id.org/catenax/ontology/common#version\"]).to.equal(\"1.0\");", + " pm.expect(contractOffer[\"dct:type\"][\"@id\"]).to.equal(\"https://w3id.org/catenax/taxonomy#ItemStockRequestApi\"); ", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"@context\": {},\r\n \"@type\": \"CatalogRequest\",\r\n \"protocol\": \"dataspace-protocol-http\",\r\n \"counterPartyAddress\": \"{{CUSTOMER_EDC_EXT_HOSTNAME}}/{{PROTOCOL_PATH}}\",\r\n \"querySpec\": {\r\n \"offset\": 0,\r\n \"limit\": 100,\r\n \"filter\": \"\",\r\n \"range\": {\r\n \"from\": 0,\r\n \"to\": 100\r\n },\r\n \"filterExpression\": [\r\n {\r\n \"@type\" : \"CriterionDto\",\r\n \"operandLeft\": \"asset:prop:type\",\r\n \"operator\": \"=\",\r\n \"operandRight\": \"data.res.itemStockRequestApi\"\r\n },\r\n {\r\n \"@type\" : \"CriterionDto\",\r\n \"operandLeft\": \"https://w3id.org/catenax/ontology/common#version\",\r\n \"operator\": \"=\",\r\n \"operandRight\": \"1.0\"\r\n }\r\n ]\r\n }\r\n}\r\n", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{SUPPLIER_EDC}}/{{MANAGEMENT_PATH}}/v2/catalog/request", + "host": [ + "{{SUPPLIER_EDC}}" + ], + "path": [ + "{{MANAGEMENT_PATH}}", + "v2", + "catalog", + "request" + ] + } + }, + "response": [] + }, + { + "name": "Query Catalog for response offer as Customer from Supplier", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"response is ok\", function() {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Verify response contains one data offer\", function () {", + " console.info(pm.response.json());", + " console.info(pm.response.json()['dcat:dataset']);", + " pm.expect(pm.response.json()['dcat:dataset']).to.be.an(\"object\");", + "});", + "", + "pm.test(\"Verify that offer matches search criteria (dct:type, cx-common:version)\", function () {", + " const contractOffer = pm.response.json()['dcat:dataset'];", + "", + " pm.expect(contractOffer).to.exist;", + "", + " pm.expect(contractOffer[\"https://w3id.org/catenax/ontology/common#version\"]).to.equal(\"1.0\");", + " pm.expect(contractOffer[\"dct:type\"][\"@id\"]).to.equal(\"https://w3id.org/catenax/taxonomy#ItemStockResponseApi\"); ", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"@context\": {},\r\n \"@type\": \"CatalogRequest\",\r\n \"protocol\": \"dataspace-protocol-http\",\r\n \"counterPartyAddress\": \"{{CUSTOMER_EDC_EXT_HOSTNAME}}/{{PROTOCOL_PATH}}\",\r\n \"querySpec\": {\r\n \"offset\": 0,\r\n \"limit\": 100,\r\n \"filter\": \"\",\r\n \"range\": {\r\n \"from\": 0,\r\n \"to\": 100\r\n },\r\n \"filterExpression\": [\r\n {\r\n \"@type\" : \"CriterionDto\",\r\n \"operandLeft\": \"asset:prop:type\",\r\n \"operator\": \"=\",\r\n \"operandRight\": \"data.res.itemStockResponseApi\"\r\n },\r\n {\r\n \"@type\" : \"CriterionDto\",\r\n \"operandLeft\": \"https://w3id.org/catenax/ontology/common#version\",\r\n \"operator\": \"=\",\r\n \"operandRight\": \"1.0\" \r\n }\r\n ]\r\n }\r\n}\r\n", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{SUPPLIER_EDC}}/{{MANAGEMENT_PATH}}/v2/catalog/request", + "host": [ + "{{SUPPLIER_EDC}}" + ], + "path": [ + "{{MANAGEMENT_PATH}}", + "v2", + "catalog", + "request" + ] + } + }, + "response": [] + }, + { + "name": "Query Catalog for request status offer as Customer from Supplier", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"response is ok\", function() {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Verify response contains one data offer\", function () {", + " console.info(pm.response.json());", + " console.info(pm.response.json()['dcat:dataset']);", + " pm.expect(pm.response.json()['dcat:dataset']).to.be.an(\"object\");", + "});", + "", + "pm.test(\"Verify that offer matches search criteria (dct:type, cx-common:version)\", function () {", + " const contractOffer = pm.response.json()['dcat:dataset'];", + "", + " pm.expect(contractOffer).to.exist;", + "", + " pm.expect(contractOffer[\"https://w3id.org/catenax/ontology/common#version\"]).to.equal(\"1.0\");", + " pm.expect(contractOffer[\"dct:type\"][\"@id\"]).to.equal(\"https://w3id.org/catenax/taxonomy#ItemStockRequestStatusApi\"); ", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"@context\": {},\r\n \"@type\": \"CatalogRequest\",\r\n \"protocol\": \"dataspace-protocol-http\",\r\n \"counterPartyAddress\": \"{{CUSTOMER_EDC_EXT_HOSTNAME}}/{{PROTOCOL_PATH}}\",\r\n \"querySpec\": {\r\n \"offset\": 0,\r\n \"limit\": 100,\r\n \"filter\": \"\",\r\n \"range\": {\r\n \"from\": 0,\r\n \"to\": 100\r\n },\r\n \"filterExpression\": [\r\n {\r\n \"@type\" : \"CriterionDto\",\r\n \"operandLeft\": \"asset:prop:type\",\r\n \"operator\": \"=\",\r\n \"operandRight\": \"data.res.itemStockRequestStatusApi\"\r\n },\r\n {\r\n \"@type\" : \"CriterionDto\",\r\n \"operandLeft\": \"https://w3id.org/catenax/ontology/common#version\",\r\n \"operator\": \"=\",\r\n \"operandRight\": \"1.0\" \r\n }\r\n ]\r\n }\r\n}\r\n", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{SUPPLIER_EDC}}/{{MANAGEMENT_PATH}}/v2/catalog/request", + "host": [ + "{{SUPPLIER_EDC}}" + ], + "path": [ + "{{MANAGEMENT_PATH}}", + "v2", + "catalog", + "request" + ] + } + }, + "response": [] + } + ], + "auth": { + "type": "apikey", + "apikey": [ + { + "key": "value", + "value": "{{SUPPLIER_EDC_API_KEY}}", + "type": "string" + }, + { + "key": "key", + "value": "X-Api-Key", + "type": "string" + } + ] + }, + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "MATERIAL_NUMBER_CUSTOMER", + "value": "MNR-7307-AU340474.002", + "type": "string" + }, + { + "key": "MATERIAL_NUMBER_SUPPLIER", + "value": "MNR-8101-ID146955.001", + "type": "string" + }, + { + "key": "MATERIAL_NUMBER_CX", + "value": "860fb504-b884-4009-9313-c6fb6cdc776b", + "type": "string" + } + ] +} diff --git a/local/tractus-x-edc/config/customer/puris-backend.properties b/local/tractus-x-edc/config/customer/puris-backend.properties index 0180ad30..086a4f8d 100644 --- a/local/tractus-x-edc/config/customer/puris-backend.properties +++ b/local/tractus-x-edc/config/customer/puris-backend.properties @@ -16,12 +16,10 @@ edc.controlplane.management.url=http://customer-control-plane:8181/management edc.controlplane.protocol.url=http://customer-control-plane:8184/api/v1/dsp own.bpnl=BPNL4444444444XX -own.name=Scenario Customer +own.name=Control Unit Creator Inc. own.bpns=BPNS4444444444XX -own.site.name=Hauptwerk Musterhausen +own.site.name=Control Unit Creator Production Site own.bpna=BPNA4444444444AA -own.streetandnumber=Musterstrasse 35b -own.zipcodeandcity=77777 Musterhausen -own.country=Germany - - +own.streetandnumber=13th Street 47 +own.zipcodeandcity=10011 New York +own.country=USA diff --git a/local/tractus-x-edc/config/supplier/puris-backend.properties b/local/tractus-x-edc/config/supplier/puris-backend.properties index e3d46dd4..6bc37bf5 100644 --- a/local/tractus-x-edc/config/supplier/puris-backend.properties +++ b/local/tractus-x-edc/config/supplier/puris-backend.properties @@ -16,12 +16,12 @@ edc.controlplane.management.url=http://supplier-control-plane:9181/management edc.controlplane.protocol.url=http://supplier-control-plane:9184/api/v1/dsp own.bpnl=BPNL1234567890ZZ -own.name=Scenario Supplier +own.name=Semiconductor Supplier Inc. own.bpns=BPNS1234567890ZZ -own.site.name=Konzernzentrale Dudelsdorf +own.site.name=Semiconductor Supplier Inc. Production Site own.bpna=BPNA1234567890AA -own.streetandnumber=Heinrich-Supplier-Strasse 1 -own.zipcodeandcity=77785 Dudelsdorf -own.country=Germany +own.streetandnumber=Wall Street 101 +own.zipcodeandcity=10001 New York +own.country=USA