From 678d8e42ba859cad0e755e325d99ed2b6e238e2c Mon Sep 17 00:00:00 2001 From: "Dr. Martin Goik" <goik@hdm-stuttgart.de> Date: Sat, 21 Jul 2018 18:35:59 +0200 Subject: [PATCH] Exam Sda1 Summer 2018 --- Klausuren/Sda1/2018Summer/Exam/.gitignore | 54 ++ Klausuren/Sda1/2018Summer/Exam/Schema/bib.xsd | 13 + .../2018Summer/Exam/Schema/sampledata.xml | 37 + .../Sda1/2018Summer/Exam/Schema/schema.sql | 21 + .../Exam/SchemaTest/0100_valid_minimum.xml | 7 + .../SchemaTest/0200_valid_noPublisher.xml | 10 + .../SchemaTest/0210_valid_singlePublisher.xml | 15 + .../0230_valid_multiplePublisher.xml | 27 + .../0240_invalid_duplicatePublisherId.xml | 20 + ...250_invalid_duplicatePublisherNameCity.xml | 21 + .../0260_invalid_publisherLevel.xml | 13 + .../Exam/SchemaTest/0300_valid_books.xml | 59 ++ .../SchemaTest/0310_invalid_bookNoTitle.xml | 25 + .../SchemaTest/0320_invalid_bookNoAuthor.xml | 24 + .../Exam/SchemaTest/0400_valid_websites.xml | 22 + .../0410_invalid_websiteDateViolation.xml | 16 + .../0420_invalid_websiteMissingAccessDate.xml | 17 + .../0430_invalid_websiteMissingUrl.xml | 16 + ...0440_invalid_websiteUrlFormatViolation.xml | 17 + .../SchemaTest/0500_valid_booksWebsites.xml | 58 ++ .../0510_invalid_bookDuplicateId.xml | 32 + .../Exam/SchemaTest/0515_invalid_bookYear.xml | 26 + .../0520_invalid_bibDuplicateId.xml | 31 + .../0600_invalid_bookInvalidPublisher.xml | 27 + .../0700_valid_bibPublisherIdCompat.xml | 42 + Klausuren/Sda1/2018Summer/Exam/pom.xml | 166 ++++ .../Exam/src/main/assembly/assembly.xml | 36 + .../de/hdm_stuttgart/mi/sda1/AllResults.java | 14 + .../de/hdm_stuttgart/mi/sda1/impl/DbRead.java | 43 + .../Exam/src/main/resources/log4j2.xml | 20 + .../mi/sda1/test/ex1/SchemaTest.java | 26 + Klausuren/Sda1/2018Summer/Solve/.gitignore | 54 ++ Klausuren/Sda1/2018Summer/Solve/Doc/exam.xml | 773 ++++++++++++++++++ .../Sda1/2018Summer/Solve/Schema/bib.xsd | 97 +++ .../2018Summer/Solve/Schema/sampledata.xml | 37 + .../Sda1/2018Summer/Solve/Schema/schema.sql | 38 + .../Solve/SchemaTest/0100_valid_minimum.xml | 7 + .../SchemaTest/0200_valid_noPublisher.xml | 10 + .../SchemaTest/0210_valid_singlePublisher.xml | 15 + .../0230_valid_multiplePublisher.xml | 27 + .../0240_invalid_duplicatePublisherId.xml | 20 + ...250_invalid_duplicatePublisherNameCity.xml | 21 + .../0260_invalid_publisherLevel.xml | 13 + .../Solve/SchemaTest/0300_valid_books.xml | 59 ++ .../SchemaTest/0310_invalid_bookNoTitle.xml | 25 + .../SchemaTest/0320_invalid_bookNoAuthor.xml | 24 + .../Solve/SchemaTest/0400_valid_websites.xml | 22 + .../0410_invalid_websiteDateViolation.xml | 16 + .../0420_invalid_websiteMissingAccessDate.xml | 17 + .../0430_invalid_websiteMissingUrl.xml | 16 + ...0440_invalid_websiteUrlFormatViolation.xml | 17 + .../SchemaTest/0500_valid_booksWebsites.xml | 58 ++ .../0510_invalid_bookDuplicateId.xml | 32 + .../SchemaTest/0515_invalid_bookYear.xml | 26 + .../0520_invalid_bibDuplicateId.xml | 31 + .../0600_invalid_bookInvalidPublisher.xml | 27 + .../0700_valid_bibPublisherIdCompat.xml | 42 + Klausuren/Sda1/2018Summer/Solve/pom.xml | 166 ++++ .../Solve/src/main/assembly/assembly.xml | 36 + .../de/hdm_stuttgart/mi/sda1/AllResults.java | 16 + .../hdm_stuttgart/mi/sda1/FinalResults.java | 16 + .../de/hdm_stuttgart/mi/sda1/impl/DbRead.java | 83 ++ .../mi/sda1/impl/DbReadDuplicate.java | 30 + .../mi/sda1/impl/DbReadUnique.java | 29 + .../Solve/src/main/resources/log4j2.xml | 20 + .../mi/sda1/test/ex1/SchemaTest.java | 26 + 66 files changed, 2901 insertions(+) create mode 100644 Klausuren/Sda1/2018Summer/Exam/.gitignore create mode 100644 Klausuren/Sda1/2018Summer/Exam/Schema/bib.xsd create mode 100644 Klausuren/Sda1/2018Summer/Exam/Schema/sampledata.xml create mode 100644 Klausuren/Sda1/2018Summer/Exam/Schema/schema.sql create mode 100644 Klausuren/Sda1/2018Summer/Exam/SchemaTest/0100_valid_minimum.xml create mode 100644 Klausuren/Sda1/2018Summer/Exam/SchemaTest/0200_valid_noPublisher.xml create mode 100644 Klausuren/Sda1/2018Summer/Exam/SchemaTest/0210_valid_singlePublisher.xml create mode 100644 Klausuren/Sda1/2018Summer/Exam/SchemaTest/0230_valid_multiplePublisher.xml create mode 100644 Klausuren/Sda1/2018Summer/Exam/SchemaTest/0240_invalid_duplicatePublisherId.xml create mode 100644 Klausuren/Sda1/2018Summer/Exam/SchemaTest/0250_invalid_duplicatePublisherNameCity.xml create mode 100644 Klausuren/Sda1/2018Summer/Exam/SchemaTest/0260_invalid_publisherLevel.xml create mode 100644 Klausuren/Sda1/2018Summer/Exam/SchemaTest/0300_valid_books.xml create mode 100644 Klausuren/Sda1/2018Summer/Exam/SchemaTest/0310_invalid_bookNoTitle.xml create mode 100644 Klausuren/Sda1/2018Summer/Exam/SchemaTest/0320_invalid_bookNoAuthor.xml create mode 100644 Klausuren/Sda1/2018Summer/Exam/SchemaTest/0400_valid_websites.xml create mode 100644 Klausuren/Sda1/2018Summer/Exam/SchemaTest/0410_invalid_websiteDateViolation.xml create mode 100644 Klausuren/Sda1/2018Summer/Exam/SchemaTest/0420_invalid_websiteMissingAccessDate.xml create mode 100644 Klausuren/Sda1/2018Summer/Exam/SchemaTest/0430_invalid_websiteMissingUrl.xml create mode 100644 Klausuren/Sda1/2018Summer/Exam/SchemaTest/0440_invalid_websiteUrlFormatViolation.xml create mode 100644 Klausuren/Sda1/2018Summer/Exam/SchemaTest/0500_valid_booksWebsites.xml create mode 100644 Klausuren/Sda1/2018Summer/Exam/SchemaTest/0510_invalid_bookDuplicateId.xml create mode 100644 Klausuren/Sda1/2018Summer/Exam/SchemaTest/0515_invalid_bookYear.xml create mode 100644 Klausuren/Sda1/2018Summer/Exam/SchemaTest/0520_invalid_bibDuplicateId.xml create mode 100644 Klausuren/Sda1/2018Summer/Exam/SchemaTest/0600_invalid_bookInvalidPublisher.xml create mode 100644 Klausuren/Sda1/2018Summer/Exam/SchemaTest/0700_valid_bibPublisherIdCompat.xml create mode 100644 Klausuren/Sda1/2018Summer/Exam/pom.xml create mode 100644 Klausuren/Sda1/2018Summer/Exam/src/main/assembly/assembly.xml create mode 100644 Klausuren/Sda1/2018Summer/Exam/src/main/java/de/hdm_stuttgart/mi/sda1/AllResults.java create mode 100644 Klausuren/Sda1/2018Summer/Exam/src/main/java/de/hdm_stuttgart/mi/sda1/impl/DbRead.java create mode 100644 Klausuren/Sda1/2018Summer/Exam/src/main/resources/log4j2.xml create mode 100644 Klausuren/Sda1/2018Summer/Exam/src/test/java/de/hdm_stuttgart/mi/sda1/test/ex1/SchemaTest.java create mode 100644 Klausuren/Sda1/2018Summer/Solve/.gitignore create mode 100644 Klausuren/Sda1/2018Summer/Solve/Doc/exam.xml create mode 100644 Klausuren/Sda1/2018Summer/Solve/Schema/bib.xsd create mode 100644 Klausuren/Sda1/2018Summer/Solve/Schema/sampledata.xml create mode 100644 Klausuren/Sda1/2018Summer/Solve/Schema/schema.sql create mode 100644 Klausuren/Sda1/2018Summer/Solve/SchemaTest/0100_valid_minimum.xml create mode 100644 Klausuren/Sda1/2018Summer/Solve/SchemaTest/0200_valid_noPublisher.xml create mode 100644 Klausuren/Sda1/2018Summer/Solve/SchemaTest/0210_valid_singlePublisher.xml create mode 100644 Klausuren/Sda1/2018Summer/Solve/SchemaTest/0230_valid_multiplePublisher.xml create mode 100644 Klausuren/Sda1/2018Summer/Solve/SchemaTest/0240_invalid_duplicatePublisherId.xml create mode 100644 Klausuren/Sda1/2018Summer/Solve/SchemaTest/0250_invalid_duplicatePublisherNameCity.xml create mode 100644 Klausuren/Sda1/2018Summer/Solve/SchemaTest/0260_invalid_publisherLevel.xml create mode 100644 Klausuren/Sda1/2018Summer/Solve/SchemaTest/0300_valid_books.xml create mode 100644 Klausuren/Sda1/2018Summer/Solve/SchemaTest/0310_invalid_bookNoTitle.xml create mode 100644 Klausuren/Sda1/2018Summer/Solve/SchemaTest/0320_invalid_bookNoAuthor.xml create mode 100644 Klausuren/Sda1/2018Summer/Solve/SchemaTest/0400_valid_websites.xml create mode 100644 Klausuren/Sda1/2018Summer/Solve/SchemaTest/0410_invalid_websiteDateViolation.xml create mode 100644 Klausuren/Sda1/2018Summer/Solve/SchemaTest/0420_invalid_websiteMissingAccessDate.xml create mode 100644 Klausuren/Sda1/2018Summer/Solve/SchemaTest/0430_invalid_websiteMissingUrl.xml create mode 100644 Klausuren/Sda1/2018Summer/Solve/SchemaTest/0440_invalid_websiteUrlFormatViolation.xml create mode 100644 Klausuren/Sda1/2018Summer/Solve/SchemaTest/0500_valid_booksWebsites.xml create mode 100644 Klausuren/Sda1/2018Summer/Solve/SchemaTest/0510_invalid_bookDuplicateId.xml create mode 100644 Klausuren/Sda1/2018Summer/Solve/SchemaTest/0515_invalid_bookYear.xml create mode 100644 Klausuren/Sda1/2018Summer/Solve/SchemaTest/0520_invalid_bibDuplicateId.xml create mode 100644 Klausuren/Sda1/2018Summer/Solve/SchemaTest/0600_invalid_bookInvalidPublisher.xml create mode 100644 Klausuren/Sda1/2018Summer/Solve/SchemaTest/0700_valid_bibPublisherIdCompat.xml create mode 100644 Klausuren/Sda1/2018Summer/Solve/pom.xml create mode 100644 Klausuren/Sda1/2018Summer/Solve/src/main/assembly/assembly.xml create mode 100644 Klausuren/Sda1/2018Summer/Solve/src/main/java/de/hdm_stuttgart/mi/sda1/AllResults.java create mode 100644 Klausuren/Sda1/2018Summer/Solve/src/main/java/de/hdm_stuttgart/mi/sda1/FinalResults.java create mode 100644 Klausuren/Sda1/2018Summer/Solve/src/main/java/de/hdm_stuttgart/mi/sda1/impl/DbRead.java create mode 100644 Klausuren/Sda1/2018Summer/Solve/src/main/java/de/hdm_stuttgart/mi/sda1/impl/DbReadDuplicate.java create mode 100644 Klausuren/Sda1/2018Summer/Solve/src/main/java/de/hdm_stuttgart/mi/sda1/impl/DbReadUnique.java create mode 100644 Klausuren/Sda1/2018Summer/Solve/src/main/resources/log4j2.xml create mode 100644 Klausuren/Sda1/2018Summer/Solve/src/test/java/de/hdm_stuttgart/mi/sda1/test/ex1/SchemaTest.java diff --git a/Klausuren/Sda1/2018Summer/Exam/.gitignore b/Klausuren/Sda1/2018Summer/Exam/.gitignore new file mode 100644 index 000000000..9b36bc511 --- /dev/null +++ b/Klausuren/Sda1/2018Summer/Exam/.gitignore @@ -0,0 +1,54 @@ +/target/ +/.settings/ +.classpath +.project +dependency-reduced-pom.xml +*.log + +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff: +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/dictionaries + +# Sensitive or high-churn files: +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.xml +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml + +# Gradle: +.idea/**/gradle.xml +.idea/**/libraries + +# CMake +cmake-build-debug/ + +# Mongo Explorer plugin: +.idea/**/mongoSettings.xml + +*.iws + + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties diff --git a/Klausuren/Sda1/2018Summer/Exam/Schema/bib.xsd b/Klausuren/Sda1/2018Summer/Exam/Schema/bib.xsd new file mode 100644 index 000000000..6ee0fd196 --- /dev/null +++ b/Klausuren/Sda1/2018Summer/Exam/Schema/bib.xsd @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" > + + <xs:element name="bibliography"> + <xs:complexType> + <xs:sequence> + <!-- TODO: Implement me! --> + </xs:sequence> + </xs:complexType> + + </xs:element> + +</xs:schema> \ No newline at end of file diff --git a/Klausuren/Sda1/2018Summer/Exam/Schema/sampledata.xml b/Klausuren/Sda1/2018Summer/Exam/Schema/sampledata.xml new file mode 100644 index 000000000..0c02b30f5 --- /dev/null +++ b/Klausuren/Sda1/2018Summer/Exam/Schema/sampledata.xml @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8"?> +<bibliography xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="bib.xsd" > + + <publishers> + + <publisher id="springer"> + <name>Springer</name> + <city>Berlin / Germany</city> + </publisher> + + <publisher id="addWesley"> + <name>Addison-Wesley</name> + <city>Reading, Massachusetts / USA</city> + </publisher> + </publishers> + + <book id="ab94" publisher="springer" year="1994"> + <title>Infinite Dimensional Analysis</title> + <author>Charalambos D. Aliprantis</author> + <author>Kim C. Border</author> + </book> + + <book id="goossens93" publisher="addWesley" year="1993"> + <title>The LaTeX Companion</title> + <author>Michel Goossens</author> + <author>Frank Mittelbach</author> + <author>Alexander Samarin</author> + </book> + + <website id="bibtex" access="2018-07-15"> + <uri>https://en.wikipedia.org/wiki/BibTeX</uri> + <title>BiBTeX - Wikipedia</title> + <!-- Optional: <author>...</author> --> + </website> + +</bibliography> \ No newline at end of file diff --git a/Klausuren/Sda1/2018Summer/Exam/Schema/schema.sql b/Klausuren/Sda1/2018Summer/Exam/Schema/schema.sql new file mode 100644 index 000000000..4ea7a3f3f --- /dev/null +++ b/Klausuren/Sda1/2018Summer/Exam/Schema/schema.sql @@ -0,0 +1,21 @@ +DROP TABLE IF EXISTS Competition; +DROP TABLE IF EXISTS Athlete; + +/* TODO add schema here */ + +INSERT INTO Athlete VALUES(1, 'Jesse Owens'); +INSERT INTO Athlete VALUES(2, 'Tim Culver'); +INSERT INTO Athlete VALUES(3, 'Sid Gascoine'); +INSERT INTO Athlete VALUES(4, 'John Hooker'); +INSERT INTO Athlete VALUES(5, 'Brad Duncan'); + +/* 100 metre race results */ +INSERT INTO Competition VALUES(1, 1, 10.23, 0); /* Jesse Owens */ +INSERT INTO Competition VALUES(2, 2, 11.55, 0); /* Tim Culver */ +INSERT INTO Competition VALUES(3, 3, 11.94, 0); /* Sid Gascoine */ +INSERT INTO Competition VALUES(4, 4, 10.02, 0); /* John Hooker */ +INSERT INTO Competition VALUES(5, 5, 10.84, 0); /* Brad Duncan */ +INSERT INTO Competition VALUES(6, 2, 10.02, 0); /* Tim Culver */ +INSERT INTO Competition VALUES(7, 3, 10.49, 0); /* Sid Gascoine */ +INSERT INTO Competition VALUES(8, 2, 9.35, 1); /* Tim Culver */ + diff --git a/Klausuren/Sda1/2018Summer/Exam/SchemaTest/0100_valid_minimum.xml b/Klausuren/Sda1/2018Summer/Exam/SchemaTest/0100_valid_minimum.xml new file mode 100644 index 000000000..6fe9ce498 --- /dev/null +++ b/Klausuren/Sda1/2018Summer/Exam/SchemaTest/0100_valid_minimum.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<bibliography xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../Schema/bib.xsd" /> + +<?xmlTest points = "1" + expectedToBeValid = "true" ?> \ No newline at end of file diff --git a/Klausuren/Sda1/2018Summer/Exam/SchemaTest/0200_valid_noPublisher.xml b/Klausuren/Sda1/2018Summer/Exam/SchemaTest/0200_valid_noPublisher.xml new file mode 100644 index 000000000..d94f266ba --- /dev/null +++ b/Klausuren/Sda1/2018Summer/Exam/SchemaTest/0200_valid_noPublisher.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<bibliography xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../Schema/bib.xsd" > + <publishers/> +</bibliography> + +<?xmlTest points = "1" + expectedToBeValid = "true" +?> diff --git a/Klausuren/Sda1/2018Summer/Exam/SchemaTest/0210_valid_singlePublisher.xml b/Klausuren/Sda1/2018Summer/Exam/SchemaTest/0210_valid_singlePublisher.xml new file mode 100644 index 000000000..03b298355 --- /dev/null +++ b/Klausuren/Sda1/2018Summer/Exam/SchemaTest/0210_valid_singlePublisher.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<bibliography xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../Schema/bib.xsd" > + <publishers> + <publisher id="one"> + <name>Publisher 1</name> + <city>City 1</city> + </publisher> + </publishers> +</bibliography> + +<?xmlTest points = "1" + expectedToBeValid = "true" +?> diff --git a/Klausuren/Sda1/2018Summer/Exam/SchemaTest/0230_valid_multiplePublisher.xml b/Klausuren/Sda1/2018Summer/Exam/SchemaTest/0230_valid_multiplePublisher.xml new file mode 100644 index 000000000..2087c1d5e --- /dev/null +++ b/Klausuren/Sda1/2018Summer/Exam/SchemaTest/0230_valid_multiplePublisher.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<bibliography xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../Schema/bib.xsd" > + <publishers> + + <publisher id="one"> + <name>Publisher 1</name> + <city>City 1</city> + </publisher> + + <publisher id="two"> + <name>Publisher 1</name> + <city>City 2</city> + </publisher> + + <publisher id="three"> + <name>Publisher 2</name> + <city>City 1</city> + </publisher> + + </publishers> +</bibliography> + +<?xmlTest points = "1" + expectedToBeValid = "true" +?> diff --git a/Klausuren/Sda1/2018Summer/Exam/SchemaTest/0240_invalid_duplicatePublisherId.xml b/Klausuren/Sda1/2018Summer/Exam/SchemaTest/0240_invalid_duplicatePublisherId.xml new file mode 100644 index 000000000..5be0d6a31 --- /dev/null +++ b/Klausuren/Sda1/2018Summer/Exam/SchemaTest/0240_invalid_duplicatePublisherId.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<bibliography xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../Schema/bib.xsd" > + <publishers> + <publisher id="one"> + <name>Publisher 1</name> + <city>City 1</city> + </publisher> + <publisher id="one"> <!-- Duplicate @id value »one« --> + <name>Publisher 2</name> + <city>City 2</city> + </publisher> + </publishers> +</bibliography> + +<?xmlTest points = "2" + expectedToBeValid = "false" + preconditionValid = "0230_valid_multiplePublisher.xml" +?> diff --git a/Klausuren/Sda1/2018Summer/Exam/SchemaTest/0250_invalid_duplicatePublisherNameCity.xml b/Klausuren/Sda1/2018Summer/Exam/SchemaTest/0250_invalid_duplicatePublisherNameCity.xml new file mode 100644 index 000000000..bb87c7ad6 --- /dev/null +++ b/Klausuren/Sda1/2018Summer/Exam/SchemaTest/0250_invalid_duplicatePublisherNameCity.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<bibliography xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../Schema/bib.xsd" > + <publishers> + <publisher id="one"> + <name>Publisher 1</name> + <city>City 1</city> + </publisher> + <publisher id="two"> + <!-- Error: duplicate both <name> and <city> --> + <name>Publisher 1</name> + <city>City 1</city> + </publisher> + </publishers> +</bibliography> + +<?xmlTest points = "2" + expectedToBeValid = "false" + preconditionValid = "0230_valid_multiplePublisher.xml" +?> diff --git a/Klausuren/Sda1/2018Summer/Exam/SchemaTest/0260_invalid_publisherLevel.xml b/Klausuren/Sda1/2018Summer/Exam/SchemaTest/0260_invalid_publisherLevel.xml new file mode 100644 index 000000000..e0381013b --- /dev/null +++ b/Klausuren/Sda1/2018Summer/Exam/SchemaTest/0260_invalid_publisherLevel.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<bibliography xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../Schema/bib.xsd" > + + <!-- Wrong level: Only <publishers> allowed here --> + <publisher id="unknown">Nobody</publisher> +</bibliography> + +<?xmlTest points = "2" + expectedToBeValid = "false" + preconditionValid = "0230_valid_multiplePublisher.xml" +?> diff --git a/Klausuren/Sda1/2018Summer/Exam/SchemaTest/0300_valid_books.xml b/Klausuren/Sda1/2018Summer/Exam/SchemaTest/0300_valid_books.xml new file mode 100644 index 000000000..e885646f7 --- /dev/null +++ b/Klausuren/Sda1/2018Summer/Exam/SchemaTest/0300_valid_books.xml @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<bibliography xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../Schema/bib.xsd" > + <publishers> + + <publisher id="springer"> + <name>Springer</name> + <city>Berlin / Germany</city> + </publisher> + + <publisher id="addWesley"> + <name>Addison-Wesley</name> + <city>Reading, Massachusetts / USA</city> + </publisher> + + </publishers> + + <book id="ab92" publisher="springer" year="1994"> + <title>Infinite Dimensional Analysis</title> + <author>Charalambos D. Aliprantis</author> + </book> + + <book id="ab94" publisher="springer" year="1994"> + <title>Infinite Dimensional Analysis</title> + <editor>Charalambos D. Aliprantis</editor> + </book> + + <book id="ab95" publisher="springer" year="1994"> + <title>Infinite Dimensional Analysis</title> + <editor>Charalambos D. Aliprantis</editor> + <author>Kim C. Border</author> + </book> + + <book id="goossens93" publisher="addWesley" year="1993"> + <title>The LaTeX Companion</title> + <author>Michel Goossens</author> + <author>Frank Mittelbach</author> + <author>Alexander Samarin</author> + </book> + + <book id="ab96" publisher="springer" year="1994"> + <title>Infinite Dimensional Analysis</title> + <editor>Charalambos D. Aliprantis</editor> + <editor>Kim C. Border</editor> + </book> + + <book id="ab97" publisher="springer" year="1994"> + <title>Infinite Dimensional Analysis</title> + <author>Charalambos D. Aliprantis</author> + <author>Kim C. Border</author> + </book> + + +</bibliography> + +<?xmlTest points = "1" + expectedToBeValid = "true" +?> diff --git a/Klausuren/Sda1/2018Summer/Exam/SchemaTest/0310_invalid_bookNoTitle.xml b/Klausuren/Sda1/2018Summer/Exam/SchemaTest/0310_invalid_bookNoTitle.xml new file mode 100644 index 000000000..2ed105de3 --- /dev/null +++ b/Klausuren/Sda1/2018Summer/Exam/SchemaTest/0310_invalid_bookNoTitle.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<bibliography xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../Schema/bib.xsd" > + <publishers> + + <publisher id="springer"> + <name>Springer</name> + <city>Berlin / Germany</city> + </publisher> + + </publishers> + + <book id="ab94" publisher="springer" year="1994"> + <!-- Error: Missing <title> --> + <author>Charalambos D. Aliprantis</author> + <author>Kim C. Border</author> + </book> + +</bibliography> + +<?xmlTest points = "2" + expectedToBeValid = "false" + preconditionValid = "0300_valid_books.xml" +?> diff --git a/Klausuren/Sda1/2018Summer/Exam/SchemaTest/0320_invalid_bookNoAuthor.xml b/Klausuren/Sda1/2018Summer/Exam/SchemaTest/0320_invalid_bookNoAuthor.xml new file mode 100644 index 000000000..6cc7372ee --- /dev/null +++ b/Klausuren/Sda1/2018Summer/Exam/SchemaTest/0320_invalid_bookNoAuthor.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<bibliography xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../Schema/bib.xsd" > + <publishers> + + <publisher id="springer"> + <name>Springer</name> + <city>Berlin / Germany</city> + </publisher> + + </publishers> + + <book id="ab94" publisher="springer" year="1994"> + <title>Infinite Dimensional Analysis</title> + <!-- Neither <author> nor <editor> --> + </book> + +</bibliography> + +<?xmlTest points = "2" + expectedToBeValid = "false" + preconditionValid = "0300_valid_books.xml" +?> diff --git a/Klausuren/Sda1/2018Summer/Exam/SchemaTest/0400_valid_websites.xml b/Klausuren/Sda1/2018Summer/Exam/SchemaTest/0400_valid_websites.xml new file mode 100644 index 000000000..db66a0739 --- /dev/null +++ b/Klausuren/Sda1/2018Summer/Exam/SchemaTest/0400_valid_websites.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<bibliography xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../Schema/bib.xsd" > + + <website id="bibtex" access="2018-07-15"> + <uri>https://en.wikipedia.org/wiki/BibTeX</uri> + <title>BiBTeX - Wikipedia</title> + </website> + + <website id="bibtex2" access="2018-07-15"> + <uri>https://en.wikipedia.org/wiki/BibTeX</uri> + <title>BiBTeX - Wikipedia</title> + <author>Unknown</author> + </website> + + +</bibliography> + +<?xmlTest points = "1" + expectedToBeValid = "true" +?> diff --git a/Klausuren/Sda1/2018Summer/Exam/SchemaTest/0410_invalid_websiteDateViolation.xml b/Klausuren/Sda1/2018Summer/Exam/SchemaTest/0410_invalid_websiteDateViolation.xml new file mode 100644 index 000000000..602bb91ef --- /dev/null +++ b/Klausuren/Sda1/2018Summer/Exam/SchemaTest/0410_invalid_websiteDateViolation.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<bibliography xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../Schema/bib.xsd" > + + <website id="bibtex" access="15.7.2018"> <!-- Error: Wrong date format --> + <uri>https://en.wikipedia.org/wiki/BibTeX</uri> + <title>BiBTeX - Wikipedia</title> + </website> + +</bibliography> + +<?xmlTest points = "2" + expectedToBeValid = "false" + preconditionValid = "0400_valid_websites.xml" +?> diff --git a/Klausuren/Sda1/2018Summer/Exam/SchemaTest/0420_invalid_websiteMissingAccessDate.xml b/Klausuren/Sda1/2018Summer/Exam/SchemaTest/0420_invalid_websiteMissingAccessDate.xml new file mode 100644 index 000000000..46653e14d --- /dev/null +++ b/Klausuren/Sda1/2018Summer/Exam/SchemaTest/0420_invalid_websiteMissingAccessDate.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<bibliography xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../Schema/bib.xsd" > + + <website id="bibtex"> <!-- Error: missing access date --> + <uri>https://en.wikipedia.org/wiki/BibTeX</uri> + <title>BiBTeX - Wikipedia</title> + </website> + + +</bibliography> + +<?xmlTest points = "2" + expectedToBeValid = "false" + preconditionValid = "0400_valid_websites.xml" +?> diff --git a/Klausuren/Sda1/2018Summer/Exam/SchemaTest/0430_invalid_websiteMissingUrl.xml b/Klausuren/Sda1/2018Summer/Exam/SchemaTest/0430_invalid_websiteMissingUrl.xml new file mode 100644 index 000000000..0dac7dc4d --- /dev/null +++ b/Klausuren/Sda1/2018Summer/Exam/SchemaTest/0430_invalid_websiteMissingUrl.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<bibliography xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../Schema/bib.xsd" > + + <website id="bibtex" access="2018-07-15"> + <!-- Error: Missing <uri> --> + <title>BiBTeX - Wikipedia</title> + </website> + +</bibliography> + +<?xmlTest points = "2" + expectedToBeValid = "false" + preconditionValid = "0400_valid_websites.xml" +?> diff --git a/Klausuren/Sda1/2018Summer/Exam/SchemaTest/0440_invalid_websiteUrlFormatViolation.xml b/Klausuren/Sda1/2018Summer/Exam/SchemaTest/0440_invalid_websiteUrlFormatViolation.xml new file mode 100644 index 000000000..15462cc3e --- /dev/null +++ b/Klausuren/Sda1/2018Summer/Exam/SchemaTest/0440_invalid_websiteUrlFormatViolation.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<bibliography xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../Schema/bib.xsd" > + + <website id="bibtex" access="2018-07-15"> + <!-- Error: Invalid URI --> + <uri>Jodel dodel düüh</uri> + <title>BiBTeX - Wikipedia</title> + </website> + +</bibliography> + +<?xmlTest points = "2" + expectedToBeValid = "false" + preconditionValid = "0400_valid_websites.xml" +?> diff --git a/Klausuren/Sda1/2018Summer/Exam/SchemaTest/0500_valid_booksWebsites.xml b/Klausuren/Sda1/2018Summer/Exam/SchemaTest/0500_valid_booksWebsites.xml new file mode 100644 index 000000000..799683142 --- /dev/null +++ b/Klausuren/Sda1/2018Summer/Exam/SchemaTest/0500_valid_booksWebsites.xml @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<bibliography xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../Schema/bib.xsd" > + <publishers> + + <publisher id="springer"> + <name>Springer</name> + <city>Berlin / Germany</city> + </publisher> + + </publishers> + + <book id="ab92" publisher="springer" year="1994"> + <title>Infinite Dimensional Analysis</title> + <author>Charalambos D. Aliprantis</author> + </book> + + <book id="ab94" publisher="springer" year="1994"> + <title>Infinite Dimensional Analysis</title> + <editor>Charalambos D. Aliprantis</editor> + </book> + + <website id="bibtex" access="2018-07-15"> + <uri>https://en.wikipedia.org/wiki/BibTeX</uri> + <title>BiBTeX - Wikipedia</title> + </website> + + <book id="ab95" publisher="springer" year="1994"> + <title>Infinite Dimensional Analysis</title> + <editor>Charalambos D. Aliprantis</editor> + <author>Kim C. Border</author> + </book> + + <book id="ab96" publisher="springer" year="1994"> + <title>Infinite Dimensional Analysis</title> + <editor>Charalambos D. Aliprantis</editor> + <editor>Kim C. Border</editor> + </book> + + <book id="ab97" publisher="springer" year="1994"> + <title>Infinite Dimensional Analysis</title> + <author>Charalambos D. Aliprantis</author> + <author>Kim C. Border</author> + </book> + + <website id="bibtex2" access="2018-07-15"> + <uri>https://en.wikipedia.org/wiki/BibTeX</uri> + <title>BiBTeX - Wikipedia</title> + <author>Unknown</author> + </website> + + +</bibliography> + +<?xmlTest points = "1" + expectedToBeValid = "true" +?> diff --git a/Klausuren/Sda1/2018Summer/Exam/SchemaTest/0510_invalid_bookDuplicateId.xml b/Klausuren/Sda1/2018Summer/Exam/SchemaTest/0510_invalid_bookDuplicateId.xml new file mode 100644 index 000000000..149d73269 --- /dev/null +++ b/Klausuren/Sda1/2018Summer/Exam/SchemaTest/0510_invalid_bookDuplicateId.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<bibliography xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../Schema/bib.xsd" > + + <publishers> + + <publisher id="springer"> + <name>Springer</name> + <city>Berlin / Germany</city> + </publisher> + + </publishers> + + <book id="ab92" publisher="springer" year="1994"> + <title>Infinite Dimensional Analysis</title> + <author>Charalambos D. Aliprantis</author> + </book> + + <!-- Error: Duplicate @id value --> + <book id="ab92" publisher="springer" year="1994"> + <title>Infinite Dimensional Analysis</title> + <editor>Charalambos D. Aliprantis</editor> + </book> + + +</bibliography> + +<?xmlTest points = "1" + expectedToBeValid = "false" + preconditionValid = "0500_valid_booksWebsites.xml" +?> \ No newline at end of file diff --git a/Klausuren/Sda1/2018Summer/Exam/SchemaTest/0515_invalid_bookYear.xml b/Klausuren/Sda1/2018Summer/Exam/SchemaTest/0515_invalid_bookYear.xml new file mode 100644 index 000000000..e0171e495 --- /dev/null +++ b/Klausuren/Sda1/2018Summer/Exam/SchemaTest/0515_invalid_bookYear.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<bibliography xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../Schema/bib.xsd" > + + <publishers> + + <publisher id="springer"> + <name>Springer</name> + <city>Berlin / Germany</city> + </publisher> + + </publishers> + + <book id="ab92" publisher="springer" year="nineteenhundred"> <!-- Error: @year not an integer value --> + + <title>Infinite Dimensional Analysis</title> + <author>Charalambos D. Aliprantis</author> + </book> + +</bibliography> + +<?xmlTest points = "1" + expectedToBeValid = "false" + preconditionValid = "0500_valid_booksWebsites.xml" +?> \ No newline at end of file diff --git a/Klausuren/Sda1/2018Summer/Exam/SchemaTest/0520_invalid_bibDuplicateId.xml b/Klausuren/Sda1/2018Summer/Exam/SchemaTest/0520_invalid_bibDuplicateId.xml new file mode 100644 index 000000000..08dd10089 --- /dev/null +++ b/Klausuren/Sda1/2018Summer/Exam/SchemaTest/0520_invalid_bibDuplicateId.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<bibliography xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../Schema/bib.xsd" > + + <publishers> + + <publisher id="springer"> + <name>Springer</name> + <city>Berlin / Germany</city> + </publisher> + + </publishers> + + <book id="bibtex" publisher="springer" year="1994"> + <title>Infinite Dimensional Analysis</title> + <author>Charalambos D. Aliprantis</author> + </book> + + <!-- Error: Duplicate @id value --> + <website id="bibtex" access="2018-07-15"> + <uri>https://en.wikipedia.org/wiki/BibTeX</uri> + <title>BiBTeX - Wikipedia</title> + </website> + +</bibliography> + +<?xmlTest points = "1" + expectedToBeValid = "false" + preconditionValid = "0500_valid_booksWebsites.xml" +?> \ No newline at end of file diff --git a/Klausuren/Sda1/2018Summer/Exam/SchemaTest/0600_invalid_bookInvalidPublisher.xml b/Klausuren/Sda1/2018Summer/Exam/SchemaTest/0600_invalid_bookInvalidPublisher.xml new file mode 100644 index 000000000..c7ae42ca5 --- /dev/null +++ b/Klausuren/Sda1/2018Summer/Exam/SchemaTest/0600_invalid_bookInvalidPublisher.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<bibliography xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../Schema/bib.xsd" > + + <publishers> + + <publisher id="springer"> + <name>Springer</name> + <city>Berlin / Germany</city> + </publisher> + + </publishers> + + <!-- Error: Invalid reference »spring« rather than »springer« --> + <book id="ab92" publisher="spring" year="1994"> + <title>Infinite Dimensional Analysis</title> + <author>Charalambos D. Aliprantis</author> + </book> + + +</bibliography> + +<?xmlTest points = "1" + expectedToBeValid = "false" + preconditionValid = "0300_valid_books.xml" +?> \ No newline at end of file diff --git a/Klausuren/Sda1/2018Summer/Exam/SchemaTest/0700_valid_bibPublisherIdCompat.xml b/Klausuren/Sda1/2018Summer/Exam/SchemaTest/0700_valid_bibPublisherIdCompat.xml new file mode 100644 index 000000000..bfe447b1a --- /dev/null +++ b/Klausuren/Sda1/2018Summer/Exam/SchemaTest/0700_valid_bibPublisherIdCompat.xml @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<bibliography xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../Schema/bib.xsd" > + <publishers> + + <publisher id="springer"> + <name>Springer</name> + <city>Berlin / Germany</city> + </publisher> + + <publisher id="addWesley"> + <name>Addison-Wesley</name> + <city>Reading, Massachusetts / USA</city> + </publisher> + + </publishers> + + <!-- Should not interfere with <publisher id="springer"> entry --> + <book id="springer" publisher="springer" year="1994"> + <title>Infinite Dimensional Analysis</title> + <author>Charalambos D. Aliprantis</author> + </book> + + <book id="ab94" publisher="springer" year="1994"> + <title>Infinite Dimensional Analysis</title> + <editor>Charalambos D. Aliprantis</editor> + </book> + + <!-- Should not interfere with <publisher id="addWesley"> entry --> + <website id="addWesley" access="2018-07-15"> + <uri>https://en.wikipedia.org/wiki/BibTeX</uri> + <title>BiBTeX - Wikipedia</title> + <!-- Optional: <author>...</author> --> + </website> + + +</bibliography> + +<?xmlTest points = "1" + expectedToBeValid = "true" +?> diff --git a/Klausuren/Sda1/2018Summer/Exam/pom.xml b/Klausuren/Sda1/2018Summer/Exam/pom.xml new file mode 100644 index 000000000..ceef14ecb --- /dev/null +++ b/Klausuren/Sda1/2018Summer/Exam/pom.xml @@ -0,0 +1,166 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <groupId>de.hdm_stuttgart.mi.sda1</groupId> + <artifactId>exam</artifactId> + <version>0.9</version> + <packaging>jar</packaging> + + <name>Exam</name> + + <url>http://www.mi.hdm-stuttgart.de/freedocs/topic/de.hdm_stuttgart.mi.lectures/sd1SectUsingMaven.html</url> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <oxygenxml.version>20.1.0.0</oxygenxml.version> + </properties> + + <repositories> + + <repository> + <id>hdm-mi-internal-maven-repo</id> + <url>https://maven.mi.hdm-stuttgart.de/nexus/repository/mi-maven</url> + </repository> + <repository> + <id>oxygenxml-repo</id> + <url>https://maven.mi.hdm-stuttgart.de/nexus/repository/oxygen</url> + </repository> + </repositories> + + <dependencies> + + <dependency> + <groupId>com.oxygenxml</groupId> + <artifactId>oxygen-xercesImpl</artifactId> + <version>${oxygenxml.version}</version> + </dependency> + + <dependency> + <groupId>com.oxygenxml</groupId> + <artifactId>oxygen</artifactId> + <version>${oxygenxml.version}</version> + </dependency> + + <!-- Still needed to keep oxygenxml happy using legacy logging --> + <dependency> + <groupId>log4j</groupId> + <artifactId>log4j</artifactId> + <version>1.2.17</version> + </dependency> + + <dependency> + <groupId>com.rackspace.eclipse.webtools.sourceediting</groupId> + <artifactId>org.eclipse.wst.xml.xpath2.processor</artifactId> + <version>2.1.100</version> + </dependency> + + <dependency> + <groupId>mysql</groupId> + <artifactId>mysql-connector-java</artifactId> + <version>6.0.6</version> + </dependency> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.12</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-core</artifactId> + <version>2.10.0</version> + </dependency> + + <dependency> + <groupId>javax.xml.bind</groupId> + <artifactId>jaxb-api</artifactId> + <version>2.3.0</version> + </dependency> + + <!-- Required for executable jar generation to avoid ClassNotFoundException: + com.fasterxml.jackson.core.type.TypeReference and similar dependency problems. --> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-databind</artifactId> + <version>2.9.3</version> + </dependency> + + <dependency> + <groupId>org.jdom</groupId> + <artifactId>jdom2</artifactId> + <version>2.0.6</version> + </dependency> + + <dependency> + <groupId>jaxen</groupId> + <artifactId>jaxen</artifactId> + <version>1.1.6</version> + </dependency> + + <dependency> + <groupId>de.hdm_stuttgart.mi.exam</groupId> + <artifactId>unitmarking</artifactId> + <version>0.9</version> + </dependency> + + </dependencies> + + <build> + + <plugins> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.7.0</version> + <configuration> + <source>1.9</source> + <target>1.9</target> + <compilerArgument>-proc:none</compilerArgument> + </configuration> + </plugin> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-javadoc-plugin</artifactId> + <version>3.0.1</version> + <configuration> + <links> + <link>https://docs.oracle.com/javase/10/docs/api</link> + </links> + <additionalJOptions> + <additionalJOption>-html5</additionalJOption> + </additionalJOptions> + </configuration> + </plugin> + + <plugin> + <artifactId>maven-assembly-plugin</artifactId> + <version>2.3</version> + <configuration> + <descriptor>src/main/assembly/assembly.xml</descriptor> + </configuration> + <executions> + <execution> + <id>make-assembly</id> + <phase>package</phase> + <goals> + <goal>single</goal> + </goals> + <configuration> + <archive> + <manifest> + <mainClass>de.hdm_stuttgart.mi.sda1.test.ShowReachedPoints</mainClass> + </manifest> + </archive> + </configuration> + </execution> + </executions> + </plugin> + + </plugins> + </build> +</project> diff --git a/Klausuren/Sda1/2018Summer/Exam/src/main/assembly/assembly.xml b/Klausuren/Sda1/2018Summer/Exam/src/main/assembly/assembly.xml new file mode 100644 index 000000000..1a2cd6054 --- /dev/null +++ b/Klausuren/Sda1/2018Summer/Exam/src/main/assembly/assembly.xml @@ -0,0 +1,36 @@ +<assembly + xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd"> + <id>fat-tests</id> + <formats> + <format>jar</format> + </formats> + <includeBaseDirectory>false</includeBaseDirectory> + <dependencySets> + <dependencySet> + <outputDirectory>/</outputDirectory> + <useProjectArtifact>true</useProjectArtifact> + <unpack>true</unpack> + <scope>test</scope> + </dependencySet> + </dependencySets> + <fileSets> + <fileSet> + <directory>${project.build.directory}/test-classes</directory> + <outputDirectory>/</outputDirectory> + <includes> + <include>**/*.class</include> + </includes> + <useDefaultExcludes>true</useDefaultExcludes> + </fileSet> + <fileSet> + <directory>${project.build.directory}/classes</directory> + <outputDirectory>/</outputDirectory> + <includes> + <include>**/*.class</include> + </includes> + <useDefaultExcludes>true</useDefaultExcludes> + </fileSet> + </fileSets> +</assembly> diff --git a/Klausuren/Sda1/2018Summer/Exam/src/main/java/de/hdm_stuttgart/mi/sda1/AllResults.java b/Klausuren/Sda1/2018Summer/Exam/src/main/java/de/hdm_stuttgart/mi/sda1/AllResults.java new file mode 100644 index 000000000..bc1497ff5 --- /dev/null +++ b/Klausuren/Sda1/2018Summer/Exam/src/main/java/de/hdm_stuttgart/mi/sda1/AllResults.java @@ -0,0 +1,14 @@ + package de.hdm_stuttgart.mi.sda1; + + + import de.hdm_stuttgart.mi.sda1.impl.DbRead; + + public class AllResults { + + public static void main( String[] args ) { + + final DbRead sports = new DbRead(); + + sports.toHtml(System.out); + } + } \ No newline at end of file diff --git a/Klausuren/Sda1/2018Summer/Exam/src/main/java/de/hdm_stuttgart/mi/sda1/impl/DbRead.java b/Klausuren/Sda1/2018Summer/Exam/src/main/java/de/hdm_stuttgart/mi/sda1/impl/DbRead.java new file mode 100644 index 000000000..55d8dd776 --- /dev/null +++ b/Klausuren/Sda1/2018Summer/Exam/src/main/java/de/hdm_stuttgart/mi/sda1/impl/DbRead.java @@ -0,0 +1,43 @@ + package de.hdm_stuttgart.mi.sda1.impl; + + import org.jdom2.Element; + import org.jdom2.output.Format; + import org.jdom2.output.XMLOutputter; + + import java.io.IOException; + import java.io.OutputStream; + import java.sql.Connection; + import java.sql.DriverManager; + import java.sql.SQLException; + + public class DbRead { + + public final Element html; + + private final Connection conn; + + public DbRead() { + html = new Element("html"); + + Connection connTmp = null; + try { + connTmp = DriverManager.getConnection( + "jdbc:mysql://localhost/hdm?serverTimezone=UTC", "hdmuser", "XYZ"); + } catch (SQLException e) { + System.err.println("Unable to establish connection: " + e); + System.exit(1); + } + conn = connTmp; + } + + public void toHtml(final OutputStream out) { + + final XMLOutputter printer = + new XMLOutputter(Format.getPrettyFormat()); + try { + printer.output(html, out); + } catch (final IOException e) { + System.err.println("Unable to write output: " + e); + } + } + } \ No newline at end of file diff --git a/Klausuren/Sda1/2018Summer/Exam/src/main/resources/log4j2.xml b/Klausuren/Sda1/2018Summer/Exam/src/main/resources/log4j2.xml new file mode 100644 index 000000000..d7a0dcb77 --- /dev/null +++ b/Klausuren/Sda1/2018Summer/Exam/src/main/resources/log4j2.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Configuration> + <Appenders> + <File name="A1" fileName="A1.log" append="false"> + <PatternLayout pattern="%t %-5p %c{2} - %m%n"/> + </File> + <Console name="STDOUT" target="SYSTEM_OUT"> + <PatternLayout pattern="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/> + </Console> + </Appenders> + <Loggers> + <!-- You may want to enable more detailed hibernate logging --> + <Logger name="org.hibernate" level="error"> + <AppenderRef ref="A1"/> + </Logger> + <Root level="error"> + <AppenderRef ref="STDOUT"/> + </Root> + </Loggers> +</Configuration> \ No newline at end of file diff --git a/Klausuren/Sda1/2018Summer/Exam/src/test/java/de/hdm_stuttgart/mi/sda1/test/ex1/SchemaTest.java b/Klausuren/Sda1/2018Summer/Exam/src/test/java/de/hdm_stuttgart/mi/sda1/test/ex1/SchemaTest.java new file mode 100644 index 000000000..82e54951d --- /dev/null +++ b/Klausuren/Sda1/2018Summer/Exam/src/test/java/de/hdm_stuttgart/mi/sda1/test/ex1/SchemaTest.java @@ -0,0 +1,26 @@ +package de.hdm_stuttgart.mi.sda1.test.ex1; + +import de.hdm_stuttgart.mi.unitmarking.xsd.InstanceSetEvaluation; +import org.junit.Assert; +import org.junit.Test; + +/** + * Unit test for an XML instance set. CLI by: + * java -cp target/solvejpa-0.9-fat-tests.jar org.junit.runner.JUnitCore SchemaTest + */ +@SuppressWarnings("static-method") +public class SchemaTest { + /** + * Testing a suite of XML instances. + */ + @Test + public void testXmlInstanceSet() { + + final InstanceSetEvaluation ise = + new InstanceSetEvaluation("SchemaTest", "Schema/bib.xsd"); + + System.out.println(ise.getMessages()); + + Assert.assertTrue(ise.getErrorMessages(), ise.allTestsSucceeded); + } +} \ No newline at end of file diff --git a/Klausuren/Sda1/2018Summer/Solve/.gitignore b/Klausuren/Sda1/2018Summer/Solve/.gitignore new file mode 100644 index 000000000..9b36bc511 --- /dev/null +++ b/Klausuren/Sda1/2018Summer/Solve/.gitignore @@ -0,0 +1,54 @@ +/target/ +/.settings/ +.classpath +.project +dependency-reduced-pom.xml +*.log + +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff: +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/dictionaries + +# Sensitive or high-churn files: +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.xml +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml + +# Gradle: +.idea/**/gradle.xml +.idea/**/libraries + +# CMake +cmake-build-debug/ + +# Mongo Explorer plugin: +.idea/**/mongoSettings.xml + +*.iws + + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties diff --git a/Klausuren/Sda1/2018Summer/Solve/Doc/exam.xml b/Klausuren/Sda1/2018Summer/Solve/Doc/exam.xml new file mode 100644 index 000000000..54633021e --- /dev/null +++ b/Klausuren/Sda1/2018Summer/Solve/Doc/exam.xml @@ -0,0 +1,773 @@ +<?xml version="1.0" encoding="UTF-8"?> +<book version="5.0" xml:id="klausur_SoSe_2017" xml:lang="en" + xmlns="http://docbook.org/ns/docbook" + xmlns:xlink="http://www.w3.org/1999/xlink" + xmlns:xila="http://www.w3.org/2001/XInclude/local-attributes" + xmlns:xi="http://www.w3.org/2001/XInclude" + xmlns:trans="http://docbook.org/ns/transclusion" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns:m="http://www.w3.org/1998/Math/MathML" + xmlns:html="http://www.w3.org/1999/xhtml" + xmlns:db="http://docbook.org/ns/docbook"> + <info> + <title/> + + <author> + <personname/> + </author> + + <pubdate/> + </info> + + <chapter xml:id="task1"> + <title>A bibliography database</title> + + <!-- Upload zip archive. Applies to related execises as well. --> + + <section xml:id="aufgabe1_prepare"> + <title>Preparations</title> + + <para>Download and unzip the above file <filename>exam.zip</filename> + and import the resulting <filename>Exam</filename> folder as a Maven + project into your IDE.</para> + </section> + + <section xml:id="aufgabe1_descr"> + <title>Description</title> + + <para>Consider a bibliography database as in your project's sample data + file <filename>Schema/sampledata.xml</filename>:</para> + + <informaltable border="0"> + <tr> + <td valign="top"><programlisting language="xml"><bibliography ... > + + <publishers> + + <publisher id="springer"> + <name>Springer</name> + <city>Berlin / Germany</city> + </publisher> + + <publisher id="addWesley"> + <name>Addison-Wesley</name> + <city>Reading, Massachusetts / USA</city> + </publisher> + </publishers> + + <book id="ab94" publisher="springer" year="1994"> + <title>Infinite Dimensional Analysis</title> + <author>Charalambos D. Aliprantis</author> + <editor>Kim C. Border</editor> + </book> + + <book id="goossens93" publisher="addWesley" year="1993"> + <title>The LaTeX Companion</title> + <editor>Michel Goossens</editor> + <author>Frank Mittelbach</author> + <author>Alexander Samarin</author> + </book> + + <website id="bibtex" access="2018-07-15"> + <uri>https://en.wikipedia.org/wiki/BibTeX</uri> + <title>BiBTeX - Wikipedia</title> + <!-- Optional: <author>...</author> --> + </website> + +</bibliography></programlisting></td> + + <td valign="top"><para>Data integrity rules:</para><orderedlist> + <listitem> + <para><tag class="starttag">bibliography</tag> and <tag + class="starttag">publishers</tag> may be empty.</para> + </listitem> + + <listitem> + <para>Each <tag class="starttag">publisher</tag> must have a + (<tag class="starttag">name</tag>, <tag + class="starttag">city</tag>) combination being unique within + <tag class="starttag">publishers</tag>. Hint: XML schema + allows for multiple <tag class="starttag">xs:field</tag> + elements.</para> + </listitem> + + <listitem> + <para>The set of <code>@id</code> values of <tag + class="starttag">publisher</tag> entries must be unique within + <tag class="starttag">publishers</tag>.</para> + </listitem> + + <listitem> + <para>The set of <code>@id</code> values of <tag + class="starttag">book</tag> and <tag + class="starttag">website</tag> entries must be unique within + <tag class="starttag">bibliography</tag>.</para> + </listitem> + + <listitem> + <para>A <tag class="starttag">book</tag> entry must have a + <tag class="starttag">title</tag> and at least one <tag + class="starttag">author</tag> or <tag + class="starttag">editor</tag> child.</para> + </listitem> + + <listitem> + <para>A <tag class="starttag">book</tag> + <code>@publisher</code>'s attribute value must refer to an + existing <tag class="starttag">publisher</tag> + <code>@id</code> attribute value.</para> + </listitem> + + <listitem> + <para>A <tag class="starttag">book</tag> <code>@year</code>'s + attribute must be of integer value.</para> + </listitem> + + <listitem> + <para>A <tag class="starttag">website</tag> must have both + <tag class="starttag">uri</tag> and <tag + class="starttag">title</tag> and may have <tag + class="starttag">author</tag> children.</para> + </listitem> + + <listitem> + <para><tag class="starttag">uri</tag> content must begin + either with <code>http://</code> or <code>https://</code>. + Hint: Use <code>http[s]?://.+</code>.</para> + </listitem> + + <listitem> + <para>The <code>@access</code> date attribute value must be + specified with respect to English locale. Hint: A useful + standard schema type exists.</para> + </listitem> + </orderedlist></td> + </tr> + </informaltable> + + <para>Complete the schema implementation in + <filename>Schema/bib.xsd</filename>. <productname>Junit</productname> + execution of + <classname>de.hdm_stuttgart.mi.sda1.test.ex1.SchemaTest</classname> + loads all unit tests based on files residing in your project's folder + <filename>SchemaTest</filename>. In turn you receive your number of + points reached so far including detailed hints about failed + tests.</para> + </section> + + <section xml:id="aufgabe1_task"> + <title>Tasks</title> + + <para>Implement the yet incomplete XML Schema file + <filename>Schema/bib.xsd</filename> modeling all mentioned integrity + rules:</para> + + <orderedlist> + <listitem> + <para>The folder <filename>SchemaTest</filename> contains sample + files testing your schema for correctness.</para> + </listitem> + + <listitem> + <para>Executing + <classname>de.hdm_stuttgart.mi.sda1.test.ex1.SchemaTest</classname> + as a Java application indicates which test documents in + <filename>SchemaTest</filename> yet fail the expected outcome being + either <quote>valid</quote> of <quote>invalid</quote>. You also get + the number of points reached so far.</para> + </listitem> + + <listitem> + <para>Open all XML related files in + <productname>Oxygenxml</productname> offering better schema support + than IntelliJ.</para> + </listitem> + </orderedlist> + + <tip> + <itemizedlist> + <listitem> + <para>Don't touch the unit test defines in your project's + <filename>SchemaTest</filename> folder: Your automated tests may + end up throwing meaningless exceptions.</para> + </listitem> + + <listitem> + <para>Edit <filename>Schema/bib.xsd</filename> by small steps and + always execute the tests: In case of spoiling the + <quote>undo</quote> operation is your friend.</para> + </listitem> + </itemizedlist> + </tip> + </section> + + <section version="5.1" xml:id="uploadFirst" xml:lang="de"> + <title>Project upload</title> + + <para>Hit »File« --> »Export to Zip File« in IDEA archiving your + project as <filename>solution-1.zip</filename>. Then enter your ILIAS + tab, hit <quote>choose</quote> selecting + <filename>solution-1.zip</filename> and subsequently + <quote>upload</quote>. Do not forget to advance to the next question to + actually save the current question. Common pitfalls:</para> + + <itemizedlist> + <listitem> + <para>Upload the right archive: Avoid choosing the original + <filename>exam.zip</filename> skeleton.</para> + </listitem> + + <listitem> + <para>Watch out for <filename>solution_1.zip</filename> actually + being visible in the examination system.</para> + </listitem> + + <listitem> + <para>You may upload multiple versions i.e. + <filename>solution_2.zip</filename> etc.. Only your least upload + will become subject to marking.</para> + </listitem> + </itemizedlist> + + <para>Be careful:</para> + + <itemizedlist> + <listitem> + <para>Check your input at examination end for completeness.</para> + </listitem> + + <listitem> + <para>Projects residing only on your local workstation cannot be + recovered after exam termination.</para> + </listitem> + </itemizedlist> + </section> + </chapter> + + <chapter xml:id="task2"> + <title>Relational database HTML export</title> + + <section xml:id="task2_prepare"> + <title>Preparation</title> + + <para>If you already started the first exercise just continue working on + your project using IntelliJ. Otherwise read the first exercise regarding + the skeleton project import.</para> + + <para>Configuring a <productname>Mysql</productname> type database + connection in <productname>Intellij</productname> (»Views« --> »Tool + Windows« --> »Database«) requires:</para> + + <informaltable border="0"> + <tr> + <td valign="top"><itemizedlist> + <listitem> + <para>Host: <emphasis role="bold">localhost</emphasis></para> + </listitem> + + <listitem> + <para>Database: <emphasis role="bold">hdm</emphasis></para> + </listitem> + </itemizedlist></td> + + <td valign="top"><itemizedlist> + <listitem> + <para>User: <emphasis role="bold">hdmuser</emphasis></para> + </listitem> + + <listitem> + <para>Password: <emphasis role="bold">XYZ</emphasis></para> + </listitem> + </itemizedlist></td> + </tr> + </informaltable> + </section> + + <section xml:id="task2_descr"> + <title>Description</title> + + <para>Consider two tables representing athletes and their corresponding + 100 metre race competition results:</para> + + <informaltable border="0"> + <colgroup width="28%"/> + + <colgroup width="3%"/> + + <colgroup width="69%"/> + + <tr> + <td valign="top"><informaltable border="1"> + <colgroup width="13%"/> + + <colgroup width="87%"/> + + <tr> + <td colspan="2">Table <code>Athlete</code></td> + </tr> + + <tr> + <td><code>id</code></td> + + <td><code>fullName</code></td> + </tr> + + <tr> + <td><code>1</code></td> + + <td><code>Jesse Owens</code></td> + </tr> + + <tr> + <td><code>2</code></td> + + <td><code>Tim Culver</code></td> + </tr> + + <tr> + <td><code>3</code></td> + + <td><code>Sid Gascoine</code></td> + </tr> + + <tr> + <td><code>4</code></td> + + <td><code>John Hooker</code></td> + </tr> + + <tr> + <td><code>5</code></td> + + <td><code>Brad Duncan</code></td> + </tr> + </informaltable></td> + + <td>. .</td> + + <td valign="top"><informaltable border="1"> + <tr> + <td colspan="4">Table <code>Competition</code></td> + </tr> + + <tr> + <td><code>id</code></td> + + <td><code>athlete</code></td> + + <td><code>time</code></td> + + <td><code>badStart</code></td> + </tr> + + <tr> + <td><code>1</code></td> + + <td><code>1</code></td> + + <td><code>10.23</code></td> + + <td><code>0</code></td> + </tr> + + <tr> + <td><code>2</code></td> + + <td><code>2</code></td> + + <td><code>11.55</code></td> + + <td><code>0</code></td> + </tr> + + <tr> + <td><code>3</code></td> + + <td><code>3</code></td> + + <td><code>11.94</code></td> + + <td><code>0</code></td> + </tr> + + <tr> + <td><code>4</code></td> + + <td><code>4</code></td> + + <td><code>10.02</code></td> + + <td><code>0</code></td> + </tr> + + <tr> + <td><code>5</code></td> + + <td><code>5</code></td> + + <td><code>10.84</code></td> + + <td><code>0</code></td> + </tr> + + <tr> + <td><code>6</code></td> + + <td><code>2</code></td> + + <td><code>10.02</code></td> + + <td><code>0</code></td> + </tr> + + <tr> + <td><code>7</code></td> + + <td><code>3</code></td> + + <td><code>10.49</code></td> + + <td><code>0</code></td> + </tr> + + <tr> + <td><code>8</code></td> + + <td><code>2</code></td> + + <td><code>9.35</code></td> + + <td><code>1</code></td> + </tr> + </informaltable></td> + </tr> + </informaltable> + + <para>Explanations and hints:</para> + + <orderedlist> + <listitem> + <para>Each <code>Athlete</code> has a name and a unique + <code>id</code>.</para> + </listitem> + + <listitem> + <para>The <code>id</code> column in <code>Competition</code> defines + the order of athlete's competition attempts.</para> + </listitem> + + <listitem> + <para>The <code>Competition.athlete</code> column refers to the + corresponding <code>Athlete.id</code> value identifying the athlete + in question.</para> + </listitem> + + <listitem> + <para>Athletes may appear multiple times in <code>Competition</code> + referring to multiple competition attempts.</para> + </listitem> + + <listitem> + <para>All but the very last <code>Competition</code> sample records + have a <code>badStart</code> value of 0 indicating a proper start. A + <code>badStart</code> value different from 0 indicates a start + failure. Note: <productname>Mysql</productname> allows for type + boolean being an alias for type <code>bit</code> representing 0 and + 1.</para> + </listitem> + </orderedlist> + + <para><filename>Schema/schema.sql</filename> already contains INSERT + statements corresponding to the above sample data.</para> + </section> + + <section xml:id="task2_tasks"> + <title>Tasks</title> + + <para>Every task adds to points being reached.</para> + + <orderedlist> + <listitem> + <para>Create a suitable database schema prior to and corresponding + to the already existing <code>INSERT</code> statements in + <filename>Schema/schema.sql</filename> representing the informally + mentioned constraints.</para> + + <para>Execute the <code>INSERT</code> statements both as proof of + concept and with respect to subsequent tasks.</para> + </listitem> + + <listitem> + <para><classname>Class + de.hdm_stuttgart.mi.sda1.AllResults</classname> already references a + fully configured <productname>JDBC</productname> connection. On + execution you'll see a single <tag class="starttag">html</tag> tag + being created.</para> + + <para>Extend the underlying classes to create the subsequent HTML + output derived from your <productname>Mysql</productname> database's + content. Competition results shall be ordered first by ascending + time and second by athlete's name. Red background rows indicate bad + start attempts:</para> + + <informaltable border="0"> + <colgroup width="24%"/> + + <colgroup width="3%"/> + + <colgroup width="73%"/> + + <tr> + <td valign="top"><programlisting language="xml"><html> + <head><title>Results</title></head> + <body> + <table> + <tr> + <th>Rank</th> + <th>Name</th> + <th>Time</th> + </tr> + <tr style="background: red;"> + <td>1</td> + <td>Tim Culver</td> + <td>9.35</td> + </tr> + ... + </table> + </body> +</html></programlisting></td> + + <td>. .</td> + + <td valign="top"><para>Pseudo outline HTML representation, red + background indicating bad starts not to be displayed for + technical reasons, using bold style + instead:</para><informaltable border="1"> + <colgroup width="15%"/> + + <colgroup width="41%"/> + + <colgroup width="44%"/> + + <tr> + <td>Rank</td> + + <td>Name</td> + + <td>Time / seconds</td> + </tr> + + <tr> + <td><emphasis role="red">1</emphasis></td> + + <td><emphasis role="red">Tim Culver</emphasis></td> + + <td><emphasis role="red">10.23</emphasis></td> + </tr> + + <tr> + <td><code>2</code></td> + + <td><code>John Hooker</code></td> + + <td><code>10.02</code></td> + </tr> + + <tr> + <td><code>3</code></td> + + <td><code>Tim Culver</code></td> + + <td><code>10.02</code></td> + </tr> + + <tr> + <td><code>4</code></td> + + <td><code>Jesse Owens</code></td> + + <td><code>10.23</code></td> + </tr> + + <tr> + <td><code>5</code></td> + + <td><code>Sid Gascoine</code></td> + + <td><code>10.49</code></td> + </tr> + + <tr> + <td><code>6</code></td> + + <td><code>Brad Duncan</code></td> + + <td><code>10.84</code></td> + </tr> + + <tr> + <td><code>7</code></td> + + <td><code>Tim Culver</code></td> + + <td><code>11.55</code></td> + </tr> + + <tr> + <td><code>8</code></td> + + <td><code>Sid Gascoine</code></td> + + <td><code>11.94</code></td> + </tr> + </informaltable></td> + </tr> + </informaltable> + + <para>The SQL sample data is only intended for illustration + purposes. Your application shall work accordingly when reading + similar but different data sets.</para> + + <tip> + <itemizedlist> + <listitem> + <para>Use a <link + xlink:href="https://www.w3schools.com/sql/sql_join.asp">Join</link>.</para> + </listitem> + + <listitem> + <para>Create the »Rank« column values inside your Java + application rather than using SQL.</para> + </listitem> + </itemizedlist> + </tip> + </listitem> + + <listitem> + <para>The previous table contains both duplicate athlete attempts + and bad starts. We are looking for a »final result« table containing + only the fastest and at the same time valid run of each athlete + eliminating bad starts:</para> + + <informaltable border="0"> + <colgroup width="29%"/> + + <colgroup width="5%"/> + + <colgroup width="66%"/> + + <tr> + <td valign="top"><programlisting language="xml"><table> + <tr> + <th>Rank</th> + <th>Name</th> + <th>Time / seconds</th> + </tr> + <tr> + <td>1</td> + <td>John Hooker</td> + <td>10.02</td> + </tr> + ... +</table>...</programlisting></td> + + <td>. .</td> + + <td valign="top"><para>Pseudo outline + representation:</para><informaltable border="1"> + <colgroup width="15%"/> + + <colgroup width="41%"/> + + <colgroup width="44%"/> + + <tr> + <td>Rank</td> + + <td>Name</td> + + <td>Time / seconds</td> + </tr> + + <tr> + <td><code>1</code></td> + + <td><code>John Hooker</code></td> + + <td><code>10.02</code></td> + </tr> + + <tr> + <td><code>2</code></td> + + <td><code>Tim Culver</code></td> + + <td><code>10.02</code></td> + </tr> + + <tr> + <td><code>3</code></td> + + <td><code>Jesse Owens</code></td> + + <td><code>10.23</code></td> + </tr> + + <tr> + <td><code>4</code></td> + + <td><code>Sid Gascoine</code></td> + + <td><code>10.49</code></td> + </tr> + + <tr> + <td><code>5</code></td> + + <td><code>Brad Duncan</code></td> + + <td><code>10.84</code></td> + </tr> + </informaltable></td> + </tr> + </informaltable> + + <para>Create a suitable executable class + <classname>de.hdm_stuttgart.mi.sda1.FinalResults</classname>.</para> + + <tip> + <para>Rather than fiddling with minimum (best) time values in Java + you may solve this problem on SQL level using <link + xlink:href="https://www.w3schools.com/sql/sql_groupby.asp">SELECT + ... GROUP BY</link> in conjunction with the <link + xlink:href="https://www.w3schools.com/sql/sql_min_max.asp">min() + aggregate function</link> choosing the least time of each athlete. + Use a <link + xlink:href="https://www.w3schools.com/sql/sql_alias.asp">column + name alias</link> for renaming the aggregate column's name.</para> + </tip> + </listitem> + </orderedlist> + </section> + + <section version="5.1" xml:id="uploadFollow" xml:lang="de"> + <title>Solution upload</title> + + <para>Upload your project using the previous exercise. Enter either of + the following two texts:</para> + + <itemizedlist> + <listitem> + <para>I'm expecting points for my work on the current + exercise.</para> + </listitem> + + <listitem> + <para>I did not work on this exercise.</para> + </listitem> + </itemizedlist> + + <para>You may as well add other marking related comments.</para> + </section> + </chapter> +</book> diff --git a/Klausuren/Sda1/2018Summer/Solve/Schema/bib.xsd b/Klausuren/Sda1/2018Summer/Solve/Schema/bib.xsd new file mode 100644 index 000000000..0a532d7ce --- /dev/null +++ b/Klausuren/Sda1/2018Summer/Solve/Schema/bib.xsd @@ -0,0 +1,97 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" > + + <xs:attribute name="id" type="xs:string"/> + + <xs:element name="title" type="xs:string"/> + <xs:element name="author" type="xs:string"/> + <xs:element name="editor" type="xs:string"/> + + + <xs:element name="bibliography"> + <xs:complexType> + <xs:sequence> + <xs:element ref="publishers" minOccurs="0"/> + <xs:choice minOccurs="0" maxOccurs="unbounded"> + <xs:element ref="book"/> + <xs:element ref="website"/> + </xs:choice> + </xs:sequence> + </xs:complexType> + + <xs:key name="uniquePublisher"> + <xs:selector xpath="publishers/publisher"/> + <xs:field xpath="@id"/> + </xs:key> + + <xs:key name="uniquePublisherNameCity"> + <xs:selector xpath="publishers/publisher"/> + <xs:field xpath="name"/> + <xs:field xpath="city"/> + </xs:key> + + <xs:key name="uniquePublicationId"> + <xs:selector xpath="book|website"/> + <xs:field xpath="@id"/> + </xs:key> + + <xs:keyref refer="uniquePublisher" name="bookToPublisher"> + <xs:selector xpath="book"/> + <xs:field xpath="@publisher"/> + </xs:keyref> + + </xs:element> + + <xs:element name="book"> + <xs:complexType> + <xs:sequence> + <xs:element ref="title"/> + <xs:choice minOccurs="1" maxOccurs="unbounded"> + <xs:element ref="author"/> + <xs:element ref="editor"/> + </xs:choice> + </xs:sequence> + <xs:attribute ref="id" use="required"/> + <xs:attribute name="publisher" type="xs:string" use="required"/> + <xs:attribute name="year" type="xs:integer" use="required"/> + </xs:complexType> + </xs:element> + + <xs:element name="website"> + <xs:complexType> + <xs:sequence> + <xs:element name="uri" > + <xs:simpleType> + <xs:restriction base="xs:anyURI"> + <xs:pattern value="http[s]?://.+"></xs:pattern> + </xs:restriction> + </xs:simpleType> + </xs:element> + <xs:element ref="title"/> + <xs:element ref="author" minOccurs="0" maxOccurs="unbounded"/> + </xs:sequence> + <xs:attribute ref="id" use="required"/> + <xs:attribute name="access" use="required" type="xs:date"/> + + </xs:complexType> + </xs:element> + + <xs:element name="publishers"> + <xs:complexType> + <xs:sequence> + <xs:element ref="publisher" minOccurs="0" maxOccurs="unbounded"/> + </xs:sequence> + </xs:complexType> + </xs:element> + + <xs:element name="publisher"> + <xs:complexType> + <xs:sequence> + <xs:element name="name" type="xs:string"/> + <xs:element name="city" type="xs:string"/> + </xs:sequence> + <xs:attribute ref="id" use="required"/> + </xs:complexType> + </xs:element> + +</xs:schema> \ No newline at end of file diff --git a/Klausuren/Sda1/2018Summer/Solve/Schema/sampledata.xml b/Klausuren/Sda1/2018Summer/Solve/Schema/sampledata.xml new file mode 100644 index 000000000..0c02b30f5 --- /dev/null +++ b/Klausuren/Sda1/2018Summer/Solve/Schema/sampledata.xml @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8"?> +<bibliography xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="bib.xsd" > + + <publishers> + + <publisher id="springer"> + <name>Springer</name> + <city>Berlin / Germany</city> + </publisher> + + <publisher id="addWesley"> + <name>Addison-Wesley</name> + <city>Reading, Massachusetts / USA</city> + </publisher> + </publishers> + + <book id="ab94" publisher="springer" year="1994"> + <title>Infinite Dimensional Analysis</title> + <author>Charalambos D. Aliprantis</author> + <author>Kim C. Border</author> + </book> + + <book id="goossens93" publisher="addWesley" year="1993"> + <title>The LaTeX Companion</title> + <author>Michel Goossens</author> + <author>Frank Mittelbach</author> + <author>Alexander Samarin</author> + </book> + + <website id="bibtex" access="2018-07-15"> + <uri>https://en.wikipedia.org/wiki/BibTeX</uri> + <title>BiBTeX - Wikipedia</title> + <!-- Optional: <author>...</author> --> + </website> + +</bibliography> \ No newline at end of file diff --git a/Klausuren/Sda1/2018Summer/Solve/Schema/schema.sql b/Klausuren/Sda1/2018Summer/Solve/Schema/schema.sql new file mode 100644 index 000000000..f5889ff41 --- /dev/null +++ b/Klausuren/Sda1/2018Summer/Solve/Schema/schema.sql @@ -0,0 +1,38 @@ +DROP TABLE IF EXISTS Competition; +DROP TABLE IF EXISTS Athlete; + +CREATE TABLE Athlete ( + id INT NOT NULL PRIMARY KEY + ,fullName CHAR(20) NOT NULL +); + +CREATE TABLE Competition ( + id INT PRIMARY KEY + ,athlete INT NOT NULL REFERENCES Athlete(id) + ,time NUMERIC(6,2) NOT NULL + ,badStart BOOLEAN NOT NULL +); + +INSERT INTO Athlete VALUES(1, 'Jesse Owens'); +INSERT INTO Athlete VALUES(2, 'Tim Culver'); +INSERT INTO Athlete VALUES(3, 'Sid Gascoine'); +INSERT INTO Athlete VALUES(4, 'John Hooker'); +INSERT INTO Athlete VALUES(5, 'Brad Duncan'); + +/* 100 metre race */ +INSERT INTO Competition VALUES(1, 1, 10.23, 0); /* Jesse Owens */ +INSERT INTO Competition VALUES(2, 2, 11.55, 0); /* Tim Culver */ +INSERT INTO Competition VALUES(3, 3, 11.94, 0); /* Sid Gascoine */ +INSERT INTO Competition VALUES(4, 4, 10.02, 0); /* John Hooker */ +INSERT INTO Competition VALUES(5, 5, 10.84, 0); /* Brad Duncan */ +INSERT INTO Competition VALUES(6, 2, 10.02, 0); /* Tim Culver */ +INSERT INTO Competition VALUES(7, 3, 10.49, 0); /* Sid Gascoine */ +INSERT INTO Competition VALUES(8, 2, 9.35, 1); /* Tim Culver */ + + +SELECT fullName, min(time) as time +FROM Competition, Athlete +WHERE Competition.athlete = Athlete.id + AND badStart =0 +GROUP BY (fullName) +ORDER BY time, fullName; \ No newline at end of file diff --git a/Klausuren/Sda1/2018Summer/Solve/SchemaTest/0100_valid_minimum.xml b/Klausuren/Sda1/2018Summer/Solve/SchemaTest/0100_valid_minimum.xml new file mode 100644 index 000000000..6fe9ce498 --- /dev/null +++ b/Klausuren/Sda1/2018Summer/Solve/SchemaTest/0100_valid_minimum.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<bibliography xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../Schema/bib.xsd" /> + +<?xmlTest points = "1" + expectedToBeValid = "true" ?> \ No newline at end of file diff --git a/Klausuren/Sda1/2018Summer/Solve/SchemaTest/0200_valid_noPublisher.xml b/Klausuren/Sda1/2018Summer/Solve/SchemaTest/0200_valid_noPublisher.xml new file mode 100644 index 000000000..d94f266ba --- /dev/null +++ b/Klausuren/Sda1/2018Summer/Solve/SchemaTest/0200_valid_noPublisher.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<bibliography xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../Schema/bib.xsd" > + <publishers/> +</bibliography> + +<?xmlTest points = "1" + expectedToBeValid = "true" +?> diff --git a/Klausuren/Sda1/2018Summer/Solve/SchemaTest/0210_valid_singlePublisher.xml b/Klausuren/Sda1/2018Summer/Solve/SchemaTest/0210_valid_singlePublisher.xml new file mode 100644 index 000000000..03b298355 --- /dev/null +++ b/Klausuren/Sda1/2018Summer/Solve/SchemaTest/0210_valid_singlePublisher.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<bibliography xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../Schema/bib.xsd" > + <publishers> + <publisher id="one"> + <name>Publisher 1</name> + <city>City 1</city> + </publisher> + </publishers> +</bibliography> + +<?xmlTest points = "1" + expectedToBeValid = "true" +?> diff --git a/Klausuren/Sda1/2018Summer/Solve/SchemaTest/0230_valid_multiplePublisher.xml b/Klausuren/Sda1/2018Summer/Solve/SchemaTest/0230_valid_multiplePublisher.xml new file mode 100644 index 000000000..2087c1d5e --- /dev/null +++ b/Klausuren/Sda1/2018Summer/Solve/SchemaTest/0230_valid_multiplePublisher.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<bibliography xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../Schema/bib.xsd" > + <publishers> + + <publisher id="one"> + <name>Publisher 1</name> + <city>City 1</city> + </publisher> + + <publisher id="two"> + <name>Publisher 1</name> + <city>City 2</city> + </publisher> + + <publisher id="three"> + <name>Publisher 2</name> + <city>City 1</city> + </publisher> + + </publishers> +</bibliography> + +<?xmlTest points = "1" + expectedToBeValid = "true" +?> diff --git a/Klausuren/Sda1/2018Summer/Solve/SchemaTest/0240_invalid_duplicatePublisherId.xml b/Klausuren/Sda1/2018Summer/Solve/SchemaTest/0240_invalid_duplicatePublisherId.xml new file mode 100644 index 000000000..5be0d6a31 --- /dev/null +++ b/Klausuren/Sda1/2018Summer/Solve/SchemaTest/0240_invalid_duplicatePublisherId.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<bibliography xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../Schema/bib.xsd" > + <publishers> + <publisher id="one"> + <name>Publisher 1</name> + <city>City 1</city> + </publisher> + <publisher id="one"> <!-- Duplicate @id value »one« --> + <name>Publisher 2</name> + <city>City 2</city> + </publisher> + </publishers> +</bibliography> + +<?xmlTest points = "2" + expectedToBeValid = "false" + preconditionValid = "0230_valid_multiplePublisher.xml" +?> diff --git a/Klausuren/Sda1/2018Summer/Solve/SchemaTest/0250_invalid_duplicatePublisherNameCity.xml b/Klausuren/Sda1/2018Summer/Solve/SchemaTest/0250_invalid_duplicatePublisherNameCity.xml new file mode 100644 index 000000000..bb87c7ad6 --- /dev/null +++ b/Klausuren/Sda1/2018Summer/Solve/SchemaTest/0250_invalid_duplicatePublisherNameCity.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<bibliography xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../Schema/bib.xsd" > + <publishers> + <publisher id="one"> + <name>Publisher 1</name> + <city>City 1</city> + </publisher> + <publisher id="two"> + <!-- Error: duplicate both <name> and <city> --> + <name>Publisher 1</name> + <city>City 1</city> + </publisher> + </publishers> +</bibliography> + +<?xmlTest points = "2" + expectedToBeValid = "false" + preconditionValid = "0230_valid_multiplePublisher.xml" +?> diff --git a/Klausuren/Sda1/2018Summer/Solve/SchemaTest/0260_invalid_publisherLevel.xml b/Klausuren/Sda1/2018Summer/Solve/SchemaTest/0260_invalid_publisherLevel.xml new file mode 100644 index 000000000..e0381013b --- /dev/null +++ b/Klausuren/Sda1/2018Summer/Solve/SchemaTest/0260_invalid_publisherLevel.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<bibliography xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../Schema/bib.xsd" > + + <!-- Wrong level: Only <publishers> allowed here --> + <publisher id="unknown">Nobody</publisher> +</bibliography> + +<?xmlTest points = "2" + expectedToBeValid = "false" + preconditionValid = "0230_valid_multiplePublisher.xml" +?> diff --git a/Klausuren/Sda1/2018Summer/Solve/SchemaTest/0300_valid_books.xml b/Klausuren/Sda1/2018Summer/Solve/SchemaTest/0300_valid_books.xml new file mode 100644 index 000000000..e885646f7 --- /dev/null +++ b/Klausuren/Sda1/2018Summer/Solve/SchemaTest/0300_valid_books.xml @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<bibliography xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../Schema/bib.xsd" > + <publishers> + + <publisher id="springer"> + <name>Springer</name> + <city>Berlin / Germany</city> + </publisher> + + <publisher id="addWesley"> + <name>Addison-Wesley</name> + <city>Reading, Massachusetts / USA</city> + </publisher> + + </publishers> + + <book id="ab92" publisher="springer" year="1994"> + <title>Infinite Dimensional Analysis</title> + <author>Charalambos D. Aliprantis</author> + </book> + + <book id="ab94" publisher="springer" year="1994"> + <title>Infinite Dimensional Analysis</title> + <editor>Charalambos D. Aliprantis</editor> + </book> + + <book id="ab95" publisher="springer" year="1994"> + <title>Infinite Dimensional Analysis</title> + <editor>Charalambos D. Aliprantis</editor> + <author>Kim C. Border</author> + </book> + + <book id="goossens93" publisher="addWesley" year="1993"> + <title>The LaTeX Companion</title> + <author>Michel Goossens</author> + <author>Frank Mittelbach</author> + <author>Alexander Samarin</author> + </book> + + <book id="ab96" publisher="springer" year="1994"> + <title>Infinite Dimensional Analysis</title> + <editor>Charalambos D. Aliprantis</editor> + <editor>Kim C. Border</editor> + </book> + + <book id="ab97" publisher="springer" year="1994"> + <title>Infinite Dimensional Analysis</title> + <author>Charalambos D. Aliprantis</author> + <author>Kim C. Border</author> + </book> + + +</bibliography> + +<?xmlTest points = "1" + expectedToBeValid = "true" +?> diff --git a/Klausuren/Sda1/2018Summer/Solve/SchemaTest/0310_invalid_bookNoTitle.xml b/Klausuren/Sda1/2018Summer/Solve/SchemaTest/0310_invalid_bookNoTitle.xml new file mode 100644 index 000000000..2ed105de3 --- /dev/null +++ b/Klausuren/Sda1/2018Summer/Solve/SchemaTest/0310_invalid_bookNoTitle.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<bibliography xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../Schema/bib.xsd" > + <publishers> + + <publisher id="springer"> + <name>Springer</name> + <city>Berlin / Germany</city> + </publisher> + + </publishers> + + <book id="ab94" publisher="springer" year="1994"> + <!-- Error: Missing <title> --> + <author>Charalambos D. Aliprantis</author> + <author>Kim C. Border</author> + </book> + +</bibliography> + +<?xmlTest points = "2" + expectedToBeValid = "false" + preconditionValid = "0300_valid_books.xml" +?> diff --git a/Klausuren/Sda1/2018Summer/Solve/SchemaTest/0320_invalid_bookNoAuthor.xml b/Klausuren/Sda1/2018Summer/Solve/SchemaTest/0320_invalid_bookNoAuthor.xml new file mode 100644 index 000000000..6cc7372ee --- /dev/null +++ b/Klausuren/Sda1/2018Summer/Solve/SchemaTest/0320_invalid_bookNoAuthor.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<bibliography xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../Schema/bib.xsd" > + <publishers> + + <publisher id="springer"> + <name>Springer</name> + <city>Berlin / Germany</city> + </publisher> + + </publishers> + + <book id="ab94" publisher="springer" year="1994"> + <title>Infinite Dimensional Analysis</title> + <!-- Neither <author> nor <editor> --> + </book> + +</bibliography> + +<?xmlTest points = "2" + expectedToBeValid = "false" + preconditionValid = "0300_valid_books.xml" +?> diff --git a/Klausuren/Sda1/2018Summer/Solve/SchemaTest/0400_valid_websites.xml b/Klausuren/Sda1/2018Summer/Solve/SchemaTest/0400_valid_websites.xml new file mode 100644 index 000000000..db66a0739 --- /dev/null +++ b/Klausuren/Sda1/2018Summer/Solve/SchemaTest/0400_valid_websites.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<bibliography xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../Schema/bib.xsd" > + + <website id="bibtex" access="2018-07-15"> + <uri>https://en.wikipedia.org/wiki/BibTeX</uri> + <title>BiBTeX - Wikipedia</title> + </website> + + <website id="bibtex2" access="2018-07-15"> + <uri>https://en.wikipedia.org/wiki/BibTeX</uri> + <title>BiBTeX - Wikipedia</title> + <author>Unknown</author> + </website> + + +</bibliography> + +<?xmlTest points = "1" + expectedToBeValid = "true" +?> diff --git a/Klausuren/Sda1/2018Summer/Solve/SchemaTest/0410_invalid_websiteDateViolation.xml b/Klausuren/Sda1/2018Summer/Solve/SchemaTest/0410_invalid_websiteDateViolation.xml new file mode 100644 index 000000000..602bb91ef --- /dev/null +++ b/Klausuren/Sda1/2018Summer/Solve/SchemaTest/0410_invalid_websiteDateViolation.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<bibliography xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../Schema/bib.xsd" > + + <website id="bibtex" access="15.7.2018"> <!-- Error: Wrong date format --> + <uri>https://en.wikipedia.org/wiki/BibTeX</uri> + <title>BiBTeX - Wikipedia</title> + </website> + +</bibliography> + +<?xmlTest points = "2" + expectedToBeValid = "false" + preconditionValid = "0400_valid_websites.xml" +?> diff --git a/Klausuren/Sda1/2018Summer/Solve/SchemaTest/0420_invalid_websiteMissingAccessDate.xml b/Klausuren/Sda1/2018Summer/Solve/SchemaTest/0420_invalid_websiteMissingAccessDate.xml new file mode 100644 index 000000000..46653e14d --- /dev/null +++ b/Klausuren/Sda1/2018Summer/Solve/SchemaTest/0420_invalid_websiteMissingAccessDate.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<bibliography xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../Schema/bib.xsd" > + + <website id="bibtex"> <!-- Error: missing access date --> + <uri>https://en.wikipedia.org/wiki/BibTeX</uri> + <title>BiBTeX - Wikipedia</title> + </website> + + +</bibliography> + +<?xmlTest points = "2" + expectedToBeValid = "false" + preconditionValid = "0400_valid_websites.xml" +?> diff --git a/Klausuren/Sda1/2018Summer/Solve/SchemaTest/0430_invalid_websiteMissingUrl.xml b/Klausuren/Sda1/2018Summer/Solve/SchemaTest/0430_invalid_websiteMissingUrl.xml new file mode 100644 index 000000000..0dac7dc4d --- /dev/null +++ b/Klausuren/Sda1/2018Summer/Solve/SchemaTest/0430_invalid_websiteMissingUrl.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<bibliography xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../Schema/bib.xsd" > + + <website id="bibtex" access="2018-07-15"> + <!-- Error: Missing <uri> --> + <title>BiBTeX - Wikipedia</title> + </website> + +</bibliography> + +<?xmlTest points = "2" + expectedToBeValid = "false" + preconditionValid = "0400_valid_websites.xml" +?> diff --git a/Klausuren/Sda1/2018Summer/Solve/SchemaTest/0440_invalid_websiteUrlFormatViolation.xml b/Klausuren/Sda1/2018Summer/Solve/SchemaTest/0440_invalid_websiteUrlFormatViolation.xml new file mode 100644 index 000000000..15462cc3e --- /dev/null +++ b/Klausuren/Sda1/2018Summer/Solve/SchemaTest/0440_invalid_websiteUrlFormatViolation.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<bibliography xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../Schema/bib.xsd" > + + <website id="bibtex" access="2018-07-15"> + <!-- Error: Invalid URI --> + <uri>Jodel dodel düüh</uri> + <title>BiBTeX - Wikipedia</title> + </website> + +</bibliography> + +<?xmlTest points = "2" + expectedToBeValid = "false" + preconditionValid = "0400_valid_websites.xml" +?> diff --git a/Klausuren/Sda1/2018Summer/Solve/SchemaTest/0500_valid_booksWebsites.xml b/Klausuren/Sda1/2018Summer/Solve/SchemaTest/0500_valid_booksWebsites.xml new file mode 100644 index 000000000..799683142 --- /dev/null +++ b/Klausuren/Sda1/2018Summer/Solve/SchemaTest/0500_valid_booksWebsites.xml @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<bibliography xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../Schema/bib.xsd" > + <publishers> + + <publisher id="springer"> + <name>Springer</name> + <city>Berlin / Germany</city> + </publisher> + + </publishers> + + <book id="ab92" publisher="springer" year="1994"> + <title>Infinite Dimensional Analysis</title> + <author>Charalambos D. Aliprantis</author> + </book> + + <book id="ab94" publisher="springer" year="1994"> + <title>Infinite Dimensional Analysis</title> + <editor>Charalambos D. Aliprantis</editor> + </book> + + <website id="bibtex" access="2018-07-15"> + <uri>https://en.wikipedia.org/wiki/BibTeX</uri> + <title>BiBTeX - Wikipedia</title> + </website> + + <book id="ab95" publisher="springer" year="1994"> + <title>Infinite Dimensional Analysis</title> + <editor>Charalambos D. Aliprantis</editor> + <author>Kim C. Border</author> + </book> + + <book id="ab96" publisher="springer" year="1994"> + <title>Infinite Dimensional Analysis</title> + <editor>Charalambos D. Aliprantis</editor> + <editor>Kim C. Border</editor> + </book> + + <book id="ab97" publisher="springer" year="1994"> + <title>Infinite Dimensional Analysis</title> + <author>Charalambos D. Aliprantis</author> + <author>Kim C. Border</author> + </book> + + <website id="bibtex2" access="2018-07-15"> + <uri>https://en.wikipedia.org/wiki/BibTeX</uri> + <title>BiBTeX - Wikipedia</title> + <author>Unknown</author> + </website> + + +</bibliography> + +<?xmlTest points = "1" + expectedToBeValid = "true" +?> diff --git a/Klausuren/Sda1/2018Summer/Solve/SchemaTest/0510_invalid_bookDuplicateId.xml b/Klausuren/Sda1/2018Summer/Solve/SchemaTest/0510_invalid_bookDuplicateId.xml new file mode 100644 index 000000000..149d73269 --- /dev/null +++ b/Klausuren/Sda1/2018Summer/Solve/SchemaTest/0510_invalid_bookDuplicateId.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<bibliography xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../Schema/bib.xsd" > + + <publishers> + + <publisher id="springer"> + <name>Springer</name> + <city>Berlin / Germany</city> + </publisher> + + </publishers> + + <book id="ab92" publisher="springer" year="1994"> + <title>Infinite Dimensional Analysis</title> + <author>Charalambos D. Aliprantis</author> + </book> + + <!-- Error: Duplicate @id value --> + <book id="ab92" publisher="springer" year="1994"> + <title>Infinite Dimensional Analysis</title> + <editor>Charalambos D. Aliprantis</editor> + </book> + + +</bibliography> + +<?xmlTest points = "1" + expectedToBeValid = "false" + preconditionValid = "0500_valid_booksWebsites.xml" +?> \ No newline at end of file diff --git a/Klausuren/Sda1/2018Summer/Solve/SchemaTest/0515_invalid_bookYear.xml b/Klausuren/Sda1/2018Summer/Solve/SchemaTest/0515_invalid_bookYear.xml new file mode 100644 index 000000000..e0171e495 --- /dev/null +++ b/Klausuren/Sda1/2018Summer/Solve/SchemaTest/0515_invalid_bookYear.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<bibliography xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../Schema/bib.xsd" > + + <publishers> + + <publisher id="springer"> + <name>Springer</name> + <city>Berlin / Germany</city> + </publisher> + + </publishers> + + <book id="ab92" publisher="springer" year="nineteenhundred"> <!-- Error: @year not an integer value --> + + <title>Infinite Dimensional Analysis</title> + <author>Charalambos D. Aliprantis</author> + </book> + +</bibliography> + +<?xmlTest points = "1" + expectedToBeValid = "false" + preconditionValid = "0500_valid_booksWebsites.xml" +?> \ No newline at end of file diff --git a/Klausuren/Sda1/2018Summer/Solve/SchemaTest/0520_invalid_bibDuplicateId.xml b/Klausuren/Sda1/2018Summer/Solve/SchemaTest/0520_invalid_bibDuplicateId.xml new file mode 100644 index 000000000..08dd10089 --- /dev/null +++ b/Klausuren/Sda1/2018Summer/Solve/SchemaTest/0520_invalid_bibDuplicateId.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<bibliography xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../Schema/bib.xsd" > + + <publishers> + + <publisher id="springer"> + <name>Springer</name> + <city>Berlin / Germany</city> + </publisher> + + </publishers> + + <book id="bibtex" publisher="springer" year="1994"> + <title>Infinite Dimensional Analysis</title> + <author>Charalambos D. Aliprantis</author> + </book> + + <!-- Error: Duplicate @id value --> + <website id="bibtex" access="2018-07-15"> + <uri>https://en.wikipedia.org/wiki/BibTeX</uri> + <title>BiBTeX - Wikipedia</title> + </website> + +</bibliography> + +<?xmlTest points = "1" + expectedToBeValid = "false" + preconditionValid = "0500_valid_booksWebsites.xml" +?> \ No newline at end of file diff --git a/Klausuren/Sda1/2018Summer/Solve/SchemaTest/0600_invalid_bookInvalidPublisher.xml b/Klausuren/Sda1/2018Summer/Solve/SchemaTest/0600_invalid_bookInvalidPublisher.xml new file mode 100644 index 000000000..c7ae42ca5 --- /dev/null +++ b/Klausuren/Sda1/2018Summer/Solve/SchemaTest/0600_invalid_bookInvalidPublisher.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<bibliography xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../Schema/bib.xsd" > + + <publishers> + + <publisher id="springer"> + <name>Springer</name> + <city>Berlin / Germany</city> + </publisher> + + </publishers> + + <!-- Error: Invalid reference »spring« rather than »springer« --> + <book id="ab92" publisher="spring" year="1994"> + <title>Infinite Dimensional Analysis</title> + <author>Charalambos D. Aliprantis</author> + </book> + + +</bibliography> + +<?xmlTest points = "1" + expectedToBeValid = "false" + preconditionValid = "0300_valid_books.xml" +?> \ No newline at end of file diff --git a/Klausuren/Sda1/2018Summer/Solve/SchemaTest/0700_valid_bibPublisherIdCompat.xml b/Klausuren/Sda1/2018Summer/Solve/SchemaTest/0700_valid_bibPublisherIdCompat.xml new file mode 100644 index 000000000..bfe447b1a --- /dev/null +++ b/Klausuren/Sda1/2018Summer/Solve/SchemaTest/0700_valid_bibPublisherIdCompat.xml @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<bibliography xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../Schema/bib.xsd" > + <publishers> + + <publisher id="springer"> + <name>Springer</name> + <city>Berlin / Germany</city> + </publisher> + + <publisher id="addWesley"> + <name>Addison-Wesley</name> + <city>Reading, Massachusetts / USA</city> + </publisher> + + </publishers> + + <!-- Should not interfere with <publisher id="springer"> entry --> + <book id="springer" publisher="springer" year="1994"> + <title>Infinite Dimensional Analysis</title> + <author>Charalambos D. Aliprantis</author> + </book> + + <book id="ab94" publisher="springer" year="1994"> + <title>Infinite Dimensional Analysis</title> + <editor>Charalambos D. Aliprantis</editor> + </book> + + <!-- Should not interfere with <publisher id="addWesley"> entry --> + <website id="addWesley" access="2018-07-15"> + <uri>https://en.wikipedia.org/wiki/BibTeX</uri> + <title>BiBTeX - Wikipedia</title> + <!-- Optional: <author>...</author> --> + </website> + + +</bibliography> + +<?xmlTest points = "1" + expectedToBeValid = "true" +?> diff --git a/Klausuren/Sda1/2018Summer/Solve/pom.xml b/Klausuren/Sda1/2018Summer/Solve/pom.xml new file mode 100644 index 000000000..0ff1239e3 --- /dev/null +++ b/Klausuren/Sda1/2018Summer/Solve/pom.xml @@ -0,0 +1,166 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <groupId>de.hdm_stuttgart.mi.sda1</groupId> + <artifactId>solve</artifactId> + <version>0.9</version> + <packaging>jar</packaging> + + <name>Solve</name> + + <url>http://www.mi.hdm-stuttgart.de/freedocs/topic/de.hdm_stuttgart.mi.lectures/sd1SectUsingMaven.html</url> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <oxygenxml.version>20.1.0.0</oxygenxml.version> + </properties> + + <repositories> + + <repository> + <id>hdm-mi-internal-maven-repo</id> + <url>https://maven.mi.hdm-stuttgart.de/nexus/repository/mi-maven</url> + </repository> + <repository> + <id>oxygenxml-repo</id> + <url>https://maven.mi.hdm-stuttgart.de/nexus/repository/oxygen</url> + </repository> + </repositories> + + <dependencies> + + <dependency> + <groupId>com.oxygenxml</groupId> + <artifactId>oxygen-xercesImpl</artifactId> + <version>${oxygenxml.version}</version> + </dependency> + + <dependency> + <groupId>com.oxygenxml</groupId> + <artifactId>oxygen</artifactId> + <version>${oxygenxml.version}</version> + </dependency> + + <!-- Still needed to keep oxygenxml happy using legacy logging --> + <dependency> + <groupId>log4j</groupId> + <artifactId>log4j</artifactId> + <version>1.2.17</version> + </dependency> + + <dependency> + <groupId>com.rackspace.eclipse.webtools.sourceediting</groupId> + <artifactId>org.eclipse.wst.xml.xpath2.processor</artifactId> + <version>2.1.100</version> + </dependency> + + <dependency> + <groupId>mysql</groupId> + <artifactId>mysql-connector-java</artifactId> + <version>6.0.6</version> + </dependency> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.12</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-core</artifactId> + <version>2.10.0</version> + </dependency> + + <dependency> + <groupId>javax.xml.bind</groupId> + <artifactId>jaxb-api</artifactId> + <version>2.3.0</version> + </dependency> + + <!-- Required for executable jar generation to avoid ClassNotFoundException: + com.fasterxml.jackson.core.type.TypeReference and similar dependency problems. --> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-databind</artifactId> + <version>2.9.3</version> + </dependency> + + <dependency> + <groupId>org.jdom</groupId> + <artifactId>jdom2</artifactId> + <version>2.0.6</version> + </dependency> + + <dependency> + <groupId>jaxen</groupId> + <artifactId>jaxen</artifactId> + <version>1.1.6</version> + </dependency> + + <dependency> + <groupId>de.hdm_stuttgart.mi.exam</groupId> + <artifactId>unitmarking</artifactId> + <version>0.9</version> + </dependency> + + </dependencies> + + <build> + + <plugins> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.7.0</version> + <configuration> + <source>1.9</source> + <target>1.9</target> + <compilerArgument>-proc:none</compilerArgument> + </configuration> + </plugin> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-javadoc-plugin</artifactId> + <version>3.0.1</version> + <configuration> + <links> + <link>https://docs.oracle.com/javase/10/docs/api</link> + </links> + <additionalJOptions> + <additionalJOption>-html5</additionalJOption> + </additionalJOptions> + </configuration> + </plugin> + + <plugin> + <artifactId>maven-assembly-plugin</artifactId> + <version>2.3</version> + <configuration> + <descriptor>src/main/assembly/assembly.xml</descriptor> + </configuration> + <executions> + <execution> + <id>make-assembly</id> + <phase>package</phase> + <goals> + <goal>single</goal> + </goals> + <configuration> + <archive> + <manifest> + <mainClass>de.hdm_stuttgart.mi.sda1.test.ShowReachedPoints</mainClass> + </manifest> + </archive> + </configuration> + </execution> + </executions> + </plugin> + + </plugins> + </build> +</project> diff --git a/Klausuren/Sda1/2018Summer/Solve/src/main/assembly/assembly.xml b/Klausuren/Sda1/2018Summer/Solve/src/main/assembly/assembly.xml new file mode 100644 index 000000000..1a2cd6054 --- /dev/null +++ b/Klausuren/Sda1/2018Summer/Solve/src/main/assembly/assembly.xml @@ -0,0 +1,36 @@ +<assembly + xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd"> + <id>fat-tests</id> + <formats> + <format>jar</format> + </formats> + <includeBaseDirectory>false</includeBaseDirectory> + <dependencySets> + <dependencySet> + <outputDirectory>/</outputDirectory> + <useProjectArtifact>true</useProjectArtifact> + <unpack>true</unpack> + <scope>test</scope> + </dependencySet> + </dependencySets> + <fileSets> + <fileSet> + <directory>${project.build.directory}/test-classes</directory> + <outputDirectory>/</outputDirectory> + <includes> + <include>**/*.class</include> + </includes> + <useDefaultExcludes>true</useDefaultExcludes> + </fileSet> + <fileSet> + <directory>${project.build.directory}/classes</directory> + <outputDirectory>/</outputDirectory> + <includes> + <include>**/*.class</include> + </includes> + <useDefaultExcludes>true</useDefaultExcludes> + </fileSet> + </fileSets> +</assembly> diff --git a/Klausuren/Sda1/2018Summer/Solve/src/main/java/de/hdm_stuttgart/mi/sda1/AllResults.java b/Klausuren/Sda1/2018Summer/Solve/src/main/java/de/hdm_stuttgart/mi/sda1/AllResults.java new file mode 100644 index 000000000..842561492 --- /dev/null +++ b/Klausuren/Sda1/2018Summer/Solve/src/main/java/de/hdm_stuttgart/mi/sda1/AllResults.java @@ -0,0 +1,16 @@ + package de.hdm_stuttgart.mi.sda1; + + + import de.hdm_stuttgart.mi.sda1.impl.DbRead; + import de.hdm_stuttgart.mi.sda1.impl.DbReadDuplicate; + + public class AllResults { + + public static void main( String[] args ) { + + final DbRead sports = new DbReadDuplicate(); + sports.readDatabase(); + + sports.toHtml(System.out); + } + } \ No newline at end of file diff --git a/Klausuren/Sda1/2018Summer/Solve/src/main/java/de/hdm_stuttgart/mi/sda1/FinalResults.java b/Klausuren/Sda1/2018Summer/Solve/src/main/java/de/hdm_stuttgart/mi/sda1/FinalResults.java new file mode 100644 index 000000000..4d12bbc54 --- /dev/null +++ b/Klausuren/Sda1/2018Summer/Solve/src/main/java/de/hdm_stuttgart/mi/sda1/FinalResults.java @@ -0,0 +1,16 @@ + package de.hdm_stuttgart.mi.sda1; + + + import de.hdm_stuttgart.mi.sda1.impl.DbRead; + import de.hdm_stuttgart.mi.sda1.impl.DbReadUnique; + + public class FinalResults { + + public static void main( String[] args ) { + + final DbRead sports = new DbReadUnique(); + sports.readDatabase(); + + sports.toHtml(System.out); + } + } \ No newline at end of file diff --git a/Klausuren/Sda1/2018Summer/Solve/src/main/java/de/hdm_stuttgart/mi/sda1/impl/DbRead.java b/Klausuren/Sda1/2018Summer/Solve/src/main/java/de/hdm_stuttgart/mi/sda1/impl/DbRead.java new file mode 100644 index 000000000..8fe96cf05 --- /dev/null +++ b/Klausuren/Sda1/2018Summer/Solve/src/main/java/de/hdm_stuttgart/mi/sda1/impl/DbRead.java @@ -0,0 +1,83 @@ + package de.hdm_stuttgart.mi.sda1.impl; + + import org.jdom2.Element; + import org.jdom2.output.Format; + import org.jdom2.output.XMLOutputter; + + import java.io.IOException; + import java.io.OutputStream; + import java.sql.Connection; + import java.sql.DriverManager; + import java.sql.ResultSet; + import java.sql.SQLException; + + abstract public class DbRead { + + final String sqlQuery; + + public final Element html; + private final Element table; + + private final Connection conn; + + public DbRead(final String sqlQuery) { + this.sqlQuery = sqlQuery; + html = new Element("html"); + append(append(html, "head"), "title", "Results"); + table = append(append(html, "body"), "table"); + + final Element headerLine = append(table, "tr"); + append(headerLine, "th", "Rank"); + append(headerLine, "th", "Name"); + append(headerLine, "th", "Time / seconds"); + + Connection connTmp = null; + try { + connTmp = DriverManager.getConnection( + "jdbc:mysql://localhost/hdm?serverTimezone=UTC", "hdmuser", "XYZ"); + } catch (SQLException e) { + System.err.println("Unable to establish connection: " + e); + System.exit(1); + } + conn = connTmp; + } + + protected abstract void insertRecord(final ResultSet result, final Element row, final int rank) + throws SQLException; + + public void readDatabase() { + try { + final ResultSet results = conn.createStatement().executeQuery(sqlQuery); + int rank = 1; + while(results.next()) { + insertRecord(results, append(table, "tr"), rank++); + } + } catch (final SQLException e) { + System.err.println("Database access error: " + e); + System.exit(1); + } + } + + + static protected Element append(final Element parent, final String tagname) { + final Element child = new Element(tagname); + parent.addContent(child); + return child; + } + static protected void append(final Element parent, final String tagname, final String text) { + final Element child = new Element(tagname); + child.addContent(text); + parent.addContent(child); + } + + public void toHtml(final OutputStream out) { + + final XMLOutputter printer = + new XMLOutputter(Format.getPrettyFormat()); + try { + printer.output(html, out); + } catch (final IOException e) { + System.err.println("Unable to write output: " + e); + } + } + } \ No newline at end of file diff --git a/Klausuren/Sda1/2018Summer/Solve/src/main/java/de/hdm_stuttgart/mi/sda1/impl/DbReadDuplicate.java b/Klausuren/Sda1/2018Summer/Solve/src/main/java/de/hdm_stuttgart/mi/sda1/impl/DbReadDuplicate.java new file mode 100644 index 000000000..346fff7e8 --- /dev/null +++ b/Klausuren/Sda1/2018Summer/Solve/src/main/java/de/hdm_stuttgart/mi/sda1/impl/DbReadDuplicate.java @@ -0,0 +1,30 @@ +package de.hdm_stuttgart.mi.sda1.impl; + +import org.jdom2.Element; + +import java.sql.ResultSet; +import java.sql.SQLException; + +public class DbReadDuplicate extends DbRead { + + static private final String sqlQuery = + "SELECT fullName, time, badStart\n" + + "FROM Competition, Athlete\n" + + "WHERE Competition.athlete = Athlete.id\n" + + "ORDER BY time, fullName"; + + public DbReadDuplicate() { + super(sqlQuery); + } + + @Override + protected void insertRecord(final ResultSet result, final Element row, final int rank) throws SQLException { + append(row, "td", "" + rank); + append(row, "td", result.getString("fullName")); + append(row, "td", result.getString("time")); + + if (result.getBoolean("badStart")) { + row.setAttribute("style", "background: red;"); + } + } +} diff --git a/Klausuren/Sda1/2018Summer/Solve/src/main/java/de/hdm_stuttgart/mi/sda1/impl/DbReadUnique.java b/Klausuren/Sda1/2018Summer/Solve/src/main/java/de/hdm_stuttgart/mi/sda1/impl/DbReadUnique.java new file mode 100644 index 000000000..af2499159 --- /dev/null +++ b/Klausuren/Sda1/2018Summer/Solve/src/main/java/de/hdm_stuttgart/mi/sda1/impl/DbReadUnique.java @@ -0,0 +1,29 @@ +package de.hdm_stuttgart.mi.sda1.impl; + +import org.jdom2.Element; + +import java.sql.ResultSet; +import java.sql.SQLException; + +public class DbReadUnique extends DbRead { + static private final String sqlQuery = + "SELECT fullName, min(time) as time\n" + + "FROM Competition, Athlete\n" + + "WHERE Competition.athlete = Athlete.id\n" + + " AND badStart = 0\n" + + "GROUP BY (fullName)\n" + + "ORDER BY time, fullName"; + + public DbReadUnique() { + super(sqlQuery); + } + + @Override + protected void insertRecord(final ResultSet result, final Element row, final int rank) throws SQLException { + append(row, "td", "" + rank); + append(row, "td", result.getString("fullName")); + append(row, "td", result.getString("time")); + } + + +} diff --git a/Klausuren/Sda1/2018Summer/Solve/src/main/resources/log4j2.xml b/Klausuren/Sda1/2018Summer/Solve/src/main/resources/log4j2.xml new file mode 100644 index 000000000..d7a0dcb77 --- /dev/null +++ b/Klausuren/Sda1/2018Summer/Solve/src/main/resources/log4j2.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Configuration> + <Appenders> + <File name="A1" fileName="A1.log" append="false"> + <PatternLayout pattern="%t %-5p %c{2} - %m%n"/> + </File> + <Console name="STDOUT" target="SYSTEM_OUT"> + <PatternLayout pattern="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/> + </Console> + </Appenders> + <Loggers> + <!-- You may want to enable more detailed hibernate logging --> + <Logger name="org.hibernate" level="error"> + <AppenderRef ref="A1"/> + </Logger> + <Root level="error"> + <AppenderRef ref="STDOUT"/> + </Root> + </Loggers> +</Configuration> \ No newline at end of file diff --git a/Klausuren/Sda1/2018Summer/Solve/src/test/java/de/hdm_stuttgart/mi/sda1/test/ex1/SchemaTest.java b/Klausuren/Sda1/2018Summer/Solve/src/test/java/de/hdm_stuttgart/mi/sda1/test/ex1/SchemaTest.java new file mode 100644 index 000000000..82e54951d --- /dev/null +++ b/Klausuren/Sda1/2018Summer/Solve/src/test/java/de/hdm_stuttgart/mi/sda1/test/ex1/SchemaTest.java @@ -0,0 +1,26 @@ +package de.hdm_stuttgart.mi.sda1.test.ex1; + +import de.hdm_stuttgart.mi.unitmarking.xsd.InstanceSetEvaluation; +import org.junit.Assert; +import org.junit.Test; + +/** + * Unit test for an XML instance set. CLI by: + * java -cp target/solvejpa-0.9-fat-tests.jar org.junit.runner.JUnitCore SchemaTest + */ +@SuppressWarnings("static-method") +public class SchemaTest { + /** + * Testing a suite of XML instances. + */ + @Test + public void testXmlInstanceSet() { + + final InstanceSetEvaluation ise = + new InstanceSetEvaluation("SchemaTest", "Schema/bib.xsd"); + + System.out.println(ise.getMessages()); + + Assert.assertTrue(ise.getErrorMessages(), ise.allTestsSucceeded); + } +} \ No newline at end of file -- GitLab