You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@creadur.apache.org by rd...@apache.org on 2011/11/29 20:17:41 UTC
svn commit: r1208033 - in
/incubator/rat/whisker/trunk/apache-whisker-xml/src:
main/java/org/apache/rat/whisker/fromxml/
main/java/org/apache/rat/whisker/out/
test/java/org/apache/rat/whisker/fromxml/
Author: rdonkin
Date: Tue Nov 29 19:17:39 2011
New Revision: 1208033
URL: http://svn.apache.org/viewvc?rev=1208033&view=rev
Log:
Build organisation model from xml
Removed:
incubator/rat/whisker/trunk/apache-whisker-xml/src/main/java/org/apache/rat/whisker/out/Organisation.java
Modified:
incubator/rat/whisker/trunk/apache-whisker-xml/src/main/java/org/apache/rat/whisker/fromxml/JDomBuilder.java
incubator/rat/whisker/trunk/apache-whisker-xml/src/main/java/org/apache/rat/whisker/out/ByOrganisation.java
incubator/rat/whisker/trunk/apache-whisker-xml/src/main/java/org/apache/rat/whisker/out/WithLicense.java
incubator/rat/whisker/trunk/apache-whisker-xml/src/main/java/org/apache/rat/whisker/out/WithinDirectory.java
incubator/rat/whisker/trunk/apache-whisker-xml/src/main/java/org/apache/rat/whisker/out/Work.java
incubator/rat/whisker/trunk/apache-whisker-xml/src/test/java/org/apache/rat/whisker/fromxml/JDomBuilderOrganisationTest.java
Modified: incubator/rat/whisker/trunk/apache-whisker-xml/src/main/java/org/apache/rat/whisker/fromxml/JDomBuilder.java
URL: http://svn.apache.org/viewvc/incubator/rat/whisker/trunk/apache-whisker-xml/src/main/java/org/apache/rat/whisker/fromxml/JDomBuilder.java?rev=1208033&r1=1208032&r2=1208033&view=diff
==============================================================================
--- incubator/rat/whisker/trunk/apache-whisker-xml/src/main/java/org/apache/rat/whisker/fromxml/JDomBuilder.java (original)
+++ incubator/rat/whisker/trunk/apache-whisker-xml/src/main/java/org/apache/rat/whisker/fromxml/JDomBuilder.java Tue Nov 29 19:17:39 2011
@@ -68,7 +68,10 @@ public class JDomBuilder {
*/
public Organisation organisation(Element element) throws UnexpectedElementException {
if (ORGANISATION_ELEMENT_NAME.equals(element.getName())) {
- return null;
+ return new Organisation(
+ element.getAttributeValue("id"),
+ element.getAttributeValue("name"),
+ element.getAttributeValue("url"));
} else {
throw unexpectedElementException(element, ORGANISATION_ELEMENT_NAME);
}
Modified: incubator/rat/whisker/trunk/apache-whisker-xml/src/main/java/org/apache/rat/whisker/out/ByOrganisation.java
URL: http://svn.apache.org/viewvc/incubator/rat/whisker/trunk/apache-whisker-xml/src/main/java/org/apache/rat/whisker/out/ByOrganisation.java?rev=1208033&r1=1208032&r2=1208033&view=diff
==============================================================================
--- incubator/rat/whisker/trunk/apache-whisker-xml/src/main/java/org/apache/rat/whisker/out/ByOrganisation.java (original)
+++ incubator/rat/whisker/trunk/apache-whisker-xml/src/main/java/org/apache/rat/whisker/out/ByOrganisation.java Tue Nov 29 19:17:39 2011
@@ -25,6 +25,7 @@ import java.util.Map;
import java.util.TreeSet;
import org.apache.rat.whisker.fromxml.JDomBuilder;
+import org.apache.rat.whisker.model.Organisation;
import org.apache.rat.whisker.model.Resource;
import org.jdom.Element;
Modified: incubator/rat/whisker/trunk/apache-whisker-xml/src/main/java/org/apache/rat/whisker/out/WithLicense.java
URL: http://svn.apache.org/viewvc/incubator/rat/whisker/trunk/apache-whisker-xml/src/main/java/org/apache/rat/whisker/out/WithLicense.java?rev=1208033&r1=1208032&r2=1208033&view=diff
==============================================================================
--- incubator/rat/whisker/trunk/apache-whisker-xml/src/main/java/org/apache/rat/whisker/out/WithLicense.java (original)
+++ incubator/rat/whisker/trunk/apache-whisker-xml/src/main/java/org/apache/rat/whisker/out/WithLicense.java Tue Nov 29 19:17:39 2011
@@ -23,6 +23,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.apache.rat.whisker.model.Organisation;
import org.jdom.Element;
/**
Modified: incubator/rat/whisker/trunk/apache-whisker-xml/src/main/java/org/apache/rat/whisker/out/WithinDirectory.java
URL: http://svn.apache.org/viewvc/incubator/rat/whisker/trunk/apache-whisker-xml/src/main/java/org/apache/rat/whisker/out/WithinDirectory.java?rev=1208033&r1=1208032&r2=1208033&view=diff
==============================================================================
--- incubator/rat/whisker/trunk/apache-whisker-xml/src/main/java/org/apache/rat/whisker/out/WithinDirectory.java (original)
+++ incubator/rat/whisker/trunk/apache-whisker-xml/src/main/java/org/apache/rat/whisker/out/WithinDirectory.java Tue Nov 29 19:17:39 2011
@@ -24,6 +24,7 @@ import java.util.Collections;
import java.util.List;
import java.util.Map;
+import org.apache.rat.whisker.model.Organisation;
import org.jdom.Element;
/**
Modified: incubator/rat/whisker/trunk/apache-whisker-xml/src/main/java/org/apache/rat/whisker/out/Work.java
URL: http://svn.apache.org/viewvc/incubator/rat/whisker/trunk/apache-whisker-xml/src/main/java/org/apache/rat/whisker/out/Work.java?rev=1208033&r1=1208032&r2=1208033&view=diff
==============================================================================
--- incubator/rat/whisker/trunk/apache-whisker-xml/src/main/java/org/apache/rat/whisker/out/Work.java (original)
+++ incubator/rat/whisker/trunk/apache-whisker-xml/src/main/java/org/apache/rat/whisker/out/Work.java Tue Nov 29 19:17:39 2011
@@ -26,6 +26,8 @@ import java.util.List;
import java.util.Map;
import java.util.TreeSet;
+import org.apache.rat.whisker.fromxml.JDomBuilder;
+import org.apache.rat.whisker.model.Organisation;
import org.jdom.Document;
import org.jdom.Element;
@@ -45,7 +47,7 @@ public class Work {
for (final Element element:
(List<Element>) document.getRootElement().getChild("organisations").getChildren("organisation")) {
- new Organisation(element).storeIn(organisationsById);
+ new JDomBuilder().organisation(element).storeIn(organisationsById);
}
return Collections.unmodifiableMap(organisationsById);
}
Modified: incubator/rat/whisker/trunk/apache-whisker-xml/src/test/java/org/apache/rat/whisker/fromxml/JDomBuilderOrganisationTest.java
URL: http://svn.apache.org/viewvc/incubator/rat/whisker/trunk/apache-whisker-xml/src/test/java/org/apache/rat/whisker/fromxml/JDomBuilderOrganisationTest.java?rev=1208033&r1=1208032&r2=1208033&view=diff
==============================================================================
--- incubator/rat/whisker/trunk/apache-whisker-xml/src/test/java/org/apache/rat/whisker/fromxml/JDomBuilderOrganisationTest.java (original)
+++ incubator/rat/whisker/trunk/apache-whisker-xml/src/test/java/org/apache/rat/whisker/fromxml/JDomBuilderOrganisationTest.java Tue Nov 29 19:17:39 2011
@@ -18,6 +18,7 @@
*/
package org.apache.rat.whisker.fromxml;
+import org.apache.rat.whisker.model.Organisation;
import org.jdom.Element;
import junit.framework.TestCase;
@@ -39,6 +40,16 @@ public class JDomBuilderOrganisationTest
super.tearDown();
}
+ public void testOrganisationSetsIdNameUrl() throws Exception {
+ final Organisation result = subject.organisation(
+ new Element("organisation")
+ .setAttribute("name", "a name")
+ .setAttribute("url", "an url")
+ .setAttribute("id", "an id"));
+ assertNotNull("Builder should build an organisation", result);
+
+ }
+
public void testThrowIllegalArgumentWhenResourceIsNotOrganisation() throws Exception {
try {
subject.organisation(