Return-Path: X-Original-To: apmail-chemistry-commits-archive@www.apache.org Delivered-To: apmail-chemistry-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4CC20D73D for ; Mon, 4 Mar 2013 16:43:01 +0000 (UTC) Received: (qmail 30393 invoked by uid 500); 4 Mar 2013 16:43:01 -0000 Delivered-To: apmail-chemistry-commits-archive@chemistry.apache.org Received: (qmail 30356 invoked by uid 500); 4 Mar 2013 16:43:01 -0000 Mailing-List: contact commits-help@chemistry.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@chemistry.apache.org Delivered-To: mailing list commits@chemistry.apache.org Received: (qmail 30345 invoked by uid 99); 4 Mar 2013 16:43:01 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 Mar 2013 16:43:01 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 Mar 2013 16:42:54 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id D2250238889B; Mon, 4 Mar 2013 16:42:33 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@chemistry.apache.org From: fmui@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130304164233.D2250238889B@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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 cmis10ignoreMethods = new HashSet(); 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 cmis10ignoreMethods = new HashSet();