[Geoserver-devel] [jira] Created: (GEOS-4836) AppSchema test trip up over inconsistent DescribeFeatureType response

AppSchema test trip up over inconsistent DescribeFeatureType response
---------------------------------------------------------------------

                 Key: GEOS-4836
                 URL: https://jira.codehaus.org/browse/GEOS-4836
             Project: GeoServer
          Issue Type: Bug
          Components: Application schema
    Affects Versions: 2.1.x
         Environment: Apache Maven 3.0.3 (r1075438; 2011-03-01 03:31:09+1000)
Maven home: /usr/local/Cellar/maven/3.0.3/libexec
Java version: 1.6.0_26, vendor: Apple Inc.
Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Default locale: en_US, platform encoding: MacRoman
OS name: "mac os x", version: "10.7.2", arch: "x86_64", family: "mac"
            Reporter: Jody Garnett
            Assignee: Ben Caradoc-Davies

In testing the (now applied) ResourceId patch I was unable to build due to a failure inside app-schema... I have confirmed that this failure exists on a clean checkout of GeoTools/GeoServer and Ben has asked me to report the issue into Jira.

-----
Judging from the console the following fails:
{panel}
INFO: WFS DescribeFeatureType response:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema elementFormDefault="qualified" targetNamespace="http://example.com" xmlns:xsd="http://www.w3.org/2001/XMLSchema&quot;&gt;
    <xsd:import namespace="urn:cgi:xmlns:CGI:GeoSciML:2.0" schemaLocation="http://www.geosciml.org/geosciml/2.0/xsd/geosciml.xsd&quot;/&gt;
    <xsd:include schemaLocation="file:/Users/jody/java/geoserver/trunk/src/extension/app-schema/app-schema-test/target/app-schema-mock421040920075292853data/featureTypes/ex_FirstParentFeature/simpleContent.xsd"/>
    <xsd:include schemaLocation="file:/Users/jody/java/geoserver/trunk/src/extension/app-schema/app-schema-test/target/app-schema-mock421040920075292853data/featureTypes/ex_SecondParentFeature/simpleContent.xsd"/>
    <xsd:import namespace="http://www.opengis.net/om/1.0&quot; schemaLocation="http://schemas.opengis.net/om/1.0.0/observation.xsd&quot;/&gt;
</xsd:schema>
{panel}

The checkDescribeFeatureType test that is failing is:
{code}
        String targetNamespace = evaluate("//@targetNamespace", doc);
        assertTrue(targetNamespace.length() > 0);
        int numberOfReferences = omSchemaLocation != null ? 3 : 2;
        int numberOfImports = getMatchingNodes("//xsd:import", doc).getLength();
        int numberOfIncludes = getMatchingNodes("//xsd:include", doc).getLength();
        assertEquals(numberOfReferences, numberOfImports + numberOfIncludes);
{code}

And we end up with the correct values of:
- numberOfImports = 2
- numberOfIncludes = 2

This is checked against numberOfReferences = 3 resulting in a failed test....

I have considered modifying your code test to actually count the numberOfReferences:
{code}
        int numberOfReferences = 1; // geosciml.xsd assumed
        numberOfReferences += (exSchemaOneLocation == null ? 0 : 1);
        numberOfReferences += (exSchemaTwoLocation == null ? 0 : 1);
        numberOfReferences += (omSchemaLocation == null ? 0 : 1);
{code}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira