chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1452381 - /chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/test/java/org/apache/chemistry/opencmis/commons/impl/xml/
Date Mon, 04 Mar 2013 16:42:33 GMT
Author: fmui
Date: Mon Mar  4 16:42:33 2013
New Revision: 1452381

URL: http://svn.apache.org/r1452381
Log:
reenabled XML tests

Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/test/java/org/apache/chemistry/opencmis/commons/impl/xml/AbstractXMLConverterTest.java
    chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/test/java/org/apache/chemistry/opencmis/commons/impl/xml/RepositoryInfoConverterTest.java
    chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/test/java/org/apache/chemistry/opencmis/commons/impl/xml/TypeDefinitionConverterTest.java

Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/test/java/org/apache/chemistry/opencmis/commons/impl/xml/AbstractXMLConverterTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/test/java/org/apache/chemistry/opencmis/commons/impl/xml/AbstractXMLConverterTest.java?rev=1452381&r1=1452380&r2=1452381&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/test/java/org/apache/chemistry/opencmis/commons/impl/xml/AbstractXMLConverterTest.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/test/java/org/apache/chemistry/opencmis/commons/impl/xml/AbstractXMLConverterTest.java
Mon Mar  4 16:42:33 2013
@@ -24,12 +24,12 @@ import static org.junit.Assert.fail;
 
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
+import java.io.InputStream;
 import java.io.OutputStream;
 import java.io.StringWriter;
 import java.lang.reflect.Method;
 import java.math.BigDecimal;
 import java.math.BigInteger;
-import java.net.URL;
 import java.util.Calendar;
 import java.util.GregorianCalendar;
 import java.util.List;
@@ -101,18 +101,19 @@ public abstract class AbstractXMLConvert
     public void init() throws SAXException, IOException {
         SchemaFactory sf = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
 
-        URL base = this.getClass().getResource("/");
-
-        URL schema10url = new URL(base, "schema/cmis10/CMIS-core.xsd");
-        StreamSource core10 = new StreamSource(schema10url.openStream());
-        StreamSource test10 = new StreamSource(new ByteArrayInputStream(TEST_SCHEMA.getBytes("UTF-8")));
-
-        URL schema11url = new URL(base, "schema/cmis11/CMIS-core.xsd");
-        StreamSource core11 = new StreamSource(schema11url.openStream());
-        StreamSource test11 = new StreamSource(new ByteArrayInputStream(TEST_SCHEMA.getBytes("UTF-8")));
+        InputStream schema10stream = AbstractXMLConverterTest.class.getResourceAsStream("/schema/cmis10/CMIS-core.xsd");
+        if (schema10stream != null) {
+            StreamSource core10 = new StreamSource(schema10stream);
+            StreamSource test10 = new StreamSource(new ByteArrayInputStream(TEST_SCHEMA.getBytes("UTF-8")));
+            schema10 = sf.newSchema(new Source[] { core10, test10 });
+        }
 
-        schema10 = sf.newSchema(new Source[] { core10, test10 });
-        schema11 = sf.newSchema(new Source[] { core11, test11 });
+        InputStream schema11stream = AbstractXMLConverterTest.class.getResourceAsStream("/schema/cmis11/CMIS-core.xsd");
+        if (schema11stream != null) {
+            StreamSource core11 = new StreamSource(schema11stream);
+            StreamSource test11 = new StreamSource(new ByteArrayInputStream(TEST_SCHEMA.getBytes("UTF-8")));
+            schema11 = sf.newSchema(new Source[] { core11, test11 });
+        }
 
         rnd = new Random(SEED);
     }
@@ -184,9 +185,19 @@ public abstract class AbstractXMLConvert
     protected void validate(byte[] xmlDocument, CmisVersion cmisVersion) {
         Validator validator = null;
         if (cmisVersion == CmisVersion.CMIS_1_0) {
-            validator = schema10.newValidator();
+            if (schema10 != null) {
+                validator = schema10.newValidator();
+            } else {
+                LOG.warn("CMIS 1.0 schema not loaded. Cannot validate XML.");
+                return;
+            }
         } else {
-            validator = schema11.newValidator();
+            if (schema11 != null) {
+                validator = schema11.newValidator();
+            } else {
+                LOG.warn("CMIS 1.1 schema not loaded. Cannot validate XML.");
+                return;
+            }
         }
 
         Source source = new StreamSource(new ByteArrayInputStream(xmlDocument));

Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/test/java/org/apache/chemistry/opencmis/commons/impl/xml/RepositoryInfoConverterTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/test/java/org/apache/chemistry/opencmis/commons/impl/xml/RepositoryInfoConverterTest.java?rev=1452381&r1=1452380&r2=1452381&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/test/java/org/apache/chemistry/opencmis/commons/impl/xml/RepositoryInfoConverterTest.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/test/java/org/apache/chemistry/opencmis/commons/impl/xml/RepositoryInfoConverterTest.java
Mon Mar  4 16:42:33 2013
@@ -60,10 +60,8 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.PermissionMappingDataImpl;
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.RepositoryCapabilitiesImpl;
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.RepositoryInfoImpl;
-import org.junit.Ignore;
 import org.junit.Test;
 
-@Ignore
 public class RepositoryInfoConverterTest extends AbstractXMLConverterTest {
 
     private static Set<String> cmis10ignoreMethods = new HashSet<String>();

Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/test/java/org/apache/chemistry/opencmis/commons/impl/xml/TypeDefinitionConverterTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/test/java/org/apache/chemistry/opencmis/commons/impl/xml/TypeDefinitionConverterTest.java?rev=1452381&r1=1452380&r2=1452381&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/test/java/org/apache/chemistry/opencmis/commons/impl/xml/TypeDefinitionConverterTest.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/test/java/org/apache/chemistry/opencmis/commons/impl/xml/TypeDefinitionConverterTest.java
Mon Mar  4 16:42:33 2013
@@ -56,10 +56,8 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.RelationshipTypeDefinitionImpl;
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.SecondaryTypeDefinitionImpl;
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.TypeMutabilityImpl;
-import org.junit.Ignore;
 import org.junit.Test;
 
-@Ignore
 public class TypeDefinitionConverterTest extends AbstractXMLConverterTest {
 
     private static Set<String> cmis10ignoreMethods = new HashSet<String>();



Mime
View raw message