Author: alien11689 Date: Mon Jan 23 16:52:24 2017 New Revision: 1779953 URL: http://svn.apache.org/viewvc?rev=1779953&view=rev Log: [TEST] Use aries xsd to validate BMP generated xml
Added: aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/resources/schema/ aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/resources/schema/example.xsd Modified: aries/trunk/blueprint/plugin/blueprint-maven-plugin/pom.xml aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/GeneratorTest.java Modified: aries/trunk/blueprint/plugin/blueprint-maven-plugin/pom.xml URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/plugin/blueprint-maven-plugin/pom.xml?rev=1779953&r1=1779952&r2=1779953&view=diff ============================================================================== --- aries/trunk/blueprint/plugin/blueprint-maven-plugin/pom.xml (original) +++ aries/trunk/blueprint/plugin/blueprint-maven-plugin/pom.xml Mon Jan 23 16:52:24 2017 @@ -17,7 +17,8 @@ specific language governing permissions and limitations under the License. --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> @@ -43,8 +44,11 @@ </properties> <scm> - <connection>scm:svn:http://svn.apache.org/repos/asf/aries/trunk/blueprint/plugin/blueprint-maven-plugin</connection> - <developerConnection>scm:svn:https://svn.apache.org/repos/asf/aries/trunk/blueprint/plugin/blueprint-maven-plugin</developerConnection> + <connection>scm:svn:http://svn.apache.org/repos/asf/aries/trunk/blueprint/plugin/blueprint-maven-plugin + </connection> + <developerConnection> + scm:svn:https://svn.apache.org/repos/asf/aries/trunk/blueprint/plugin/blueprint-maven-plugin + </developerConnection> <url>http://svn.apache.org/viewvc/aries/trunk/blueprint/plugin/blueprint-maven-plugin</url> </scm> @@ -77,6 +81,25 @@ </execution> </executions> </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <executions> + <execution> + <id>resource-dependencies</id> + <phase>process-test-resources</phase> + <goals> + <goal>unpack-dependencies</goal> + </goals> + <configuration> + <!--<includeArtifactIds>org.apache.aries.blueprint.api</includeArtifactIds>--> + <includes>**/aries/**/*.xsd</includes> + <outputDirectory>${project.build.directory}/classes/schema</outputDirectory> + <outputAbsoluteArtifactFilename>true</outputAbsoluteArtifactFilename> + </configuration> + </execution> + </executions> + </plugin> </plugins> <pluginManagement> <plugins> @@ -105,7 +128,7 @@ </goals> </pluginExecutionFilter> <action> - <ignore /> + <ignore/> </action> </pluginExecution> </pluginExecutions> @@ -154,15 +177,15 @@ <version>0.8.0</version> </dependency> <dependency> - <groupId>org.osgi</groupId> - <artifactId>osgi.cmpn</artifactId> - <version>6.0.0</version> + <groupId>org.osgi</groupId> + <artifactId>osgi.cmpn</artifactId> + <version>6.0.0</version> </dependency> <dependency> - <groupId>org.apache.aries.blueprint</groupId> - <artifactId>blueprint-maven-plugin-annotation</artifactId> - <version>1.0.1-SNAPSHOT</version> + <groupId>org.apache.aries.blueprint</groupId> + <artifactId>blueprint-maven-plugin-annotation</artifactId> + <version>1.0.1-SNAPSHOT</version> </dependency> <dependency> <groupId>org.apache.maven</groupId> @@ -274,6 +297,37 @@ <scope>test</scope> </dependency> + <dependency> + <groupId>org.apache.aries.blueprint</groupId> + <artifactId>org.apache.aries.blueprint.api</artifactId> + <version>1.0.1</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.aries.blueprint</groupId> + <artifactId>org.apache.aries.blueprint.core</artifactId> + <version>1.7.1</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.aries.transaction</groupId> + <artifactId>org.apache.aries.transaction.blueprint</artifactId> + <version>1.1.1</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.aries.jpa</groupId> + <artifactId>org.apache.aries.jpa.blueprint.aries</artifactId> + <version>1.0.2</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.aries.blueprint</groupId> + <artifactId>org.apache.aries.blueprint.cm</artifactId> + <version>1.0.9</version> + <scope>test</scope> + </dependency> + </dependencies> Modified: aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/GeneratorTest.java URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/GeneratorTest.java?rev=1779953&r1=1779952&r2=1779953&view=diff ============================================================================== --- aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/GeneratorTest.java (original) +++ aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/GeneratorTest.java Mon Jan 23 16:52:24 2017 @@ -56,7 +56,6 @@ import java.io.InputStream; import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; -import java.util.Iterator; import java.util.Map; import java.util.Set; @@ -615,9 +614,26 @@ public class GeneratorTest { public void generatedXmlIsValid() throws Exception { Document document = readToDocument(xmlAsBytes, true); + Source[] schemas = new StreamSource[]{ + new StreamSource(GeneratorTest.class.getResourceAsStream("/schema/example.xsd")), + new StreamSource(GeneratorTest.class.getResourceAsStream("/schema/org/apache/aries/blueprint/blueprint.xsd")), + new StreamSource(GeneratorTest.class.getResourceAsStream("/schema/org/apache/aries/blueprint/ext/impl/blueprint-ext.xsd")), + new StreamSource(GeneratorTest.class.getResourceAsStream("/schema/org/apache/aries/blueprint/ext/impl/blueprint-ext-1.1.xsd")), + new StreamSource(GeneratorTest.class.getResourceAsStream("/schema/org/apache/aries/blueprint/ext/impl/blueprint-ext-1.2.xsd")), + new StreamSource(GeneratorTest.class.getResourceAsStream("/schema/org/apache/aries/blueprint/ext/impl/blueprint-ext-1.3.xsd")), + new StreamSource(GeneratorTest.class.getResourceAsStream("/schema/org/apache/aries/blueprint/ext/impl/blueprint-ext-1.4.xsd")), + new StreamSource(GeneratorTest.class.getResourceAsStream("/schema/org/apache/aries/blueprint/ext/impl/blueprint-ext-1.5.xsd")), + new StreamSource(GeneratorTest.class.getResourceAsStream("/schema/org/apache/aries/transaction/parsing/transactionv12.xsd")), + new StreamSource(GeneratorTest.class.getResourceAsStream("/schema/org/apache/aries/jpa/blueprint/namespace/jpa_110.xsd")), + new StreamSource(GeneratorTest.class.getResourceAsStream("/schema/org/apache/aries/blueprint/compendium/cm/blueprint-cm-1.0.0.xsd")), + new StreamSource(GeneratorTest.class.getResourceAsStream("/schema/org/apache/aries/blueprint/compendium/cm/blueprint-cm-1.1.0.xsd")), + new StreamSource(GeneratorTest.class.getResourceAsStream("/schema/org/apache/aries/blueprint/compendium/cm/blueprint-cm-1.3.0.xsd")), + new StreamSource(GeneratorTest.class.getResourceAsStream("/schema/org/apache/aries/blueprint/compendium/cm/blueprint-cm-1.2.0.xsd")) + }; + Source xmlFile = new DOMSource(document); SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); - Schema schema = schemaFactory.newSchema(new StreamSource(GeneratorTest.class.getResourceAsStream("/schema/blueprint.xsd"))); + Schema schema = schemaFactory.newSchema(schemas); Validator validator = schema.newValidator(); validator.validate(xmlFile); } Added: aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/resources/schema/example.xsd URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/resources/schema/example.xsd?rev=1779953&view=auto ============================================================================== --- aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/resources/schema/example.xsd (added) +++ aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/resources/schema/example.xsd Mon Jan 23 16:52:24 2017 @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- + /* + * $Revision: 1690270 $ + * + * Copyright (c) OSGi Alliance (2008, 2009). All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + --> +<xsd:schema xmlns="http://exampleNamespace" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://exampleNamespace" + elementFormDefault="qualified" + attributeFormDefault="unqualified"> + + + <xsd:element name="example" type="TExample"/> + + <xsd:complexType name="TExample"> + <xsd:attribute name="id" type="xsd:string" use="required"/> + <xsd:attribute name="value" type="xsd:string" use="required"/> + </xsd:complexType> + +</xsd:schema>