Skip to content

Commit

Permalink
refs #membrane#277 Parse the version attribute and generate diff..
Browse files Browse the repository at this point in the history
Includes tests for parsing attribute version and diff.
  • Loading branch information
rrialq committed Sep 5, 2022
1 parent 9e7acdf commit 9e07d3c
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
18 changes: 18 additions & 0 deletions core/src/test/groovy/com/predic8/schema/SchemaVersionTest.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.predic8.schema;

import com.predic8.xml.util.ClasspathResolver;

public class SchemaVersionTest extends GroovyTestCase {
def schema

void setUp() {
def parser = new SchemaParser(resourceResolver: new ClasspathResolver())
schema = parser.parse("/schema/version/schema-version.xsd")
}

void testSchemaVersion() {
def expected = "1.0"
def version = schema.version
assertEquals( expected, version )
}
}
30 changes: 30 additions & 0 deletions core/src/test/resources/schema/version/schema-version.xsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://predic8.com/human-resources/" xmlns:tns="http://predic8.com/human-resources/"
elementFormDefault="unqualified" xmlns:ct="http://predic8.com/common-types/"
version="1.0"
>

<xsd:group name="PersonGroup">
<xsd:all>
<xsd:element name="firstName" type="xsd:string" />
<xsd:element name="lastName" type="xsd:string" />
<xsd:element name="isHuman" />
</xsd:all>
</xsd:group>

<xsd:complexType name="EmployeeType">
<xsd:all minOccurs="1">
<xsd:element name="person">
<xsd:complexType>
<xsd:group ref="tns:PersonGroup" />
</xsd:complexType>
</xsd:element>
<xsd:element name="city" type="xsd:string" />
</xsd:all>
</xsd:complexType>

<xsd:element name="employee" type="tns:EmployeeType" />

</xsd:schema>

0 comments on commit 9e07d3c

Please sign in to comment.