Skip to content

Commit 0df4250

Browse files
committed
Change test code to read AAS.xsd from classpath and not from remote location
Signed-off-by: Johannes Kristan <[email protected]>
1 parent 120a814 commit 0df4250

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

core/esmf-aspect-model-aas-generator/src/test/java/org/eclipse/esmf/aspectmodel/aas/AspectModelAASGeneratorTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import java.io.ByteArrayInputStream;
1919
import java.io.ByteArrayOutputStream;
2020
import java.io.IOException;
21-
import java.net.URL;
2221
import java.nio.charset.StandardCharsets;
2322
import java.util.List;
2423
import java.util.Set;
@@ -56,9 +55,9 @@
5655

5756
class AspectModelAASGeneratorTest {
5857

59-
public static final String XML_XSD_AAS_SCHEMA_LOCATION =
60-
"https://raw.githubusercontent.com/aas-core-works/aas-core3.0-testgen/403a0a7cca4a787f642b226bc940ae2d2b319dad/test_data/schema.xsd";
61-
// "https://raw.githubusercontent.com/admin-shell-io/aas-specs/v3.0.6/schemas/xml/AAS.xsd";
58+
// The AAS XML Schema is also present in the AAS4j library for testing purposes. So we can read
59+
// the file from the classpath
60+
public static final String XML_XSD_AAS_SCHEMA_LOCATION = "/AAS.xsd";
6261

6362
AspectModelAASGenerator generator = new AspectModelAASGenerator();
6463

@@ -291,7 +290,9 @@ private ByteArrayOutputStream getByteArrayOutputStreamFromAspect( final TestAspe
291290
private void validate(ByteArrayInputStream xmlStream) throws IOException, SAXException {
292291
SchemaFactory factory =
293292
SchemaFactory.newInstance( XMLConstants.W3C_XML_SCHEMA_NS_URI);
294-
Schema schema = factory.newSchema(new URL( XML_XSD_AAS_SCHEMA_LOCATION ) );
293+
294+
Schema schema = factory.newSchema(
295+
new StreamSource(getClass().getResourceAsStream( XML_XSD_AAS_SCHEMA_LOCATION ) ) );
295296
Validator validator = schema.newValidator();
296297
validator.validate(new StreamSource( xmlStream ), null);
297298

@@ -311,5 +312,4 @@ private Environment loadAASX( final ByteArrayInputStream byteStream ) throws Des
311312
final XmlDeserializer deserializer = new XmlDeserializer();
312313
return deserializer.read( byteStream );
313314
}
314-
315315
}

0 commit comments

Comments
 (0)