From 0f5a9097ad8fbfc0a8244bb77fae91953e6be20d Mon Sep 17 00:00:00 2001 From: Joze RIHTARSIC <joze.rihtarsic@ext.ec.europa.eu> Date: Wed, 10 Oct 2018 14:41:31 +0200 Subject: [PATCH] - change clobs with blobs - to preserver XML chars while serializing to database - update --- pom.xml | 2 +- .../api/validators/BdxSmpOasisValidator.java | 6 +- .../validators/BdxSmpOasisValidatorTest.java | 9 ++- smp-parent-pom/pom.xml | 14 ++--- smp-server-library/pom.xml | 8 +-- .../eu/europa/ec/edelivery/smp/SMPRole.java | 24 +++++++- .../smp/conversion/ExtensionConverter.java | 61 ++++++++++++++----- .../smp/conversion/ServiceGroupConverter.java | 25 +++++++- .../conversion/ServiceMetadataConverter.java | 17 ++++-- .../smp/data/model/DBServiceGroup.java | 6 +- .../data/model/DBServiceGroupExtension.java | 6 +- .../smp/data/model/DBServiceMetadata.java | 6 +- .../smp/data/model/DBServiceMetadataXml.java | 6 +- .../smp/data/model/DBUserAuthority.java | 2 +- .../edelivery/smp/data/ui/ServiceGroupRO.java | 2 - .../smp/data/ui/ServiceMetadataRO.java | 2 - .../ec/edelivery/smp/data/ui/UserRO.java | 8 +-- .../smp/exceptions/ErrorBusinessCode.java | 2 +- .../edelivery/smp/exceptions/ErrorCode.java | 12 ++-- .../smp/services/ServiceGroupService.java | 2 +- .../smp/services/ServiceMetadataService.java | 2 +- .../conversion/ExtensionConverterTest.java | 14 ++--- .../conversion/ServiceGroupConverterTest.java | 8 +-- .../ServiceMetadataConverterTest.java | 21 ++++--- .../dao/ServiceGroupDaoIntegrationTest.java | 9 +-- ...erviceGroupDaoMetadataIntegrationTest.java | 7 ++- ...ServiceMultipleDomainsIntegrationTest.java | 7 ++- ...oupServiceSingleDomainIntegrationTest.java | 7 ++- .../ServiceMetadataIntegrationTest.java | 24 ++++---- .../edelivery/smp/testutil/DBAssertion.java | 9 +-- .../edelivery/smp/testutil/TestDBUtils.java | 8 +-- .../edelivery/smp/testutil/XmlTestUtils.java | 20 ++++++ smp-soapui-tests/pom.xml | 6 +- .../soapui/SMP4.0-Generic-soapui-project.xml | 2 +- smp-webapp/pom.xml | 4 +- .../controllers/ServiceGroupController.java | 7 ++- .../ServiceMetadataController.java | 2 +- .../error/ErrorMappingControllerAdvice.java | 2 +- .../error/SpringSecurityExceptionHandler.java | 2 +- .../validation/ServiceMetadataValidator.java | 2 +- .../src/main/resources/spring-security.xml | 4 +- .../mysql5innodb-4.1.0-SNAPSHOT.ddl | 8 +-- .../oracle10g-4.1.0-SNAPSHOT.ddl | 8 +-- .../security/SecurityConfigurationTest.java | 2 +- .../security/SignatureValidatorTest.java | 2 +- .../ServiceGroupControllerTest.java | 4 +- .../ErrorMappingControllerAdviceTest.java | 2 +- .../webapp_integration_test_data.sql | 6 +- 48 files changed, 256 insertions(+), 163 deletions(-) diff --git a/pom.xml b/pom.xml index 6cf3bf102..26278de5a 100644 --- a/pom.xml +++ b/pom.xml @@ -24,7 +24,7 @@ <modules> <module>smp-parent-pom</module> <module>smp-api</module> - <module>smp-angular</module> + <!-- module>smp-angular</module --> <module>smp-server-library</module> <module>smp-webapp</module> </modules> diff --git a/smp-api/src/main/java/eu/europa/ec/smp/api/validators/BdxSmpOasisValidator.java b/smp-api/src/main/java/eu/europa/ec/smp/api/validators/BdxSmpOasisValidator.java index df3636cc1..0bd3d275f 100644 --- a/smp-api/src/main/java/eu/europa/ec/smp/api/validators/BdxSmpOasisValidator.java +++ b/smp-api/src/main/java/eu/europa/ec/smp/api/validators/BdxSmpOasisValidator.java @@ -22,6 +22,8 @@ import javax.xml.transform.stream.StreamSource; import javax.xml.validation.Schema; import javax.xml.validation.SchemaFactory; import javax.xml.validation.Validator; +import java.io.BufferedInputStream; +import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.StringReader; import java.net.URL; @@ -59,9 +61,9 @@ public class BdxSmpOasisValidator { return validator.get(); } - public static void validateXSD(String xmlBody) throws XmlInvalidAgainstSchemaException { + public static void validateXSD(byte[] xmlBody) throws XmlInvalidAgainstSchemaException { try { - getValidator().validate(new StreamSource(new StringReader(xmlBody))); + getValidator().validate(new StreamSource(new ByteArrayInputStream(xmlBody))); } catch (SAXException | IOException e) { throw new XmlInvalidAgainstSchemaException(e.getMessage(), e); } diff --git a/smp-api/src/test/java/eu/europa/ec/smp/api/validators/BdxSmpOasisValidatorTest.java b/smp-api/src/test/java/eu/europa/ec/smp/api/validators/BdxSmpOasisValidatorTest.java index a45d72159..fd2ec9074 100644 --- a/smp-api/src/test/java/eu/europa/ec/smp/api/validators/BdxSmpOasisValidatorTest.java +++ b/smp-api/src/test/java/eu/europa/ec/smp/api/validators/BdxSmpOasisValidatorTest.java @@ -38,7 +38,7 @@ public class BdxSmpOasisValidatorTest { @Parameters({"ServiceMetadata_OK.xml","ServiceGroup_OK.xml"}) public void testValidatePositive(String xmlFilename) throws IOException, XmlInvalidAgainstSchemaException { // given - String xmlBody = loadXMLFile(xmlFilename); + byte[] xmlBody = loadXMLFileAsByteArray(xmlFilename); // when BdxSmpOasisValidator.validateXSD(xmlBody); @@ -61,7 +61,7 @@ public class BdxSmpOasisValidatorTest { @Parameters(method = "negativeCases") public void testValidateNegative(String xmlFilename, String output) throws IOException { // given - String xmlBody = loadXMLFile(xmlFilename); + byte[] xmlBody = loadXMLFileAsByteArray(xmlFilename); // when try { @@ -78,4 +78,9 @@ public class BdxSmpOasisValidatorTest { URL fileUrl = BdxSmpOasisValidatorTest.class.getResource("/XMLValidation/"+path); return IOUtils.toString(fileUrl.openStream(), UTF_8); } + + public byte[] loadXMLFileAsByteArray(String path) throws IOException { + URL fileUrl = BdxSmpOasisValidatorTest.class.getResource("/XMLValidation/"+path); + return IOUtils.toByteArray(fileUrl.openStream()); + } } diff --git a/smp-parent-pom/pom.xml b/smp-parent-pom/pom.xml index 6da417ebc..63b7d0db3 100644 --- a/smp-parent-pom/pom.xml +++ b/smp-parent-pom/pom.xml @@ -86,19 +86,18 @@ <hibernate.version>5.2.13.Final</hibernate.version> <hibernate-jpa.version>1.0.2.Final</hibernate-jpa.version> <hibernate.validator.version>6.0.13.Final</hibernate.validator.version> - <hibernate.annotations.version>3.5.6-Final</hibernate.annotations.version> <h2.version>1.4.187</h2.version> <oracle.version>12.1.0.1</oracle.version> <mysql.version>5.1.45</mysql.version> <soapui.plugin.version>5.1.2</soapui.plugin.version> <commons-net.version>1.4.1</commons-net.version> <ant-commons-net.version>1.6.5</ant-commons-net.version> - <jetty.version>8.1.15.v20140411</jetty.version> + <!-- jetty.version>8.1.15.v20140411</jetty.version --> <servlet-api.version>3.0.1</servlet-api.version> <metro.version>2.2.1-1</metro.version> <commons-io.version>2.4</commons-io.version> <junitparams.version>1.0.5</junitparams.version> - <lombok.version>1.16.16</lombok.version> + <!-- lombok.version>1.16.16</lombok.version --> <xmlunit.version>2.5.1</xmlunit.version> <hamcrest.version>2.0.0.0</hamcrest.version> <jackson.version>2.9.2</jackson.version> @@ -265,11 +264,6 @@ <artifactId>hibernate-envers</artifactId> <version>${hibernate.version}</version> </dependency> - <dependency> - <groupId>org.hibernate</groupId> - <artifactId>hibernate-annotations</artifactId> - <version>${hibernate.annotations.version}</version> - </dependency> <dependency> <groupId>com.h2database</groupId> <artifactId>h2</artifactId> @@ -367,12 +361,12 @@ <artifactId>spring-context-support</artifactId> <version>${spring.security.version}</version> </dependency> - <dependency> + <!-- dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <version>${lombok.version}</version> <scope>provided</scope> - </dependency> + </dependency --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-test</artifactId> diff --git a/smp-server-library/pom.xml b/smp-server-library/pom.xml index cb85416b1..73eb58bb2 100644 --- a/smp-server-library/pom.xml +++ b/smp-server-library/pom.xml @@ -116,14 +116,10 @@ <groupId>org.hibernate</groupId> <artifactId>hibernate-envers</artifactId> </dependency> - <dependency> - <groupId>org.hibernate</groupId> - <artifactId>hibernate-annotations</artifactId> - </dependency> - <dependency> + <!--dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> - </dependency> + </dependency --> <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/SMPRole.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/SMPRole.java index b059422ef..0323f1606 100644 --- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/SMPRole.java +++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/SMPRole.java @@ -2,7 +2,25 @@ package eu.europa.ec.edelivery.smp; public enum SMPRole { - SMP_ADMIN, - SERVICE_GROUP_ADMIN, - SYSTEM_ADMIN + SMP_ADMIN("ROLE_SMP_ADMIN"), + SERVICE_GROUP_ADMIN("ROLE_SERVICE_GROUP_ADMIN"), + SYSTEM_ADMIN("ROLE_SYSTEM_ADMIN"); + + // static constants for annotations! + public static final String S_ROLE_SYSTEM_ADMIN = "ROLE_SYSTEM_ADMIN"; + public static final String S_ROLE_SMP_ADMIN = "ROLE_SMP_ADMIN"; + public static final String S_ROLE_SERVICE_GROUP_ADMIN = "ROLE_SERVICE_GROUP_ADMIN"; + + + String code; + SMPRole(String code){ + this.code = code; + } + + public String getCode() { + return code; + } + + + } diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/conversion/ExtensionConverter.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/conversion/ExtensionConverter.java index a9152c051..0a40e3176 100644 --- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/conversion/ExtensionConverter.java +++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/conversion/ExtensionConverter.java @@ -27,10 +27,7 @@ import javax.xml.stream.XMLOutputFactory; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; import javax.xml.transform.stream.StreamSource; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.InputStream; -import java.io.UnsupportedEncodingException; +import java.io.*; import java.util.Collections; import java.util.List; @@ -41,7 +38,9 @@ import static java.nio.charset.StandardCharsets.UTF_8; */ public class ExtensionConverter { private static final SMPLogger LOG = SMPLoggerFactory.getLogger(ServiceGroupConverter.class); - private static final String WRAPPED_FORMAT = "<ExtensionsWrapper xmlns=\"http://docs.oasis-open.org/bdxr/ns/SMP/2016/05\">%s</ExtensionsWrapper>"; + // private static final String WRAPPED_FORMAT = "<ExtensionsWrapper xmlns=\"http://docs.oasis-open.org/bdxr/ns/SMP/2016/05\">%s</ExtensionsWrapper>"; + private static final byte[] WRAPPED_FORMAT_START = "<ExtensionsWrapper xmlns=\"http://docs.oasis-open.org/bdxr/ns/SMP/2016/05\">".getBytes(); + private static final byte[] WRAPPED_FORMAT_END = "</ExtensionsWrapper>".getBytes(); private static final QName EXT_TYPE_QNAME = new QName("http://docs.oasis-open.org/bdxr/ns/SMP/2016/05", "Extension"); /** @@ -70,25 +69,27 @@ public class ExtensionConverter { return extensionUnmarshaller.get(); } - public static String marshalExtensions(List<ExtensionType> extensions) throws JAXBException, XMLStreamException, UnsupportedEncodingException { + public static byte[] marshalExtensions(List<ExtensionType> extensions) throws JAXBException, XMLStreamException, IOException { return marshalExtensions(extensions, false); } - public static String marshalExtensions(List<ExtensionType> extensions, boolean prettyPrint ) throws JAXBException, XMLStreamException, UnsupportedEncodingException { + public static byte[] marshalExtensions(List<ExtensionType> extensions, boolean prettyPrint ) throws JAXBException, XMLStreamException, IOException { if (extensions == null) { return null; } - StringBuilder stringBuilder = new StringBuilder(); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + // StringBuilder stringBuilder = new StringBuilder(); for (ExtensionType aExtension : extensions) { - stringBuilder.append(ExtensionConverter.marshalExtension(aExtension, prettyPrint)); + baos.write(ExtensionConverter.marshalExtension(aExtension, prettyPrint)); + // stringBuilder.append(ExtensionConverter.marshalExtension(aExtension, prettyPrint)); } - return stringBuilder.toString(); + return baos.toByteArray(); } - private static String marshalExtension(ExtensionType extension, boolean prettyPrint ) throws JAXBException, XMLStreamException, UnsupportedEncodingException { + private static byte[] marshalExtension(ExtensionType extension, boolean prettyPrint ) throws JAXBException, XMLStreamException { if (extension == null) { return null; } @@ -114,12 +115,15 @@ public class ExtensionConverter { xsw.close(); } } - return baos.toString(UTF_8.name()); + //return baos.toString(UTF_8.name()); + return baos.toByteArray(); } - protected static List<ExtensionType> unmarshalExtensions(String xml) throws JAXBException { - String wrappedExtensionsStr = String.format(WRAPPED_FORMAT, xml); - InputStream inStream = new ByteArrayInputStream(wrappedExtensionsStr.getBytes(UTF_8)); + protected static List<ExtensionType> unmarshalExtensions(byte[] xml) throws JAXBException { + + + InputStream inStream = new ByteArrayInputStream(concatByteArrays(WRAPPED_FORMAT_START,xml,WRAPPED_FORMAT_END )); + Unmarshaller jaxbUnmarshaller = getUnmarshaller(); JAXBElement<ExtensionsWrapper> wrappedExtensions = jaxbUnmarshaller.unmarshal(new StreamSource(inStream), ExtensionsWrapper.class); if (wrappedExtensions.getValue() != null && wrappedExtensions.getValue().extensions != null) { @@ -128,4 +132,31 @@ public class ExtensionConverter { return Collections.emptyList(); } } + + /** + * Method concat the bytearrays to one array + * + * + * https://stackoverflow.com/questions/5513152/easy-way-to-concatenate-two-byte-arrays + * - Use varargs (...) to be called with any number of byte[]. + * - Use System.arraycopy() that is implemented with machine specific native code, to ensure high speed operation. + * - Create a new byte[] with the exact size that is need it. + * - Allocate little less int variables by reusing the i and len variables. + + * @param inputs - byte arrays + * @return + */ + public static byte[] concatByteArrays(byte[]... inputs) { + int i, len = 0; + for (i = 0; i < inputs.length; i++) { + len += inputs[i].length; + } + byte[] r = new byte[len]; + len = 0; + for (i = 0; i < inputs.length; i++) { + System.arraycopy(inputs[i], 0, r, len, inputs[i].length); + len += inputs[i].length; + } + return r; + } } diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/conversion/ServiceGroupConverter.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/conversion/ServiceGroupConverter.java index c97a6cb75..bc590f32c 100644 --- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/conversion/ServiceGroupConverter.java +++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/conversion/ServiceGroupConverter.java @@ -85,6 +85,20 @@ public class ServiceGroupConverter { } } + /** + * Method umarshal ServiceGroup from xml bytearraz + * @param serviceGroupXml + * @return + */ + public static ServiceGroup unmarshal(byte[] serviceGroupXml) { + try { + Document serviceGroupDoc = parse(serviceGroupXml); + return getUnmarshaller().unmarshal(serviceGroupDoc, ServiceGroup.class).getValue(); + } catch (ParserConfigurationException | IOException | SAXException | JAXBException ex) { + throw new SMPRuntimeException(ErrorCode.XML_PARSE_EXCEPTION,ex,ServiceGroup.class.getName(), ExceptionUtils.getRootCauseMessage(ex)); + } + } + /** * Method returns Oasis ServiceGroup entity with extension and * empty ServiceMetadataReferenceCollectionType. If extension can not be converted to jaxb object than @@ -102,7 +116,7 @@ public class ServiceGroupConverter { ServiceGroup serviceGroup = new ServiceGroup(); ParticipantIdentifierType identifier = new ParticipantIdentifierType(dsg.getParticipantIdentifier(), dsg.getParticipantScheme()); serviceGroup.setParticipantIdentifier(identifier); - if (!StringUtils.isBlank(dsg.getExtension())){ + if (dsg.getExtension()!=null){ try { List<ExtensionType> extensions = ExtensionConverter.unmarshalExtensions(dsg.getExtension()); serviceGroup.getExtensions().addAll(extensions); @@ -120,6 +134,11 @@ public class ServiceGroupConverter { return getDocumentBuilder().parse(inputStream); } + + private static Document parse(byte[] serviceGroupXml) throws ParserConfigurationException, IOException, SAXException { + InputStream inputStream = new ByteArrayInputStream(serviceGroupXml); + return getDocumentBuilder().parse(inputStream); + } private static DocumentBuilder getDocumentBuilder() throws ParserConfigurationException { DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); documentBuilderFactory.setNamespaceAware(true); @@ -127,10 +146,10 @@ public class ServiceGroupConverter { return documentBuilderFactory.newDocumentBuilder(); } - public static String extractExtensionsPayload(ServiceGroup sg) { + public static byte[] extractExtensionsPayload(ServiceGroup sg) { try { return ExtensionConverter.marshalExtensions(sg.getExtensions()); - } catch (JAXBException | XMLStreamException | UnsupportedEncodingException e) { + } catch (JAXBException | XMLStreamException | IOException e) { throw new SMPRuntimeException(INVALID_EXTENSION_FOR_SG, e, sg.getParticipantIdentifier().getValue(), sg.getParticipantIdentifier().getScheme(), ExceptionUtils.getRootCauseMessage(e)); diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/conversion/ServiceMetadataConverter.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/conversion/ServiceMetadataConverter.java index bbd7bef3b..14fd39779 100644 --- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/conversion/ServiceMetadataConverter.java +++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/conversion/ServiceMetadataConverter.java @@ -83,10 +83,10 @@ public class ServiceMetadataConverter { * @param serviceMetadataXml * @return w3d dom element */ - public static Document toSignedServiceMetadatadaDocument(String serviceMetadataXml) { + public static Document toSignedServiceMetadatadaDocument(byte[] serviceMetadataXml) { try { Document docServiceMetadata = parse(serviceMetadataXml); - Document root = parse(DOC_SIGNED_SERVICE_METADATA_EMPTY); + Document root = parse(DOC_SIGNED_SERVICE_METADATA_EMPTY.getBytes()); Node imported = root.importNode(docServiceMetadata.getDocumentElement(), true); root.getDocumentElement().appendChild(imported); return root; @@ -96,7 +96,7 @@ public class ServiceMetadataConverter { } - public static ServiceMetadata unmarshal(String serviceMetadataXml){ + public static ServiceMetadata unmarshal(byte[] serviceMetadataXml){ try { Document serviceMetadataDoc = parse(serviceMetadataXml); ServiceMetadata serviceMetadata = getUnmarshaller().unmarshal(serviceMetadataDoc, ServiceMetadata.class).getValue(); @@ -106,8 +106,8 @@ public class ServiceMetadataConverter { } } - private static Document parse(String serviceMetadataXml) throws SAXException, IOException, ParserConfigurationException { - InputStream inputStream = new ByteArrayInputStream(serviceMetadataXml.getBytes(UTF_8)); + private static Document parse(byte[] serviceMetadataXml) throws SAXException, IOException, ParserConfigurationException { + InputStream inputStream = new ByteArrayInputStream(serviceMetadataXml); return getDocumentBuilder().parse(inputStream); } @@ -118,6 +118,13 @@ public class ServiceMetadataConverter { return writer.toString(); } + public static byte[] toByteArray(Document doc) throws TransformerException, UnsupportedEncodingException { + Transformer transformer = TransformerFactory.newInstance().newTransformer(); + ByteArrayOutputStream stream = new ByteArrayOutputStream(); + transformer.transform(new DOMSource(doc), new StreamResult(stream)); + return stream.toByteArray(); + } + private static DocumentBuilder getDocumentBuilder() throws ParserConfigurationException { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/model/DBServiceGroup.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/model/DBServiceGroup.java index a56fa73d6..c01c952de 100644 --- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/model/DBServiceGroup.java +++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/model/DBServiceGroup.java @@ -181,13 +181,13 @@ public class DBServiceGroup extends BaseEntity { } @Transient - public String getExtension() { + public byte[] getExtension() { return getServiceGroupExtension() != null ? getServiceGroupExtension().getExtension() : null; } - public void setExtension(String extension) { + public void setExtension(byte[] extension) { - if (StringUtils.isBlank(extension)) { + if (extension == null) { if (this.serviceGroupExtension != null) { this.serviceGroupExtension.setExtension(null); } diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/model/DBServiceGroupExtension.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/model/DBServiceGroupExtension.java index 044f6d44e..c27f84592 100644 --- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/model/DBServiceGroupExtension.java +++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/model/DBServiceGroupExtension.java @@ -27,7 +27,7 @@ public class DBServiceGroupExtension extends BaseEntity { @Lob @Column(name = "EXTENSION") - String extension; + byte[] extension; @OneToOne @JoinColumn(name = "ID") @@ -51,11 +51,11 @@ public class DBServiceGroupExtension extends BaseEntity { this.dbServiceGroup = dbServiceGroup; } - public String getExtension() { + public byte[] getExtension() { return extension; } - public void setExtension(String extension) { + public void setExtension(byte[] extension) { this.extension = extension; } diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/model/DBServiceMetadata.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/model/DBServiceMetadata.java index 2dc9862c9..e016200c3 100644 --- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/model/DBServiceMetadata.java +++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/model/DBServiceMetadata.java @@ -127,14 +127,14 @@ public class DBServiceMetadata extends BaseEntity { } @Transient - public String getXmlContent() { + public byte[] getXmlContent() { return getServiceMetadataXml() != null ? getServiceMetadataXml().getXmlContent() : null; } @Transient - public void setXmlContent(String extension) { + public void setXmlContent(byte[] extension) { - if (StringUtils.isBlank(extension)) { + if (extension == null) { if (this.serviceMetadataXml != null) { this.serviceMetadataXml.setXmlContent(null); } diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/model/DBServiceMetadataXml.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/model/DBServiceMetadataXml.java index 44aba47ca..070f723e1 100644 --- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/model/DBServiceMetadataXml.java +++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/model/DBServiceMetadataXml.java @@ -26,7 +26,7 @@ public class DBServiceMetadataXml extends BaseEntity { @Lob @Column(name = "XML_CONTENT") - String xmlContent; + byte[] xmlContent; @OneToOne @JoinColumn(name = "ID") @@ -50,11 +50,11 @@ public class DBServiceMetadataXml extends BaseEntity { this.serviceMetadata = smd; } - public String getXmlContent() { + public byte[] getXmlContent() { return xmlContent; } - public void setXmlContent(String xmlContent) { + public void setXmlContent(byte[] xmlContent) { this.xmlContent = xmlContent; } diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/model/DBUserAuthority.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/model/DBUserAuthority.java index c3a5e6b0b..e87210342 100644 --- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/model/DBUserAuthority.java +++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/model/DBUserAuthority.java @@ -7,7 +7,7 @@ import javax.persistence.*; @NamedNativeQueries({ @NamedNativeQuery( name = "DBUserAuthority.getRolesForUsernameNativeQuery", - query = "SELECT 'ROLE_SMP_ADMIN' AS AUTHORITY FROM smp_user WHERE isadmin = 1 and username=:username " + + query = "SELECT 'SMP_ADMIN' AS AUTHORITY FROM smp_user WHERE isadmin = 1 and username=:username " + "UNION ALL " + "SELECT CONCAT(businessIdentifierScheme, CONCAT('::', businessIdentifier)) AS AUTHORITY FROM smp_ownership WHERE username=:username", resultSetMapping = "RoleDTO" diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/ui/ServiceGroupRO.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/ui/ServiceGroupRO.java index 0eb3a2199..8fbbdfb09 100644 --- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/ui/ServiceGroupRO.java +++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/ui/ServiceGroupRO.java @@ -1,8 +1,6 @@ package eu.europa.ec.edelivery.smp.data.ui; -import lombok.EqualsAndHashCode; -import lombok.ToString; import javax.persistence.*; import java.io.Serializable; diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/ui/ServiceMetadataRO.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/ui/ServiceMetadataRO.java index cbf88c283..2a2386982 100644 --- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/ui/ServiceMetadataRO.java +++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/ui/ServiceMetadataRO.java @@ -1,8 +1,6 @@ package eu.europa.ec.edelivery.smp.data.ui; -import lombok.EqualsAndHashCode; -import lombok.ToString; import javax.persistence.*; import java.io.Serializable; diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/ui/UserRO.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/ui/UserRO.java index dddf9afc5..c81c50ebc 100644 --- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/ui/UserRO.java +++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/ui/UserRO.java @@ -1,16 +1,12 @@ package eu.europa.ec.edelivery.smp.data.ui; -import eu.europa.ec.edelivery.smp.data.model.CommonColumnsLengths; -import lombok.EqualsAndHashCode; -import lombok.ToString; -import javax.persistence.*; + + import java.io.Serializable; import java.time.LocalDateTime; -import java.util.Objects; -import static eu.europa.ec.edelivery.smp.data.model.CommonColumnsLengths.MAX_USERNAME_LENGTH; /** * @author Joze Rihtarsic diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/exceptions/ErrorBusinessCode.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/exceptions/ErrorBusinessCode.java index ff71b8539..0aa830f22 100644 --- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/exceptions/ErrorBusinessCode.java +++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/exceptions/ErrorBusinessCode.java @@ -17,7 +17,7 @@ package eu.europa.ec.edelivery.smp.exceptions; * Created by migueti on 16/01/2017. */ public enum ErrorBusinessCode { - XML_INVALID, + XSD_INVALID, MISSING_FIELD, WRONG_FIELD, OUT_OF_RANGE, diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/exceptions/ErrorCode.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/exceptions/ErrorCode.java index d42ab7adf..9872cf97e 100644 --- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/exceptions/ErrorCode.java +++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/exceptions/ErrorCode.java @@ -21,20 +21,20 @@ public enum ErrorCode { INVALID_USER_NO_IDENTIFIERS (400,"SMP:120",ErrorBusinessCode.MISSING_FIELD,"Invalid user - no identifiers!"), ILLEGAL_STATE_USERNAME_MULTIPLE_ENTRY(500,"SMP:121",ErrorBusinessCode.TECHNICAL,"More than one user entry (username: '%s') is defined in database!"), ILLEGAL_STATE_CERT_ID_MULTIPLE_ENTRY(504,"SMP:122",ErrorBusinessCode.TECHNICAL,"More than one certificate entry (cert. id: '%s') is defined in database!"), - USER_NOT_EXISTS(404,"SMP:123",ErrorBusinessCode.NOT_FOUND,"User not exists or wrong password!"), // OWASP recommendation\ + USER_NOT_EXISTS(400,"SMP:123",ErrorBusinessCode.USER_NOT_FOUND,"User not exists or wrong password!"), // OWASP recommendation\ USER_IS_NOT_OWNER(400,"SMP:124",ErrorBusinessCode.UNAUTHORIZED,"User %s is not owner of service group (part. id: %s, part. sch.: '%s')!"), // OWASP recommendation // service group error ILLEGAL_STATE_SG_MULTIPLE_ENTRY (500,"SMP:130",ErrorBusinessCode.TECHNICAL,"More than one service group ( part. id: %s, part. sch.: '%s') is defined in database!"), - SG_NOT_EXISTS(404,"SMP:131",ErrorBusinessCode.NOT_FOUND,"Service group not exists (dpart. id: '%s', part. sch.: '%s')!"), + SG_NOT_EXISTS(404,"SMP:131",ErrorBusinessCode.NOT_FOUND,"ServiceGroup not found (dpart. id: '%s', part. sch.: '%s')!"), SG_NOT_REGISTRED_FOR_DOMAIN(400,"SMP:131",ErrorBusinessCode.NOT_FOUND,"Service group not registred for domain (domain: %s, part. id:~ '%s', part. sch.: '%s')!"), - INVALID_EXTENSION_FOR_SG (400,"SMP:132",ErrorBusinessCode.XML_INVALID,"Invalid extension for service group (part. id: '%s', part. sch.: '%s'). Error: %s!"), + INVALID_EXTENSION_FOR_SG (400,"SMP:132",ErrorBusinessCode.XSD_INVALID,"Invalid extension for service group (part. id: '%s', part. sch.: '%s'). Error: %s!"), // service metadata error ILLEGAL_STATE_SMD_MULTIPLE_ENTRY (500,"SMP:140",ErrorBusinessCode.TECHNICAL,"More than one service metadata ( doc. id: %s, doc. sch.: '%s') for participant ( part. id %s, part. sch. : '%s') is defined in database!"), - METADATA_NOT_EXISTS(404,"SMP:141",ErrorBusinessCode.NOT_FOUND,"ServiceMetadata not exist(part. id: '%s', part. sch.: '%s',doc. id: '%s', doc. sch.: '%s')!"), - SMD_NOT_EXISTS_FOR_DOMAIN(404,"SMP:142",ErrorBusinessCode.NOT_FOUND,"ServiceMetadata not exists for domain (domain: %s, part. id: '%s', part. sch.: '%s')!"), - INVALID_SMD_XML (400,"SMP:143",ErrorBusinessCode.XML_INVALID,"Invalid service metada. Error: %s"), + METADATA_NOT_EXISTS(404,"SMP:141",ErrorBusinessCode.NOT_FOUND,"ServiceMetadata not found (part. id: '%s', part. sch.: '%s',doc. id: '%s', doc. sch.: '%s')!"), + SMD_NOT_EXISTS_FOR_DOMAIN(404,"SMP:142",ErrorBusinessCode.NOT_FOUND,"ServiceMetadata not found for domain (domain: %s, part. id: '%s', part. sch.: '%s')!"), + INVALID_SMD_XML (400,"SMP:143",ErrorBusinessCode.XSD_INVALID,"Invalid service metada. Error: %s"), // SML integration SML_INTEGRATION_EXCEPTION (500,"SMP:150",ErrorBusinessCode.TECHNICAL,"Could not create new DNS entry through SML! Error: %s "), diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/ServiceGroupService.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/ServiceGroupService.java index d6388a39c..e5be6f258 100644 --- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/ServiceGroupService.java +++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/ServiceGroupService.java @@ -116,7 +116,7 @@ public class ServiceGroupService { normalizedParticipantId.getScheme()); - String extensions = ServiceGroupConverter.extractExtensionsPayload(serviceGroup); + byte[] extensions = ServiceGroupConverter.extractExtensionsPayload(serviceGroup); if (dbServiceGroup.isPresent()) { // service already exists. diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/ServiceMetadataService.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/ServiceMetadataService.java index db9a0bf1f..28fd6146d 100644 --- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/ServiceMetadataService.java +++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/ServiceMetadataService.java @@ -87,7 +87,7 @@ public class ServiceMetadataService { * @return True if new ServiceMetadata was created. False if existing one was updated. */ @Transactional - public boolean saveServiceMetadata(String domain, ParticipantIdentifierType serviceGroupId, DocumentIdentifier documentId, String xmlContent) { + public boolean saveServiceMetadata(String domain, ParticipantIdentifierType serviceGroupId, DocumentIdentifier documentId, byte[] xmlContent) { ParticipantIdentifierType normalizedServiceGroupId = caseSensitivityNormalizer.normalize(serviceGroupId); DocumentIdentifier normalizedDocId = caseSensitivityNormalizer.normalize(documentId); diff --git a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/conversion/ExtensionConverterTest.java b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/conversion/ExtensionConverterTest.java index d2a3439eb..fbdd752ea 100644 --- a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/conversion/ExtensionConverterTest.java +++ b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/conversion/ExtensionConverterTest.java @@ -50,7 +50,7 @@ public class ExtensionConverterTest { String inputDoc = XmlTestUtils.loadDocumentAsString(RES_PATH + "extensionMarshal.xml"); // when - String xmlResult = ExtensionConverter.marshalExtensions(list); + byte[] xmlResult = ExtensionConverter.marshalExtensions(list); // then assertThat(xmlResult, CompareMatcher.isIdenticalTo(inputDoc)); @@ -63,23 +63,23 @@ public class ExtensionConverterTest { String inputDoc = XmlTestUtils.loadDocumentAsString(RES_PATH + "extensionMarshalMore.xml"); // when - String xmlResult = ExtensionConverter.marshalExtensions(list, true); + byte[] xmlResult = ExtensionConverter.marshalExtensions(list, true); // then - String wrappedXmlResult = String.format(WRAPPED_FORMAT, xmlResult); + String wrappedXmlResult = String.format(WRAPPED_FORMAT, new String(xmlResult, "UTF-8")); String wrappedInputDoc = String.format(WRAPPED_FORMAT, inputDoc); assertThat(wrappedXmlResult, CompareMatcher.isIdenticalTo(wrappedInputDoc)); } @Test - public void testUtf8Handling() throws JAXBException, XMLStreamException, UnsupportedEncodingException { + public void testUtf8Handling() throws JAXBException, XMLStreamException, IOException { // given ExtensionType extension = new ExtensionType(); extension.setExtensionName(UTF8_SEQUENCE); List<ExtensionType> extensions = Arrays.asList(extension); //when - String extensionsXml = ExtensionConverter.marshalExtensions(extensions); + byte[] extensionsXml = ExtensionConverter.marshalExtensions(extensions); List<ExtensionType> resultExtensions = ExtensionConverter.unmarshalExtensions(extensionsXml); //then @@ -89,7 +89,7 @@ public class ExtensionConverterTest { @Test public void testUnmarshal() throws IOException, JAXBException { // given - String inputDoc = XmlTestUtils.loadDocumentAsString(RES_PATH + "extensionMarshal.xml"); + byte[] inputDoc = XmlTestUtils.loadDocumentAsByteArray(RES_PATH + "extensionMarshal.xml"); // when List<ExtensionType> extensions = ExtensionConverter.unmarshalExtensions(inputDoc); @@ -101,7 +101,7 @@ public class ExtensionConverterTest { @Test public void testUnmarshalTwoExtensions() throws IOException, JAXBException { // given - String inputDoc = XmlTestUtils.loadDocumentAsString(RES_PATH + "extensionMarshalMore.xml"); + byte[] inputDoc = XmlTestUtils.loadDocumentAsByteArray(RES_PATH + "extensionMarshalMore.xml"); // when List<ExtensionType> extensions = ExtensionConverter.unmarshalExtensions(inputDoc); diff --git a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/conversion/ServiceGroupConverterTest.java b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/conversion/ServiceGroupConverterTest.java index c3eb4b8d0..07ff814d3 100644 --- a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/conversion/ServiceGroupConverterTest.java +++ b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/conversion/ServiceGroupConverterTest.java @@ -66,7 +66,7 @@ public class ServiceGroupConverterTest { public void toServiceGroupTestMultiExtensions() throws UnsupportedEncodingException, JAXBException, XMLStreamException { // set DBServiceGroup sg = TestDBUtils.createDBServiceGroup(); - sg.setExtension(TestDBUtils.generateExtension() + TestDBUtils.generateExtension()); + sg.setExtension(ExtensionConverter.concatByteArrays(TestDBUtils.generateExtension(), TestDBUtils.generateExtension())); //when-then ServiceGroup serviceGroup = ServiceGroupConverter.toServiceGroup(sg); @@ -88,7 +88,7 @@ public class ServiceGroupConverterTest { public void testInvalidExtension() { //given DBServiceGroup sg = TestDBUtils.createDBServiceGroup(); - sg.setExtension("<This > is invalid extensions"); + sg.setExtension("<This > is invalid extensions".getBytes()); expectedExeption.expect(SMPRuntimeException.class); expectedExeption.expectCause(Matchers.isA(UnmarshalException.class)); expectedExeption.expectMessage(Matchers.startsWith("Invalid extension for service group")); @@ -121,11 +121,11 @@ public class ServiceGroupConverterTest { ServiceGroup serviceGroup = ServiceGroupConverter.unmarshal(inputDoc); //when - String val = ServiceGroupConverter.extractExtensionsPayload(serviceGroup); + byte[] val = ServiceGroupConverter.extractExtensionsPayload(serviceGroup); //then assertNotNull(val); - assertEquals(expectedExt, val); + assertEquals(expectedExt, new String(val,"UTF-8")); } @Test diff --git a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/conversion/ServiceMetadataConverterTest.java b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/conversion/ServiceMetadataConverterTest.java index 184f78598..2edd221d9 100644 --- a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/conversion/ServiceMetadataConverterTest.java +++ b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/conversion/ServiceMetadataConverterTest.java @@ -35,6 +35,7 @@ import javax.xml.bind.JAXBException; import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.TransformerException; import java.io.IOException; +import java.util.Arrays; import static org.junit.Assert.*; @@ -53,7 +54,7 @@ public class ServiceMetadataConverterTest { @Test public void testUnmarshalServiceInformation() throws IOException, SAXException, ParserConfigurationException, JAXBException { //given - String inputDoc = XmlTestUtils.loadDocumentAsString(RES_PATH + "ServiceMetadataWithServiceInformation.xml"); + byte[] inputDoc = XmlTestUtils.loadDocumentAsByteArray(RES_PATH + "ServiceMetadataWithServiceInformation.xml"); //when ServiceMetadata serviceMetadata = ServiceMetadataConverter.unmarshal(inputDoc); @@ -73,7 +74,7 @@ public class ServiceMetadataConverterTest { @Test public void testUnmarshalServiceInformationUtf8() throws IOException, SAXException, ParserConfigurationException, JAXBException { //given - String inputDoc = XmlTestUtils.loadDocumentAsString(RES_PATH + "ServiceMetadataWithServiceInformationUtf8.xml"); + byte[] inputDoc = XmlTestUtils.loadDocumentAsByteArray(RES_PATH + "ServiceMetadataWithServiceInformationUtf8.xml"); //when ServiceMetadata serviceMetadata = ServiceMetadataConverter.unmarshal(inputDoc); @@ -87,7 +88,7 @@ public class ServiceMetadataConverterTest { @Test public void testUnmarshalRedirect() throws IOException, SAXException, ParserConfigurationException, JAXBException { //given - String inputDoc = XmlTestUtils.loadDocumentAsString(RES_PATH + "ServiceMetadataWithRedirect.xml"); + byte[] inputDoc = XmlTestUtils.loadDocumentAsByteArray(RES_PATH + "ServiceMetadataWithRedirect.xml"); //when ServiceMetadata serviceMetadata = ServiceMetadataConverter.unmarshal(inputDoc); @@ -107,13 +108,13 @@ public class ServiceMetadataConverterTest { expectedExeption.expect(SMPRuntimeException.class); expectedExeption.expectMessage(Matchers.startsWith("Invalid service metada. Error")); //when - ServiceMetadataConverter.unmarshal("this is malformed XML body"); + ServiceMetadataConverter.unmarshal("this is malformed XML body".getBytes()); } @Test public void testUnmarshalMissingMandatoryFields() throws IOException, SAXException, ParserConfigurationException, JAXBException { //given - String inputDoc = XmlTestUtils.loadDocumentAsString(RES_PATH + "ServiceMetadataMissingMandatoryFields.xml"); + byte[] inputDoc = XmlTestUtils.loadDocumentAsByteArray(RES_PATH + "ServiceMetadataMissingMandatoryFields.xml"); //when ServiceMetadata serviceMetadata = ServiceMetadataConverter.unmarshal(inputDoc); @@ -128,7 +129,7 @@ public class ServiceMetadataConverterTest { @Test public void testToSignedServiceMetadataDocument() throws IOException, SAXException, ParserConfigurationException, TransformerException { //given - String inputDoc = XmlTestUtils.loadDocumentAsString(RES_PATH + "ServiceMetadataWithServiceInformation.xml"); + byte[] inputDoc = XmlTestUtils.loadDocumentAsByteArray(RES_PATH + "ServiceMetadataWithServiceInformation.xml"); //when Document signedServiceMetadataDoc = ServiceMetadataConverter.toSignedServiceMetadatadaDocument(inputDoc); @@ -140,8 +141,8 @@ public class ServiceMetadataConverterTest { NodeList children = root.getChildNodes(); assertEquals(1, children.getLength()); - String resultServiceMetadata = XmlTestUtils.marshal(children.item(0)); - assertEquals(inputDoc, resultServiceMetadata); + byte[] resultServiceMetadata = XmlTestUtils.marshallToByteArray(children.item(0)); + assertTrue(Arrays.equals(inputDoc, resultServiceMetadata)); } @Test @@ -150,7 +151,7 @@ public class ServiceMetadataConverterTest { expectedExeption.expect(SMPRuntimeException.class); expectedExeption.expectMessage(Matchers.startsWith("Invalid service metada. Error:")); //when - ServiceMetadataConverter.toSignedServiceMetadatadaDocument("this is malformed XML body"); + ServiceMetadataConverter.toSignedServiceMetadatadaDocument("this is malformed XML body".getBytes()); } @Test @@ -162,7 +163,7 @@ public class ServiceMetadataConverterTest { expectedExeption.expectCause(Matchers.isA(SAXParseException.class)); - String inputDoc = XmlTestUtils.loadDocumentAsString(RES_PATH + "ServiceMetadataWithDOCTYPE.xml"); + byte[] inputDoc = XmlTestUtils.loadDocumentAsByteArray(RES_PATH + "ServiceMetadataWithDOCTYPE.xml"); ServiceMetadataConverter.unmarshal(inputDoc); diff --git a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/data/dao/ServiceGroupDaoIntegrationTest.java b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/data/dao/ServiceGroupDaoIntegrationTest.java index 28b87bdb6..d10dc9696 100644 --- a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/data/dao/ServiceGroupDaoIntegrationTest.java +++ b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/data/dao/ServiceGroupDaoIntegrationTest.java @@ -9,6 +9,7 @@ import org.junit.runner.RunWith; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import javax.transaction.Transactional; +import java.util.Arrays; import java.util.Optional; import java.util.UUID; @@ -57,7 +58,7 @@ public class ServiceGroupDaoIntegrationTest extends ServiceGroupDaoIntegrationBa DBDomain d = domainDao.getDomainByCode(TEST_DOMAIN_CODE_1).get(); DBServiceGroup sg = TestDBUtils.createDBServiceGroup(); - String extension = String.format(TestConstants.SIMPLE_EXTENSION_XML, UUID.randomUUID().toString()); + byte[] extension = String.format(TestConstants.SIMPLE_EXTENSION_XML, UUID.randomUUID().toString()).getBytes(); sg.setExtension(extension); sg.addDomain(d); @@ -70,14 +71,14 @@ public class ServiceGroupDaoIntegrationTest extends ServiceGroupDaoIntegrationBa assertEquals(sg, res); // test equal method - same entity assertEquals(sg.getParticipantIdentifier(), res.getParticipantIdentifier()); // test equal method - same entity assertEquals(sg.getParticipantScheme(), res.getParticipantScheme()); // test equal method - same entity - assertEquals(extension, res.getExtension()); // test loaded Domain + assertTrue(Arrays.equals(extension, res.getExtension())); // test loaded Domain } @Test public void updateServiceGroupExtension() { // given DBServiceGroup sg = createAndSaveNewServiceGroup(); - String extension1 = String.format(TestConstants.SIMPLE_EXTENSION_XML, UUID.randomUUID().toString()); + byte[] extension1 = String.format(TestConstants.SIMPLE_EXTENSION_XML, UUID.randomUUID().toString()).getBytes(); // when DBServiceGroup res = testInstance.findServiceGroup(sg.getParticipantIdentifier(), sg.getParticipantScheme()).get(); res.setExtension(extension1); @@ -89,7 +90,7 @@ public class ServiceGroupDaoIntegrationTest extends ServiceGroupDaoIntegrationBa assertEquals(res, res2); // test equal method - same entity assertEquals(res.getParticipantIdentifier(), res2.getParticipantIdentifier()); // test equal method - same entity assertEquals(res.getParticipantScheme(), res2.getParticipantScheme()); // test equal method - same entity - assertEquals(extension1, res2.getExtension()); // test loaded Domain + assertTrue(Arrays.equals(extension1, res2.getExtension())); // test loaded Domain } @Test diff --git a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/data/dao/ServiceGroupDaoMetadataIntegrationTest.java b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/data/dao/ServiceGroupDaoMetadataIntegrationTest.java index 537668eb3..efcac9f16 100644 --- a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/data/dao/ServiceGroupDaoMetadataIntegrationTest.java +++ b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/data/dao/ServiceGroupDaoMetadataIntegrationTest.java @@ -9,6 +9,7 @@ import org.junit.runner.RunWith; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import javax.transaction.Transactional; +import java.util.Arrays; import java.util.Optional; import java.util.UUID; @@ -71,7 +72,7 @@ public class ServiceGroupDaoMetadataIntegrationTest extends ServiceGroupDaoInteg DBServiceGroup res2 = testInstance.findServiceGroup(sg.getParticipantIdentifier(), sg.getParticipantScheme()).get(); assertNotNull(res2); assertEquals(1, res2.getServiceGroupDomains().get(0).getServiceMetadata().size()); - assertEquals(md.getXmlContent(), res2.getServiceGroupDomains().get(0).getServiceMetadata().get(0).getXmlContent()); + assertTrue(Arrays.equals(md.getXmlContent(), res2.getServiceGroupDomains().get(0).getServiceMetadata().get(0).getXmlContent())); } @Test @@ -82,7 +83,7 @@ public class ServiceGroupDaoMetadataIntegrationTest extends ServiceGroupDaoInteg DBServiceGroup res = testInstance.findServiceGroup(sg.getParticipantIdentifier(), sg.getParticipantScheme()).get(); DBServiceMetadata md = res.getServiceGroupDomains().get(0).getServiceMetadata(0); - String str = TestDBUtils.generateDocumentSample(sg.getParticipantIdentifier(),sg.getParticipantScheme(), + byte[] str = TestDBUtils.generateDocumentSample(sg.getParticipantIdentifier(),sg.getParticipantScheme(), md.getDocumentIdentifier(),md.getDocumentIdentifierScheme(),UUID.randomUUID().toString()); assertNotEquals (str, md.getXmlContent()); //when @@ -94,7 +95,7 @@ public class ServiceGroupDaoMetadataIntegrationTest extends ServiceGroupDaoInteg DBServiceGroup res2 = testInstance.findServiceGroup(sg.getParticipantIdentifier(), sg.getParticipantScheme()).get(); assertNotNull(res2); assertEquals(1, res2.getServiceGroupDomains().get(0).getServiceMetadata().size()); - assertEquals(str, res2.getServiceGroupDomains().get(0).getServiceMetadata().get(0).getXmlContent()); + assertTrue(Arrays.equals(str, res2.getServiceGroupDomains().get(0).getServiceMetadata().get(0).getXmlContent())); } diff --git a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/services/ServiceGroupServiceMultipleDomainsIntegrationTest.java b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/services/ServiceGroupServiceMultipleDomainsIntegrationTest.java index 3ba17f68d..58936bd2a 100644 --- a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/services/ServiceGroupServiceMultipleDomainsIntegrationTest.java +++ b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/services/ServiceGroupServiceMultipleDomainsIntegrationTest.java @@ -35,6 +35,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import javax.xml.bind.JAXBException; import javax.xml.stream.XMLStreamException; import java.io.IOException; +import java.util.Arrays; import java.util.Optional; import static eu.europa.ec.edelivery.smp.conversion.ServiceGroupConverter.unmarshal; @@ -107,8 +108,8 @@ public class ServiceGroupServiceMultipleDomainsIntegrationTest extends AbstractS ServiceGroup inServiceGroup = unmarshal(loadDocumentAsString(TestConstants.SERVICE_GROUP_TEST2_XML_PATH)); Optional<DBServiceGroup> dbsg = serviceGroupDao.findServiceGroup(TEST_SG_ID_2, TEST_SG_SCHEMA_2); assertTrue(dbsg.isPresent()); // test if exists - String extension = dbsg.get().getExtension(); // test if exists - String newExtension = ExtensionConverter.marshalExtensions(inServiceGroup.getExtensions()); + byte[] extension = dbsg.get().getExtension(); // test if exists + byte[] newExtension = ExtensionConverter.marshalExtensions(inServiceGroup.getExtensions()); assertNotEquals(extension, newExtension); // extension updated // when @@ -126,7 +127,7 @@ public class ServiceGroupServiceMultipleDomainsIntegrationTest extends AbstractS assertEquals(TEST_DOMAIN_CODE_1, dbServiceGroup.getServiceGroupDomains().get(0).getDomain().getDomainCode()); assertEquals(inServiceGroup.getParticipantIdentifier().getValue(), dbServiceGroup.getParticipantIdentifier()); assertEquals(inServiceGroup.getParticipantIdentifier().getScheme(), dbServiceGroup.getParticipantScheme()); - assertEquals(newExtension, dbServiceGroup.getExtension()); // extension updated + assertTrue(Arrays.equals(newExtension, dbServiceGroup.getExtension())); // extension updated } @Test diff --git a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/services/ServiceGroupServiceSingleDomainIntegrationTest.java b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/services/ServiceGroupServiceSingleDomainIntegrationTest.java index 7c09124e6..a0ed9b02e 100644 --- a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/services/ServiceGroupServiceSingleDomainIntegrationTest.java +++ b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/services/ServiceGroupServiceSingleDomainIntegrationTest.java @@ -32,6 +32,7 @@ import org.springframework.transaction.annotation.Transactional; import javax.xml.bind.JAXBException; import javax.xml.stream.XMLStreamException; import java.io.IOException; +import java.util.Arrays; import java.util.List; import java.util.Optional; @@ -111,9 +112,9 @@ public class ServiceGroupServiceSingleDomainIntegrationTest extends AbstractServ DBDomain domain = domainDao.getTheOnlyDomain().get(); assertNotNull(domain); - String extension = dbsg.get().getExtension(); // test if exists - String newExtension = ExtensionConverter.marshalExtensions(inServiceGroup.getExtensions()); - assertNotEquals(extension, newExtension); // extension updated + byte[] extension = dbsg.get().getExtension(); // test if exists + byte[] newExtension = ExtensionConverter.marshalExtensions(inServiceGroup.getExtensions()); + assertFalse(Arrays.equals(extension, newExtension)); // extension updated // when boolean bCreated = testInstance.saveServiceGroup(inServiceGroup, domain.getDomainCode(), TestConstants.USERNAME_1, diff --git a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/services/ServiceMetadataIntegrationTest.java b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/services/ServiceMetadataIntegrationTest.java index 5ad0f7b55..b05922b30 100644 --- a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/services/ServiceMetadataIntegrationTest.java +++ b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/services/ServiceMetadataIntegrationTest.java @@ -55,13 +55,13 @@ import javax.persistence.PersistenceContext; import javax.xml.bind.JAXBException; import javax.xml.transform.TransformerException; import java.io.IOException; +import java.util.Arrays; import java.util.List; import java.util.Optional; import static eu.europa.ec.edelivery.smp.conversion.ServiceMetadataConverter.unmarshal; import static eu.europa.ec.edelivery.smp.testutil.TestConstants.*; -import static eu.europa.ec.edelivery.smp.testutil.XmlTestUtils.loadDocumentAsString; -import static eu.europa.ec.edelivery.smp.testutil.XmlTestUtils.marshall; +import static eu.europa.ec.edelivery.smp.testutil.XmlTestUtils.*; import static eu.europa.ec.smp.api.Identifiers.asDocumentId; import static eu.europa.ec.smp.api.Identifiers.asParticipantId; import static org.junit.Assert.*; @@ -107,8 +107,8 @@ public class ServiceMetadataIntegrationTest extends AbstractServiceIntegrationTe //given - String inServiceMetadataXml = loadDocumentAsString(SERVICE_METADATA_XML_PATH); - String expectedSignedServiceMetadataXml = loadDocumentAsString(SIGNED_SERVICE_METADATA_XML_PATH); + byte[] inServiceMetadataXml = loadDocumentAsByteArray(SERVICE_METADATA_XML_PATH); + byte[] expectedSignedServiceMetadataXml = loadDocumentAsByteArray(SIGNED_SERVICE_METADATA_XML_PATH); List<DocumentIdentifier> docIdsBefore = testInstance.findServiceMetadataIdentifiers(PT_ID); assertEquals(0, docIdsBefore.size()); @@ -121,7 +121,7 @@ public class ServiceMetadataIntegrationTest extends AbstractServiceIntegrationTe assertEquals(1, docIdsAfter.size()); assertEquals(DOC_ID.getValue().toLowerCase(), docIdsAfter.get(0).getValue()); // normalized assertEquals(DOC_ID.getScheme().toLowerCase(), docIdsAfter.get(0).getScheme()); // normalized - assertEquals(expectedSignedServiceMetadataXml, ServiceMetadataConverter.toString(outServiceMetadataDoc)); + assertTrue(Arrays.equals(expectedSignedServiceMetadataXml, ServiceMetadataConverter.toByteArray(outServiceMetadataDoc) )); } @Test @@ -148,7 +148,7 @@ public class ServiceMetadataIntegrationTest extends AbstractServiceIntegrationTe @Test public void saveAndDeletePositiveScenario() throws IOException { //given - String inServiceMetadataXml = loadDocumentAsString(SERVICE_METADATA_XML_PATH); + byte[] inServiceMetadataXml = loadDocumentAsByteArray(SERVICE_METADATA_XML_PATH); testInstance.saveServiceMetadata(null, PT_ID, DOC_ID, inServiceMetadataXml); List<DocumentIdentifier> docIdsBefore = testInstance.findServiceMetadataIdentifiers(PT_ID); assertEquals(1, docIdsBefore.size()); @@ -174,13 +174,13 @@ public class ServiceMetadataIntegrationTest extends AbstractServiceIntegrationTe @Test public void updatePositiveScenario() throws IOException, JAXBException, TransformerException { //given - String oldServiceMetadataXml = loadDocumentAsString(SERVICE_METADATA_XML_PATH); + byte[] oldServiceMetadataXml = loadDocumentAsByteArray(SERVICE_METADATA_XML_PATH); testInstance.saveServiceMetadata(null, PT_ID, DOC_ID, oldServiceMetadataXml); - ServiceMetadata newServiceMetadata = unmarshal(loadDocumentAsString(SERVICE_METADATA_XML_PATH)); + ServiceMetadata newServiceMetadata = unmarshal(loadDocumentAsByteArray(SERVICE_METADATA_XML_PATH)); EndpointType endpoint = newServiceMetadata.getServiceInformation().getProcessList().getProcesses().get(0).getServiceEndpointList().getEndpoints().get(0); endpoint.setServiceDescription("New Description"); - String newServiceMetadataXml = marshall(newServiceMetadata); + byte[] newServiceMetadataXml = marshallToByteArray(newServiceMetadata); testInstance.saveServiceMetadata(null, PT_ID, DOC_ID, newServiceMetadataXml); //when @@ -193,14 +193,14 @@ public class ServiceMetadataIntegrationTest extends AbstractServiceIntegrationTe @Test public void findServiceMetadataIdsPositiveScenario() throws IOException, JAXBException, TransformerException { //given - String serviceMetadataXml1 = loadDocumentAsString(SERVICE_METADATA_XML_PATH); + byte[] serviceMetadataXml1 = loadDocumentAsByteArray(SERVICE_METADATA_XML_PATH); testInstance.saveServiceMetadata(null, PT_ID, DOC_ID, serviceMetadataXml1); String secondDocIdValue = "second-doc-id"; DocumentIdentifier secondDocId = new DocumentIdentifier(secondDocIdValue, DOC_ID.getScheme()); - ServiceMetadata serviceMetadata2 = unmarshal(loadDocumentAsString(SERVICE_METADATA_XML_PATH)); + ServiceMetadata serviceMetadata2 = unmarshal(loadDocumentAsByteArray(SERVICE_METADATA_XML_PATH)); serviceMetadata2.getServiceInformation().getDocumentIdentifier().setValue(secondDocIdValue); - String serviceMetadataXml2 = marshall(serviceMetadata2); + byte[] serviceMetadataXml2 = marshallToByteArray(serviceMetadata2); testInstance.saveServiceMetadata(null, PT_ID, secondDocId, serviceMetadataXml2); //when diff --git a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/testutil/DBAssertion.java b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/testutil/DBAssertion.java index 7401b6cdc..52788ec90 100644 --- a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/testutil/DBAssertion.java +++ b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/testutil/DBAssertion.java @@ -6,6 +6,7 @@ import eu.europa.ec.edelivery.smp.data.model.DBServiceGroupDomain; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.annotation.Transactional; +import java.util.Arrays; import java.util.Optional; import static org.junit.Assert.assertEquals; @@ -39,13 +40,13 @@ public class DBAssertion { } @Transactional - public void assertServiceGroupExtensionEqual(String partId, String partSchema, String expectedExt){ - String ext = getExtensionForServiceGroup(partId, partSchema); - assertEquals(expectedExt,ext); + public void assertServiceGroupExtensionEqual(String partId, String partSchema, byte[] expectedExt){ + byte[] ext = getExtensionForServiceGroup(partId, partSchema); + assertTrue(Arrays.equals(expectedExt,ext)); } @Transactional - public String getExtensionForServiceGroup(String partId, String partSchema){ + public byte[] getExtensionForServiceGroup(String partId, String partSchema){ DBServiceGroup sg= serviceGroupDao.findServiceGroup(partId, partSchema).get(); return sg.getExtension(); } diff --git a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/testutil/TestDBUtils.java b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/testutil/TestDBUtils.java index cac56e2c0..357dbf742 100644 --- a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/testutil/TestDBUtils.java +++ b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/testutil/TestDBUtils.java @@ -45,11 +45,11 @@ public class TestDBUtils { return grp; } - public static String generateDocumentSample(String partcId, String partcSch, String docId, String docSch, String desc){ - return String.format(SIMPLE_DOCUMENT_XML,partcSch, partcId,docSch, docId, desc); + public static byte[] generateDocumentSample(String partcId, String partcSch, String docId, String docSch, String desc){ + return String.format(SIMPLE_DOCUMENT_XML,partcSch, partcId,docSch, docId, desc).getBytes(); } - public static String generateExtension(){ - return String.format(SIMPLE_EXTENSION_XML, UUID.randomUUID().toString()); + public static byte[] generateExtension(){ + return String.format(SIMPLE_EXTENSION_XML, UUID.randomUUID().toString()).getBytes(); } public static DBServiceGroup createDBServiceGroup(String id, String sch) { diff --git a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/testutil/XmlTestUtils.java b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/testutil/XmlTestUtils.java index 7201c7729..2d7b12079 100644 --- a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/testutil/XmlTestUtils.java +++ b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/testutil/XmlTestUtils.java @@ -40,6 +40,11 @@ public class XmlTestUtils { private static final String UTF_8 = "UTF-8"; + public static byte[] loadDocumentAsByteArray(String docResourcePath) throws IOException { + InputStream inputStream = XmlTestUtils.class.getResourceAsStream(docResourcePath); + return IOUtils.toByteArray(inputStream); + } + public static String loadDocumentAsString(String docResourcePath) throws IOException { InputStream inputStream = XmlTestUtils.class.getResourceAsStream(docResourcePath); return IOUtils.toString(inputStream, UTF_8); @@ -63,6 +68,21 @@ public class XmlTestUtils { trans.transform(new DOMSource(doc), new StreamResult(stream)); return stream.toString(UTF_8); } + public static byte[] marshallToByteArray(Node doc) throws TransformerException, UnsupportedEncodingException { + TransformerFactory tf = TransformerFactory.newInstance(); + Transformer trans = tf.newTransformer(); + ByteArrayOutputStream stream = new ByteArrayOutputStream(); + trans.transform(new DOMSource(doc), new StreamResult(stream)); + return stream.toByteArray(); + } + + public static byte[] marshallToByteArray(ServiceMetadata serviceMetadata) throws JAXBException { + ByteArrayOutputStream stream = new ByteArrayOutputStream(); + JAXBContext jaxbContext = JAXBContext.newInstance(ServiceMetadata.class); + Marshaller jaxbMarshaller = jaxbContext.createMarshaller(); + jaxbMarshaller.marshal(serviceMetadata, stream); + return stream.toByteArray(); + } public static String marshall(ServiceMetadata serviceMetadata) throws JAXBException { StringWriter sw = new StringWriter(); diff --git a/smp-soapui-tests/pom.xml b/smp-soapui-tests/pom.xml index d0a5623e6..62e6f7294 100644 --- a/smp-soapui-tests/pom.xml +++ b/smp-soapui-tests/pom.xml @@ -13,7 +13,7 @@ <description>Interation tests suit for SMP</description> <properties> - <url>http://localhost:8080/cipa-smp-full-webapp</url> + <url>http://localhost:8080/smp</url> </properties> <build> @@ -51,7 +51,9 @@ <testFailIgnore>true</testFailIgnore> <projectFile>${project.basedir}/soapui/SMP4.0-Generic-soapui-project.xml</projectFile> <testSuite>PASSING_AUTO_BAMBOO</testSuite> - <!--If you want to execute single test case <testCase>SMP001-Create ServiceGroup-Basic Flow-Admin Service Group specified</testCase>--> + <!--If you want to execute single test case <testCase>SMP001-Create ServiceGroup-Basic Flow-Admin Service Group specified</testCase>--> + <testCase>SMP078-Basic Flow-UTF-8 in Body</testCase> + <projectProperties> <value>url=${url}</value> </projectProperties> diff --git a/smp-soapui-tests/soapui/SMP4.0-Generic-soapui-project.xml b/smp-soapui-tests/soapui/SMP4.0-Generic-soapui-project.xml index 8a2754cdb..2651b5533 100644 --- a/smp-soapui-tests/soapui/SMP4.0-Generic-soapui-project.xml +++ b/smp-soapui-tests/soapui/SMP4.0-Generic-soapui-project.xml @@ -4140,7 +4140,7 @@ testRunner.testCase.testSteps['Delete ServiceGroup'].run(testRunner, context); <con:entry key="ParticipantIdentifierScheme" value="${Put ServiceGroup#ParticipantIdentifierScheme}"/> <con:entry key="ParticipantIdentifier" value="${Put ServiceGroup#ParticipantIdentifier}"/> </con:parameters></con:restRequest></con:config></con:testStep><con:testStep type="restrequest" name="TEST1 Get ServiceMetadata" id="53dc28c2-61ac-4f9c-82e9-0d0f5167348f"><con:settings/><con:config service="SMP" resourcePath="/{ParticipantIdentifierScheme}::{ParticipantIdentifier}/services/{DocTypeIdentifierScheme}::{DocTypeIdentifier}" methodName="GET ServiceMetadata" xsi:type="con:RestRequestStep" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><con:restRequest name="TEST1 Get ServiceMetadata" mediaType="application/xml" id="798e6729-3cf8-44b5-8fc7-f19165c82521"><con:settings><con:setting id="com.eviware.soapui.impl.wsdl.WsdlRequest@request-headers"><xml-fragment/></con:setting></con:settings><con:endpoint>${#Project#url}</con:endpoint><con:request/><con:originalUri>http://wltdgt02.cc.cec.eu.int/cipa-smp-full-webapp/ehealth-actorid-notqns::0088:7770010100777/services/busdox-docid-qns%3A%3Aurn%3Aoasis%3Anames%3Aspecification%3Aubl%3Aschema%3Axsd%3AInvoice-001%3A%3AInvoice%23%23UBL-2.0</con:originalUri><con:assertion type="Valid HTTP Status Codes" id="11e586ff-c74a-4e68-8db6-4bb76f2ce6b5" name="Valid HTTP Status Codes"><con:configuration><codes>404</codes></con:configuration></con:assertion><con:assertion type="Simple Contains" id="1fb97c35-e5e2-43a8-b2ef-872d7c82f070" name="Contains"><con:configuration><token><BusinessCode>NOT_FOUND</BusinessCode> -</token><ignoreCase>false</ignoreCase><useRegEx>false</useRegEx></con:configuration></con:assertion><con:assertion type="Simple Contains" id="ab7ce4b3-7b75-4ffa-84a4-1e0d5dc6ac16" name="Contains 2"><con:configuration><token>ServiceMetadata not found, ServiceGroupID</token><ignoreCase>false</ignoreCase><useRegEx>false</useRegEx></con:configuration></con:assertion><con:credentials><con:selectedAuthProfile>Basic</con:selectedAuthProfile><con:addedBasicAuthenticationTypes>Basic</con:addedBasicAuthenticationTypes><con:preemptive>true</con:preemptive><con:authType>Preemptive</con:authType></con:credentials><con:jmsConfig JMSDeliveryMode="PERSISTENT"/><con:jmsPropertyConfig/><con:parameters><entry key="ParticipantIdentifierScheme" value="ehealth-actorid-notqns" xmlns="http://eviware.com/soapui/config"/></con:parameters></con:restRequest></con:config></con:testStep><con:testStep type="restrequest" name="TEST2 Get ServiceMetadata" id="6345da91-ae27-4596-810d-3b21ed003cc7"><con:settings/><con:config service="SMP" resourcePath="/{ParticipantIdentifierScheme}::{ParticipantIdentifier}/services/{DocTypeIdentifierScheme}::{DocTypeIdentifier}" methodName="GET ServiceMetadata" xsi:type="con:RestRequestStep" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><con:restRequest name="TEST2 Get ServiceMetadata" mediaType="application/xml" id="798e6729-3cf8-44b5-8fc7-f19165c82521"><con:settings><con:setting id="com.eviware.soapui.impl.wsdl.WsdlRequest@request-headers"><xml-fragment/></con:setting></con:settings><con:endpoint>${#Project#url}</con:endpoint><con:request/><con:originalUri>http://wltdgt02.cc.cec.eu.int/cipa-smp-full-webapp/ehealth-actorid-qns::0088:7770010100778/services/busdox-docid-qns%3A%3Aurn%3Aoasis%3Anames%3Aspecification%3Aubl%3Aschema%3Axsd%3AInvoice-001%3A%3AInvoice%23%23UBL-2.0</con:originalUri><con:assertion type="Valid HTTP Status Codes" id="9d8ac797-ee8e-4a0d-8de0-8525cc959d38" name="Valid HTTP Status Codes"><con:configuration><codes>404</codes></con:configuration></con:assertion><con:assertion type="Simple Contains" id="ab058fbd-e7b7-42bc-8c1b-77acbbbb8e78" name="Contains"><con:configuration><token><BusinessCode>NOT_FOUND</BusinessCode></token><ignoreCase>false</ignoreCase><useRegEx>false</useRegEx></con:configuration></con:assertion><con:assertion type="Simple Contains" id="c5826191-f3ed-4f75-851d-27425aed964e"><con:configuration/></con:assertion><con:assertion type="Simple Contains" id="5439e706-ba6c-43f5-8275-d6fc9a5c3a2e" name="Contains 2"><con:configuration><token>ServiceMetadata not found, ServiceGroupID</token><ignoreCase>false</ignoreCase><useRegEx>false</useRegEx></con:configuration></con:assertion><con:credentials><con:selectedAuthProfile>Basic</con:selectedAuthProfile><con:addedBasicAuthenticationTypes>Basic</con:addedBasicAuthenticationTypes><con:preemptive>true</con:preemptive><con:authType>Preemptive</con:authType></con:credentials><con:jmsConfig JMSDeliveryMode="PERSISTENT"/><con:jmsPropertyConfig/><con:parameters><entry key="ParticipantIdentifier" value="2:${Put ServiceGroup#ParticipantIdentifier}" xmlns="http://eviware.com/soapui/config"/></con:parameters></con:restRequest></con:config></con:testStep><con:testStep type="restrequest" name="TEST3 Get ServiceMetadata" id="7ee41886-f9b8-46d9-b05a-f320524d75ec"><con:settings/><con:config service="SMP" resourcePath="/{ParticipantIdentifierScheme}::{ParticipantIdentifier}/services/{DocTypeIdentifierScheme}::{DocTypeIdentifier}" methodName="GET ServiceMetadata" xsi:type="con:RestRequestStep" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><con:restRequest name="TEST3 Get ServiceMetadata" mediaType="application/xml" id="798e6729-3cf8-44b5-8fc7-f19165c82521"><con:settings><con:setting id="com.eviware.soapui.impl.wsdl.WsdlRequest@request-headers"><xml-fragment/></con:setting></con:settings><con:endpoint>${#Project#url}</con:endpoint><con:request/><con:originalUri>http://wltdgt02.cc.cec.eu.int/cipa-smp-full-webapp/ehealth-actorid-qns::0088:7770010100777/services/busdox-docid-qns%3A%3Aurn%3Aoasis%3Anames%3Aspecification%3Aubl%3Aschema%3Axsd%3ACredit-001%3A%3AInvoice%23%23UBL-2.0</con:originalUri><con:assertion type="Valid HTTP Status Codes" id="7c7a9439-7238-4e3a-926a-1640ebbc816a" name="Valid HTTP Status Codes"><con:configuration><codes>404</codes></con:configuration></con:assertion><con:assertion type="Simple Contains" id="6a2279a7-1eab-4d51-ae3d-2f4dc517ad1a" name="Contains"><con:configuration><token><BusinessCode>NOT_FOUND</BusinessCode></token><ignoreCase>false</ignoreCase><useRegEx>false</useRegEx></con:configuration></con:assertion><con:assertion type="Simple Contains" id="c3fc33a2-006e-4e22-801f-2a88de66e338"><con:configuration/></con:assertion><con:assertion type="Simple Contains" id="6cf991ee-ba21-4809-a947-91c8d3f70d5a" name="Contains 2"><con:configuration><token>ServiceMetadata not found, ServiceGroupID</token><ignoreCase>false</ignoreCase><useRegEx>false</useRegEx></con:configuration></con:assertion><con:credentials><con:selectedAuthProfile>Basic</con:selectedAuthProfile><con:addedBasicAuthenticationTypes>Basic</con:addedBasicAuthenticationTypes><con:preemptive>true</con:preemptive><con:authType>Preemptive</con:authType></con:credentials><con:jmsConfig JMSDeliveryMode="PERSISTENT"/><con:jmsPropertyConfig/><con:parameters><entry key="DocTypeIdentifierScheme" value="busdox-docid-qns2" xmlns="http://eviware.com/soapui/config"/></con:parameters></con:restRequest></con:config></con:testStep><con:testStep type="restrequest" name="TEST4 Get ServiceMetadata" id="9a110fcf-c5fa-4898-8ac7-f0a50b8fb976"><con:settings/><con:config service="SMP" resourcePath="/{ParticipantIdentifierScheme}::{ParticipantIdentifier}/services/{DocTypeIdentifierScheme}::{DocTypeIdentifier}" methodName="GET ServiceMetadata" xsi:type="con:RestRequestStep" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><con:restRequest name="TEST4 Get ServiceMetadata" mediaType="application/xml" id="798e6729-3cf8-44b5-8fc7-f19165c82521"><con:settings><con:setting id="com.eviware.soapui.impl.wsdl.WsdlRequest@request-headers"><xml-fragment/></con:setting></con:settings><con:endpoint>${#Project#url}</con:endpoint><con:request/><con:originalUri>http://wltdgt02.cc.cec.eu.int/cipa-smp-full-webapp/ehealth-actorid-qns::0088:7770010100777/services/busnotdox-docid-qns%3A%3Aurn%3Aoasis%3Anames%3Aspecification%3Aubl%3Aschema%3Axsd%3AInvoice-001%3A%3AInvoice%23%23UBL-2.0</con:originalUri><con:assertion type="Valid HTTP Status Codes" id="086ed54d-13c3-4894-9ee3-ba6f1efa9850" name="Valid HTTP Status Codes"><con:configuration><codes>404</codes></con:configuration></con:assertion><con:assertion type="Simple Contains" id="742b6828-e27c-4fcd-9d2e-2411ef59fd29" name="Contains"><con:configuration><token><BusinessCode>NOT_FOUND</BusinessCode></token><ignoreCase>false</ignoreCase><useRegEx>false</useRegEx></con:configuration></con:assertion><con:assertion type="Simple Contains" id="f9496979-fbcc-46b7-bd75-e849aff153bb" name="Contains 2"><con:configuration><token>ServiceMetadata not found, ServiceGroupID</token><ignoreCase>false</ignoreCase><useRegEx>false</useRegEx></con:configuration></con:assertion><con:credentials><con:selectedAuthProfile>Basic</con:selectedAuthProfile><con:addedBasicAuthenticationTypes>Basic</con:addedBasicAuthenticationTypes><con:preemptive>true</con:preemptive><con:authType>Preemptive</con:authType></con:credentials><con:jmsConfig JMSDeliveryMode="PERSISTENT"/><con:jmsPropertyConfig/><con:parameters><entry key="DocTypeIdentifier" value="urn:oasis:names:specification:ubl:schema:xsd:Invoice-001::Invoice##UBL-2.0" xmlns="http://eviware.com/soapui/config"/></con:parameters></con:restRequest></con:config></con:testStep><con:testStep type="restrequest" name="Delete ServiceMetadata" id="9c4809fa-622b-4d54-8741-9cf63c9dee6b" disabled="true"><con:settings/><con:config service="SMP" resourcePath="/{ParticipantIdentifierScheme}::{ParticipantIdentifier}/services/{DocTypeIdentifierScheme}::{DocTypeIdentifier}" methodName="DELETE ServiceMetadata" xsi:type="con:RestRequestStep" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><con:restRequest name="Delete ServiceMetadata" mediaType="application/xml" id="cfe391c2-9084-45a5-a637-fbbc25a25f27" postQueryString="false"><con:settings><con:setting id="com.eviware.soapui.impl.wsdl.WsdlRequest@request-headers"><xml-fragment/></con:setting></con:settings><con:endpoint>${#Project#url}</con:endpoint><con:request/><con:originalUri>http://wltdgt02.cc.cec.eu.int/cipa-smp-full-webapp/ehealth-actorid-qns%3A%3A0088%3A7770010100777/services/busdox-docid-qns%3A%3Aurn%3Aoasis%3Anames%3Aspecification%3Aubl%3Aschema%3Axsd%3AInvoice-001%3A%3AInvoice%23%23UBL-2.0</con:originalUri><con:assertion type="Valid HTTP Status Codes" id="455c1564-1956-4339-895f-e11e6d2fd416" name="Valid HTTP Status Codes"><con:configuration><codes>200</codes></con:configuration></con:assertion><con:credentials><con:username>AdminSMP1TEST</con:username><con:password>adminsmp1test</con:password><con:selectedAuthProfile>Basic</con:selectedAuthProfile><con:addedBasicAuthenticationTypes>Basic</con:addedBasicAuthenticationTypes><con:preemptive>true</con:preemptive><con:authType>Preemptive</con:authType></con:credentials><con:jmsConfig JMSDeliveryMode="PERSISTENT"/><con:jmsPropertyConfig/><con:parameters/></con:restRequest></con:config></con:testStep><con:testStep type="restrequest" name="Delete ServiceGroup" id="1b09e015-a095-438c-ae63-eedcfc4785a0" disabled="true"><con:settings/><con:config service="SMP" resourcePath="/{ParticipantIdentifierScheme}::{ParticipantIdentifier}" methodName="DELETE ServiceGroup" xsi:type="con:RestRequestStep" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><con:restRequest name="Delete ServiceGroup" mediaType="application/xml" id="a97cde56-8e9c-4d6f-b950-faf82b0268e9" postQueryString="false"><con:settings><con:setting id="com.eviware.soapui.impl.wsdl.WsdlRequest@request-headers"><xml-fragment/></con:setting></con:settings><con:endpoint>${#Project#url}</con:endpoint><con:request/><con:originalUri>http://wltdgt02.cc.cec.eu.int/cipa-smp-full-webapp/ehealth-actorid-qns::0088:7770010100777</con:originalUri><con:assertion type="Valid HTTP Status Codes" id="995ce00d-f14d-4f50-9e8f-1639849557bd" name="Valid HTTP Status Codes"><con:configuration><codes>200</codes></con:configuration></con:assertion><con:credentials><con:username>AdminSMP1TEST</con:username><con:password>adminsmp1test</con:password><con:selectedAuthProfile>Basic</con:selectedAuthProfile><con:addedBasicAuthenticationTypes>Basic</con:addedBasicAuthenticationTypes><con:preemptive>true</con:preemptive><con:authType>Preemptive</con:authType></con:credentials><con:jmsConfig JMSDeliveryMode="PERSISTENT"/><con:jmsPropertyConfig/><con:parameters> +</token><ignoreCase>false</ignoreCase><useRegEx>false</useRegEx></con:configuration></con:assertion><con:assertion type="Simple Contains" id="ab7ce4b3-7b75-4ffa-84a4-1e0d5dc6ac16" name="Contains 2"><con:configuration><token>ServiceMetadata not found</token><ignoreCase>false</ignoreCase><useRegEx>false</useRegEx></con:configuration></con:assertion><con:credentials><con:selectedAuthProfile>Basic</con:selectedAuthProfile><con:addedBasicAuthenticationTypes>Basic</con:addedBasicAuthenticationTypes><con:preemptive>true</con:preemptive><con:authType>Preemptive</con:authType></con:credentials><con:jmsConfig JMSDeliveryMode="PERSISTENT"/><con:jmsPropertyConfig/><con:parameters><entry key="ParticipantIdentifierScheme" value="ehealth-actorid-notqns" xmlns="http://eviware.com/soapui/config"/></con:parameters></con:restRequest></con:config></con:testStep><con:testStep type="restrequest" name="TEST2 Get ServiceMetadata" id="6345da91-ae27-4596-810d-3b21ed003cc7"><con:settings/><con:config service="SMP" resourcePath="/{ParticipantIdentifierScheme}::{ParticipantIdentifier}/services/{DocTypeIdentifierScheme}::{DocTypeIdentifier}" methodName="GET ServiceMetadata" xsi:type="con:RestRequestStep" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><con:restRequest name="TEST2 Get ServiceMetadata" mediaType="application/xml" id="798e6729-3cf8-44b5-8fc7-f19165c82521"><con:settings><con:setting id="com.eviware.soapui.impl.wsdl.WsdlRequest@request-headers"><xml-fragment/></con:setting></con:settings><con:endpoint>${#Project#url}</con:endpoint><con:request/><con:originalUri>http://wltdgt02.cc.cec.eu.int/cipa-smp-full-webapp/ehealth-actorid-qns::0088:7770010100778/services/busdox-docid-qns%3A%3Aurn%3Aoasis%3Anames%3Aspecification%3Aubl%3Aschema%3Axsd%3AInvoice-001%3A%3AInvoice%23%23UBL-2.0</con:originalUri><con:assertion type="Valid HTTP Status Codes" id="9d8ac797-ee8e-4a0d-8de0-8525cc959d38" name="Valid HTTP Status Codes"><con:configuration><codes>404</codes></con:configuration></con:assertion><con:assertion type="Simple Contains" id="ab058fbd-e7b7-42bc-8c1b-77acbbbb8e78" name="Contains"><con:configuration><token><BusinessCode>NOT_FOUND</BusinessCode></token><ignoreCase>false</ignoreCase><useRegEx>false</useRegEx></con:configuration></con:assertion><con:assertion type="Simple Contains" id="5439e706-ba6c-43f5-8275-d6fc9a5c3a2e" name="Contains 2"><con:configuration><token>ServiceMetadata not found</token><ignoreCase>false</ignoreCase><useRegEx>false</useRegEx></con:configuration></con:assertion><con:credentials><con:selectedAuthProfile>Basic</con:selectedAuthProfile><con:addedBasicAuthenticationTypes>Basic</con:addedBasicAuthenticationTypes><con:preemptive>true</con:preemptive><con:authType>Preemptive</con:authType></con:credentials><con:jmsConfig JMSDeliveryMode="PERSISTENT"/><con:jmsPropertyConfig/><con:parameters><entry key="ParticipantIdentifier" value="2:${Put ServiceGroup#ParticipantIdentifier}" xmlns="http://eviware.com/soapui/config"/></con:parameters></con:restRequest></con:config></con:testStep><con:testStep type="restrequest" name="TEST3 Get ServiceMetadata" id="7ee41886-f9b8-46d9-b05a-f320524d75ec"><con:settings/><con:config service="SMP" resourcePath="/{ParticipantIdentifierScheme}::{ParticipantIdentifier}/services/{DocTypeIdentifierScheme}::{DocTypeIdentifier}" methodName="GET ServiceMetadata" xsi:type="con:RestRequestStep" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><con:restRequest name="TEST3 Get ServiceMetadata" mediaType="application/xml" id="798e6729-3cf8-44b5-8fc7-f19165c82521"><con:settings><con:setting id="com.eviware.soapui.impl.wsdl.WsdlRequest@request-headers"><xml-fragment/></con:setting></con:settings><con:endpoint>${#Project#url}</con:endpoint><con:request/><con:originalUri>http://wltdgt02.cc.cec.eu.int/cipa-smp-full-webapp/ehealth-actorid-qns::0088:7770010100777/services/busdox-docid-qns%3A%3Aurn%3Aoasis%3Anames%3Aspecification%3Aubl%3Aschema%3Axsd%3ACredit-001%3A%3AInvoice%23%23UBL-2.0</con:originalUri><con:assertion type="Valid HTTP Status Codes" id="7c7a9439-7238-4e3a-926a-1640ebbc816a" name="Valid HTTP Status Codes"><con:configuration><codes>404</codes></con:configuration></con:assertion><con:assertion type="Simple Contains" id="6a2279a7-1eab-4d51-ae3d-2f4dc517ad1a" name="Contains"><con:configuration><token><BusinessCode>NOT_FOUND</BusinessCode></token><ignoreCase>false</ignoreCase><useRegEx>false</useRegEx></con:configuration></con:assertion><con:assertion type="Simple Contains" id="6cf991ee-ba21-4809-a947-91c8d3f70d5a" name="Contains 2"><con:configuration><token>ServiceMetadata not found</token><ignoreCase>false</ignoreCase><useRegEx>false</useRegEx></con:configuration></con:assertion><con:credentials><con:selectedAuthProfile>Basic</con:selectedAuthProfile><con:addedBasicAuthenticationTypes>Basic</con:addedBasicAuthenticationTypes><con:preemptive>true</con:preemptive><con:authType>Preemptive</con:authType></con:credentials><con:jmsConfig JMSDeliveryMode="PERSISTENT"/><con:jmsPropertyConfig/><con:parameters><entry key="DocTypeIdentifierScheme" value="busdox-docid-qns2" xmlns="http://eviware.com/soapui/config"/></con:parameters></con:restRequest></con:config></con:testStep><con:testStep type="restrequest" name="TEST4 Get ServiceMetadata" id="9a110fcf-c5fa-4898-8ac7-f0a50b8fb976"><con:settings/><con:config service="SMP" resourcePath="/{ParticipantIdentifierScheme}::{ParticipantIdentifier}/services/{DocTypeIdentifierScheme}::{DocTypeIdentifier}" methodName="GET ServiceMetadata" xsi:type="con:RestRequestStep" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><con:restRequest name="TEST4 Get ServiceMetadata" mediaType="application/xml" id="798e6729-3cf8-44b5-8fc7-f19165c82521"><con:settings><con:setting id="com.eviware.soapui.impl.wsdl.WsdlRequest@request-headers"><xml-fragment/></con:setting></con:settings><con:endpoint>${#Project#url}</con:endpoint><con:request/><con:originalUri>http://wltdgt02.cc.cec.eu.int/cipa-smp-full-webapp/ehealth-actorid-qns::0088:7770010100777/services/busnotdox-docid-qns%3A%3Aurn%3Aoasis%3Anames%3Aspecification%3Aubl%3Aschema%3Axsd%3AInvoice-001%3A%3AInvoice%23%23UBL-2.0</con:originalUri><con:assertion type="Valid HTTP Status Codes" id="086ed54d-13c3-4894-9ee3-ba6f1efa9850" name="Valid HTTP Status Codes"><con:configuration><codes>404</codes></con:configuration></con:assertion><con:assertion type="Simple Contains" id="742b6828-e27c-4fcd-9d2e-2411ef59fd29" name="Contains"><con:configuration><token><BusinessCode>NOT_FOUND</BusinessCode></token><ignoreCase>false</ignoreCase><useRegEx>false</useRegEx></con:configuration></con:assertion><con:assertion type="Simple Contains" id="f9496979-fbcc-46b7-bd75-e849aff153bb" name="Contains 2"><con:configuration><token>ServiceMetadata not found</token><ignoreCase>false</ignoreCase><useRegEx>false</useRegEx></con:configuration></con:assertion><con:credentials><con:selectedAuthProfile>Basic</con:selectedAuthProfile><con:addedBasicAuthenticationTypes>Basic</con:addedBasicAuthenticationTypes><con:preemptive>true</con:preemptive><con:authType>Preemptive</con:authType></con:credentials><con:jmsConfig JMSDeliveryMode="PERSISTENT"/><con:jmsPropertyConfig/><con:parameters><entry key="DocTypeIdentifier" value="urn:oasis:names:specification:ubl:schema:xsd:Invoice-001::Invoice##UBL-2.0" xmlns="http://eviware.com/soapui/config"/></con:parameters></con:restRequest></con:config></con:testStep><con:testStep type="restrequest" name="Delete ServiceMetadata" id="9c4809fa-622b-4d54-8741-9cf63c9dee6b" disabled="true"><con:settings/><con:config service="SMP" resourcePath="/{ParticipantIdentifierScheme}::{ParticipantIdentifier}/services/{DocTypeIdentifierScheme}::{DocTypeIdentifier}" methodName="DELETE ServiceMetadata" xsi:type="con:RestRequestStep" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><con:restRequest name="Delete ServiceMetadata" mediaType="application/xml" id="cfe391c2-9084-45a5-a637-fbbc25a25f27" postQueryString="false"><con:settings><con:setting id="com.eviware.soapui.impl.wsdl.WsdlRequest@request-headers"><xml-fragment/></con:setting></con:settings><con:endpoint>${#Project#url}</con:endpoint><con:request/><con:originalUri>http://wltdgt02.cc.cec.eu.int/cipa-smp-full-webapp/ehealth-actorid-qns%3A%3A0088%3A7770010100777/services/busdox-docid-qns%3A%3Aurn%3Aoasis%3Anames%3Aspecification%3Aubl%3Aschema%3Axsd%3AInvoice-001%3A%3AInvoice%23%23UBL-2.0</con:originalUri><con:assertion type="Valid HTTP Status Codes" id="455c1564-1956-4339-895f-e11e6d2fd416" name="Valid HTTP Status Codes"><con:configuration><codes>200</codes></con:configuration></con:assertion><con:credentials><con:username>AdminSMP1TEST</con:username><con:password>adminsmp1test</con:password><con:selectedAuthProfile>Basic</con:selectedAuthProfile><con:addedBasicAuthenticationTypes>Basic</con:addedBasicAuthenticationTypes><con:preemptive>true</con:preemptive><con:authType>Preemptive</con:authType></con:credentials><con:jmsConfig JMSDeliveryMode="PERSISTENT"/><con:jmsPropertyConfig/><con:parameters/></con:restRequest></con:config></con:testStep><con:testStep type="restrequest" name="Delete ServiceGroup" id="1b09e015-a095-438c-ae63-eedcfc4785a0" disabled="true"><con:settings/><con:config service="SMP" resourcePath="/{ParticipantIdentifierScheme}::{ParticipantIdentifier}" methodName="DELETE ServiceGroup" xsi:type="con:RestRequestStep" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><con:restRequest name="Delete ServiceGroup" mediaType="application/xml" id="a97cde56-8e9c-4d6f-b950-faf82b0268e9" postQueryString="false"><con:settings><con:setting id="com.eviware.soapui.impl.wsdl.WsdlRequest@request-headers"><xml-fragment/></con:setting></con:settings><con:endpoint>${#Project#url}</con:endpoint><con:request/><con:originalUri>http://wltdgt02.cc.cec.eu.int/cipa-smp-full-webapp/ehealth-actorid-qns::0088:7770010100777</con:originalUri><con:assertion type="Valid HTTP Status Codes" id="995ce00d-f14d-4f50-9e8f-1639849557bd" name="Valid HTTP Status Codes"><con:configuration><codes>200</codes></con:configuration></con:assertion><con:credentials><con:username>AdminSMP1TEST</con:username><con:password>adminsmp1test</con:password><con:selectedAuthProfile>Basic</con:selectedAuthProfile><con:addedBasicAuthenticationTypes>Basic</con:addedBasicAuthenticationTypes><con:preemptive>true</con:preemptive><con:authType>Preemptive</con:authType></con:credentials><con:jmsConfig JMSDeliveryMode="PERSISTENT"/><con:jmsPropertyConfig/><con:parameters> <con:entry key="ParticipantIdentifierScheme" value="${Put ServiceGroup#ParticipantIdentifierScheme}"/> <con:entry key="ParticipantIdentifier" value="${Put ServiceGroup#ParticipantIdentifier}"/> </con:parameters></con:restRequest></con:config></con:testStep><con:tearDownScript>// Run clean test steps. diff --git a/smp-webapp/pom.xml b/smp-webapp/pom.xml index 5d345e119..1071d7bee 100644 --- a/smp-webapp/pom.xml +++ b/smp-webapp/pom.xml @@ -98,7 +98,7 @@ <artifactId>hamcrest-junit</artifactId> <scope>test</scope> </dependency> - <dependency> + <!--dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-autoconfigure</artifactId> <version>RELEASE</version> @@ -109,7 +109,7 @@ <artifactId>spring-boot-autoconfigure</artifactId> <version>RELEASE</version> <scope>compile</scope> - </dependency> + </dependency--> </dependencies> <build> diff --git a/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/controllers/ServiceGroupController.java b/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/controllers/ServiceGroupController.java index 0a0e9b52a..191d410b6 100644 --- a/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/controllers/ServiceGroupController.java +++ b/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/controllers/ServiceGroupController.java @@ -13,6 +13,7 @@ package eu.europa.ec.edelivery.smp.controllers; +import eu.europa.ec.edelivery.smp.SMPRole; import eu.europa.ec.edelivery.smp.conversion.ServiceGroupConverter; import eu.europa.ec.edelivery.smp.services.ServiceGroupService; import eu.europa.ec.edelivery.smp.services.ServiceMetadataService; @@ -77,12 +78,12 @@ public class ServiceGroupController { @PutMapping - @Secured("ROLE_SMP_ADMIN") + // @Secured({SMPRole.S_ROLE_SMP_ADMIN, SMPRole.S_ROLE_SYSTEM_ADMIN}) public ResponseEntity saveServiceGroup( @PathVariable String serviceGroupId, @RequestHeader(name = "ServiceGroup-Owner", required = false) String serviceGroupOwner, @RequestHeader(name = "Domain", required = false) String domain, - @RequestBody String body) throws XmlInvalidAgainstSchemaException { + @RequestBody byte[] body) throws XmlInvalidAgainstSchemaException { log.info("PUT ServiceGroup: {} domain {} owner {} \n{}", serviceGroupId,domain, serviceGroupOwner, body); @@ -100,7 +101,7 @@ public class ServiceGroupController { } @DeleteMapping - @Secured("ROLE_SMP_ADMIN") + @Secured({SMPRole.S_ROLE_SYSTEM_ADMIN, SMPRole.S_ROLE_SMP_ADMIN}) public void deleteServiceGroup(@PathVariable String serviceGroupId) { log.info("DELETE ServiceGroup: {}", serviceGroupId); diff --git a/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/controllers/ServiceMetadataController.java b/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/controllers/ServiceMetadataController.java index a126dc466..7e3320773 100644 --- a/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/controllers/ServiceMetadataController.java +++ b/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/controllers/ServiceMetadataController.java @@ -69,7 +69,7 @@ public class ServiceMetadataController { @PathVariable String serviceGroupId, @PathVariable String serviceMetadataId, @RequestHeader(name = "Domain", required = false) String domain, - @RequestBody String body) throws XmlInvalidAgainstSchemaException { + @RequestBody byte[] body) throws XmlInvalidAgainstSchemaException { log.info("PUT ServiceMetadata: {} - {}\n{}", serviceGroupId, serviceMetadataId, body); diff --git a/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/error/ErrorMappingControllerAdvice.java b/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/error/ErrorMappingControllerAdvice.java index 910906ac6..fceb733ba 100644 --- a/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/error/ErrorMappingControllerAdvice.java +++ b/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/error/ErrorMappingControllerAdvice.java @@ -91,7 +91,7 @@ public class ErrorMappingControllerAdvice { @ExceptionHandler(XmlInvalidAgainstSchemaException.class) public ResponseEntity handleXmlInvalidAgainstSchemaException(XmlInvalidAgainstSchemaException ex) { - return buildAndWarn(BAD_REQUEST, XML_INVALID, ex.getMessage(), ex); + return buildAndWarn(BAD_REQUEST, XSD_INVALID, ex.getMessage(), ex); } diff --git a/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/error/SpringSecurityExceptionHandler.java b/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/error/SpringSecurityExceptionHandler.java index 0629acafc..7d8418e8c 100644 --- a/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/error/SpringSecurityExceptionHandler.java +++ b/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/error/SpringSecurityExceptionHandler.java @@ -54,7 +54,7 @@ public class SpringSecurityExceptionHandler extends BasicAuthenticationEntryPoin AuthenticationException authException) throws IOException, ServletException { String errorMsg = authException.getMessage(); if(authException instanceof BadCredentialsException){ - errorMsg += " - Provided username/password or client certificate is invalid"; + errorMsg += " - Provided username/password or client certificate are invalid"; } handle(response, authException, errorMsg); } diff --git a/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/validation/ServiceMetadataValidator.java b/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/validation/ServiceMetadataValidator.java index 20216417a..219fe5922 100644 --- a/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/validation/ServiceMetadataValidator.java +++ b/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/validation/ServiceMetadataValidator.java @@ -40,7 +40,7 @@ public class ServiceMetadataValidator { public void validate(String serviceGroupIdStr, String serviceMetadataIdStr, - String serviceMetadataBody + byte[] serviceMetadataBody ) throws XmlInvalidAgainstSchemaException { BdxSmpOasisValidator.validateXSD(serviceMetadataBody); diff --git a/smp-webapp/src/main/resources/spring-security.xml b/smp-webapp/src/main/resources/spring-security.xml index 96a632bd2..1c1797de5 100644 --- a/smp-webapp/src/main/resources/spring-security.xml +++ b/smp-webapp/src/main/resources/spring-security.xml @@ -40,8 +40,8 @@ <password-encoder hash="bcrypt"/> <jdbc-user-service id="smpJdbcUserDetailsService" data-source-ref="dataSource" - users-by-username-query="SELECT USERNAME, COALESCE(PASSWORD, 'dummy'), ACTIVE FROM SMP_USER WHERE USERNAME = ?" - authorities-by-username-query="SELECT all_roles.USERNAME, all_roles.authority from ( SELECT USERNAME, 'ROLE_SERVICEGROUP_ADMIN' AS AUTHORITY FROM SMP_USER UNION ALL SELECT USERNAME, 'ROLE_SMP_ADMIN' AS AUTHORITY FROM SMP_USER WHERE ROLE = 'ROLE_SMP_ADMIN') all_roles WHERE USERNAME = ?"/> + users-by-username-query="SELECT username, COALESCE(PASSWORD, 'dummy'), ACTIVE FROM SMP_USER WHERE USERNAME = ?" + authorities-by-username-query="select username, ROLE FROM SMP_USER where USERNAME = ?"/> </authentication-provider> <authentication-provider ref="preauthAuthProvider"/> diff --git a/smp-webapp/src/main/smp-setup/database-scripts/mysql5innodb-4.1.0-SNAPSHOT.ddl b/smp-webapp/src/main/smp-setup/database-scripts/mysql5innodb-4.1.0-SNAPSHOT.ddl index c7d9c708c..28362d52d 100644 --- a/smp-webapp/src/main/smp-setup/database-scripts/mysql5innodb-4.1.0-SNAPSHOT.ddl +++ b/smp-webapp/src/main/smp-setup/database-scripts/mysql5innodb-4.1.0-SNAPSHOT.ddl @@ -149,7 +149,7 @@ create table SMP_SERVICE_METADATA_XML ( ID bigint not null, - XML_CONTENT longtext, + XML_CONTENT longblob, primary key (ID) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; @@ -157,13 +157,13 @@ ID bigint not null, REV bigint not null, REVTYPE tinyint, - XML_CONTENT longtext, + XML_CONTENT longblob, primary key (ID, REV) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; create table SMP_SG_EXTENSION ( ID bigint not null, - EXTENSION longtext, + EXTENSION longblob, primary key (ID) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; @@ -171,7 +171,7 @@ ID bigint not null, REV bigint not null, REVTYPE tinyint, - EXTENSION longtext, + EXTENSION longblob, primary key (ID, REV) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; diff --git a/smp-webapp/src/main/smp-setup/database-scripts/oracle10g-4.1.0-SNAPSHOT.ddl b/smp-webapp/src/main/smp-setup/database-scripts/oracle10g-4.1.0-SNAPSHOT.ddl index a75783766..d4839da83 100644 --- a/smp-webapp/src/main/smp-setup/database-scripts/oracle10g-4.1.0-SNAPSHOT.ddl +++ b/smp-webapp/src/main/smp-setup/database-scripts/oracle10g-4.1.0-SNAPSHOT.ddl @@ -125,7 +125,7 @@ create sequence SMP_USER_SEQ start with 1 increment by 50; create table SMP_SERVICE_METADATA_XML ( ID number(19,0) not null, - XML_CONTENT clob, + XML_CONTENT blob, primary key (ID) ); @@ -133,13 +133,13 @@ create sequence SMP_USER_SEQ start with 1 increment by 50; ID number(19,0) not null, REV number(19,0) not null, REVTYPE number(3,0), - XML_CONTENT clob, + XML_CONTENT blob, primary key (ID, REV) ); create table SMP_SG_EXTENSION ( ID number(19,0) not null, - EXTENSION clob, + EXTENSION blob, primary key (ID) ); @@ -147,7 +147,7 @@ create sequence SMP_USER_SEQ start with 1 increment by 50; ID number(19,0) not null, REV number(19,0) not null, REVTYPE number(3,0), - EXTENSION clob, + EXTENSION blob, primary key (ID, REV) ); diff --git a/smp-webapp/src/test/java/eu/europa/ec/cipa/smp/server/security/SecurityConfigurationTest.java b/smp-webapp/src/test/java/eu/europa/ec/cipa/smp/server/security/SecurityConfigurationTest.java index 4c095ba54..89edba85f 100644 --- a/smp-webapp/src/test/java/eu/europa/ec/cipa/smp/server/security/SecurityConfigurationTest.java +++ b/smp-webapp/src/test/java/eu/europa/ec/cipa/smp/server/security/SecurityConfigurationTest.java @@ -55,7 +55,7 @@ public class SecurityConfigurationTest { public static final String TEST_USERNAME_CLEAR_PASS = "test_user_clear_pass"; public static final String TEST_USERNAME_HASHED_PASS = "test_user_hashed_pass"; - public static final String PASSWORD = "gutek123"; + public static final String PASSWORD = "test123"; public static final String BLUE_COAT_VALID_HEADER = "sno=66&subject=C=BE,O=org,CN=comon name&validfrom=Dec 6 17:41:42 2016 GMT&validto=Jul 9 23:59:00 2050 GMT&issuer=C=x,O=y,CN=z"; public static final String TEST_USERNAME_BLUE_COAT = "CN=comon name,O=org,C=BE:0000000000000066"; diff --git a/smp-webapp/src/test/java/eu/europa/ec/cipa/smp/server/security/SignatureValidatorTest.java b/smp-webapp/src/test/java/eu/europa/ec/cipa/smp/server/security/SignatureValidatorTest.java index 01038950f..798157fb9 100644 --- a/smp-webapp/src/test/java/eu/europa/ec/cipa/smp/server/security/SignatureValidatorTest.java +++ b/smp-webapp/src/test/java/eu/europa/ec/cipa/smp/server/security/SignatureValidatorTest.java @@ -78,7 +78,7 @@ public class SignatureValidatorTest/* extends AbstractTest*/ { private static final String C14N_METHOD = CanonicalizationMethod.INCLUSIVE; private static final String PARSER_DISALLOW_DTD_PARSING_FEATURE = "http://apache.org/xml/features/disallow-doctype-decl"; - private static final RequestPostProcessor ADMIN_CREDENTIALS = httpBasic("test_admin", "gutek123"); + private static final RequestPostProcessor ADMIN_CREDENTIALS = httpBasic("test_admin", "test123"); @Autowired private WebApplicationContext webAppContext; diff --git a/smp-webapp/src/test/java/eu/europa/ec/edelivery/smp/controllers/ServiceGroupControllerTest.java b/smp-webapp/src/test/java/eu/europa/ec/edelivery/smp/controllers/ServiceGroupControllerTest.java index b2739cc4c..b94a7f311 100644 --- a/smp-webapp/src/test/java/eu/europa/ec/edelivery/smp/controllers/ServiceGroupControllerTest.java +++ b/smp-webapp/src/test/java/eu/europa/ec/edelivery/smp/controllers/ServiceGroupControllerTest.java @@ -73,7 +73,7 @@ public class ServiceGroupControllerTest { private static final String OTHER_OWNER_NAME_URL_ENCODED = "CN=utf-8_%C5%BC_SMP,O=EC,C=BE:0000000000000666"; - private static final RequestPostProcessor ADMIN_CREDENTIALS = httpBasic("test_admin", "gutek123"); + private static final RequestPostProcessor ADMIN_CREDENTIALS = httpBasic("test_admin", "test123"); @Autowired private WebApplicationContext webAppContext; @@ -227,7 +227,7 @@ public class ServiceGroupControllerTest { .contentType(APPLICATION_XML_VALUE) .header(HTTP_HEADER_KEY_SERVICE_GROUP_OWNER, "not-existing-user") .content(SERVICE_GROUP_INPUT_BODY)) - .andExpect(status().isNotFound()); + .andExpect(status().isBadRequest()); } } diff --git a/smp-webapp/src/test/java/eu/europa/ec/edelivery/smp/error/ErrorMappingControllerAdviceTest.java b/smp-webapp/src/test/java/eu/europa/ec/edelivery/smp/error/ErrorMappingControllerAdviceTest.java index f95bace1a..2e5278c0f 100644 --- a/smp-webapp/src/test/java/eu/europa/ec/edelivery/smp/error/ErrorMappingControllerAdviceTest.java +++ b/smp-webapp/src/test/java/eu/europa/ec/edelivery/smp/error/ErrorMappingControllerAdviceTest.java @@ -74,6 +74,6 @@ public class ErrorMappingControllerAdviceTest { new XmlInvalidAgainstSchemaException("XmlInvalidAgainstSchemaExceptionMessage", null)); assertEquals(BAD_REQUEST, re.getStatusCode()); - assertEquals(ErrorBusinessCode.XML_INVALID.toString(), ((ErrorResponse)re.getBody()).getBusinessCode()); + assertEquals(ErrorBusinessCode.XSD_INVALID.toString(), ((ErrorResponse)re.getBody()).getBusinessCode()); } } \ No newline at end of file diff --git a/smp-webapp/src/test/resources/webapp_integration_test_data.sql b/smp-webapp/src/test/resources/webapp_integration_test_data.sql index 82f0744dc..9db7a51a9 100644 --- a/smp-webapp/src/test/resources/webapp_integration_test_data.sql +++ b/smp-webapp/src/test/resources/webapp_integration_test_data.sql @@ -8,9 +8,9 @@ -- Unless required by applicable law or agreed to in writing, software distributed under the Licence is distributed on an "AS IS" basis, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -insert into SMP_USER (ID, USERNAME, PASSWORD, ROLE, ACTIVE) values (1, 'test_admin', '$2a$06$k.Q/6anG4Eq/nNTZ0C1UIuAKxpr6ra5oaMkMSrlESIyA5jKEsUdyS', 'ROLE_SMP_ADMIN', 1); -insert into SMP_USER(ID, USERNAME, PASSWORD, ROLE, ACTIVE) values (2, 'test_user_hashed_pass', '$2a$06$k.Q/6anG4Eq/nNTZ0C1UIuAKxpr6ra5oaMkMSrlESIyA5jKEsUdyS', 'ROLE_SMP_ADMIN',1); -insert into SMP_USER(ID, USERNAME, PASSWORD, ROLE, ACTIVE) values (3, 'test_user_clear_pass', 'gutek123', 'ROLE_SMP_ADMIN',1); +insert into SMP_USER (ID, USERNAME, PASSWORD, ROLE, ACTIVE) values (1, 'test_admin', '$2a$06$AXSSUDJlpzzq/gPZb7eIBeb8Mi0.PTKqDjzujZH.bWPwj5.ePEInW', 'ROLE_SMP_ADMIN', 1); +insert into SMP_USER(ID, USERNAME, PASSWORD, ROLE, ACTIVE) values (2, 'test_user_hashed_pass', '$2a$06$AXSSUDJlpzzq/gPZb7eIBeb8Mi0.PTKqDjzujZH.bWPwj5.ePEInW', 'ROLE_SMP_ADMIN',1); +insert into SMP_USER(ID, USERNAME, PASSWORD, ROLE, ACTIVE) values (3, 'test_user_clear_pass', 'test123', 'ROLE_SMP_ADMIN',1); insert into SMP_USER(ID, USERNAME, PASSWORD, ROLE, ACTIVE) values (4, 'CN=comon name,O=org,C=BE:0000000000000066', '', 'ROLE_SMP_ADMIN', 1); insert into SMP_USER(ID, USERNAME, ROLE, ACTIVE) values (5, 'CN=EHEALTH_SMP_TEST_BRAZIL,O=European Commission,C=BE:48b681ee8e0dcc08', 'ROLE_SMP_ADMIN', 1); insert into SMP_USER(ID, USERNAME, ROLE, ACTIVE) values (6, 'CN=utf-8_ż_SMP,O=EC,C=BE:0000000000000666', 'ROLE_SMP_ADMIN', 1); -- GitLab