Revision: 1892
Author: [email protected]
Date: Wed May 26 06:23:31 2010
Log: Added test cases and fix in existing test case for testing RDF+XML
docs such as those submitted by the form created for Issue 285
http://code.google.com/p/simal/source/detail?r=1892
Added:
/trunk/uk.ac.osswatch.simal.core/src/main/resources/testData/testAddFromForm.xml
/trunk/uk.ac.osswatch.simal.core/src/main/resources/testData/testAddFromFormSimpler.xml
/trunk/uk.ac.osswatch.simal.core/src/test/java/uk/ac/osswatch/simal/integrationTest/model/repository/TestAddFileToRepository.java
Modified:
/trunk/uk.ac.osswatch.simal.core/src/test/java/uk/ac/osswatch/simal/integrationTest/model/repository/TestRepository.java
=======================================
--- /dev/null
+++
/trunk/uk.ac.osswatch.simal.core/src/main/resources/testData/testAddFromForm.xml
Wed May 26 06:23:31 2010
@@ -0,0 +1,167 @@
+<!--
+ Copyright 2010 University of Oxford
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
+ xmlns="http://usefulinc.com/ns/doap#"
+ xmlns:foaf="http://xmlns.com/foaf/0.1/"
+ xmlns:v="http://www.w3.org/2006/vcard/ns#"
+ xmlns:dc="http://purl.org/dc/core/"
+ xmlns:dcterms="http://purl.org/dc/terms/"
+ xmlns:simal="http://oss-watch.ac.uk/ns/0.2/simal#"
+ xmlns:cerif="http://www.dotac.info/ontology/CERIF2008.owl#"
+>
+<Project rdf:about="http://simal.oss-watch.ac.uk/FromForm">
+ <created>2010-4-23</created>
+ <name>2</name>
+ <shortname>1</shortname>
+ <shortdesc xml:lang="en">3</shortdesc>
+ <description xml:lang="en">4</description>
+ <homepage rdf:resource="http://8p.com"/>
+ <blog rdf:resource="http://5p.com"/>
+ <foaf:seeAlso dc:title="Project blog" rdf:resource="http://6p.com"
dc:format="application/rss+xml" />
+ <simal:reporter>
+ <foaf:Person
rdf:about="http://registry.oss-watch.ac.uk/people/aa2604078923b0f0e875a0bd31430f3ebe5890ae">
+ <foaf:name>52</foaf:name>
+ <foaf:mbox rdf:resource="mailto:[email protected]" />
+
<foaf:mbox_sha1sum>aa2604078923b0f0e875a0bd31430f3ebe5890ae</foaf:mbox_sha1sum>
+ <foaf:phone>54</foaf:phone>
+ <foaf:skypeID>55</foaf:skypeID>
+ </foaf:Person>
+ </simal:reporter>
+ <simal:reporter>
+ <foaf:Person rdfs:label="Project account"
rdf:about="http://registry.oss-watch.ac.uk/people/2f9b380a3aac2ac0aa543e2d6d4e75b89de736e2">
+ <foaf:mbox rdf:resource="mailto:[email protected]" />
+ </foaf:Person>
+ </simal:reporter>
+ <foaf:fundedBy>
+ <foaf:Organization rdf:about="http://www.jisc.ac.uk">
+ <foaf:name>JISC</foaf:name>
+ </foaf:Organization>
+ </foaf:fundedBy>
+ <simal:fundingManager>59</simal:fundingManager>
+<vendor><foaf:Organization dc:title="Lead
institution"><foaf:name>49</foaf:name><foaf:member><foaf:Organization
dc:title="Department"><foaf:name>50</foaf:name>
+<foaf:based_near><v:Address><v:postal-code>51</v:postal-code></v:Address></foaf:based_near></foaf:Organization></foaf:member>
+
<simal:projectPartner><foaf:Organization><foaf:name>56</foaf:name></foaf:Organization></simal:projectPartner>
+
<simal:projectPartner><foaf:Organization><foaf:name>64</foaf:name></foaf:Organization></simal:projectPartner>
+</foaf:Organization></vendor>
+ <bug-database rdf:resource="http://58p.com"/>
+ <license rdf:resource="http://usefulinc.com/doap/licenses/lgpl"/>
+ <category
rdf:resource="http://registry.oss-watch.ac.uk/categories/standards"
rdfs:label="Standards" />
+ <category
rdf:resource="http://registry.oss-watch.ac.uk/categories/article"
rdfs:label="Article" />
+ <audience>Developers</audience>
+ <audience>Undergraduate Students</audience>
+ <simal:project-director>
+ <foaf:Person rdf:about="http://11p.com">
+ <foaf:name>9</foaf:name>
+ <foaf:homepage rdf:resource="http://11p.com/"/>
+ <foaf:depiction rdf:resource="http://12p.com/"/>
+ <foaf:mbox rdf:resource="mailto:[email protected]" />
+
<foaf:mbox_sha1sum>c2caa38b62766454bfe5d2ea498c7c56ec2771c3</foaf:mbox_sha1sum>
+ </foaf:Person>
+ </simal:project-director>
+ <simal:project-manager>
+ <foaf:Person rdf:about="http://15p.com">
+ <foaf:name>13</foaf:name>
+ <foaf:homepage rdf:resource="http://15p.com/"/>
+ <foaf:depiction rdf:resource="http://16p.com/"/>
+ <foaf:mbox rdf:resource="mailto:[email protected]" />
+
<foaf:mbox_sha1sum>c5373eecbcff177b8fbe06dc33850e0d604b1c20</foaf:mbox_sha1sum>
+ </foaf:Person>
+ </simal:project-manager>
+ <simal:administrative-assistant>
+ <foaf:Person rdf:about="http://19p.com">
+ <foaf:name>17</foaf:name>
+ <foaf:homepage rdf:resource="http://19p.com/"/>
+ <foaf:depiction rdf:resource="http://20p.com/"/>
+ <foaf:mbox rdf:resource="mailto:[email protected]" />
+
<foaf:mbox_sha1sum>57f5f98c7afd407b5f7e534e078cbfc8fdab23be</foaf:mbox_sha1sum>
+ </foaf:Person>
+ </simal:administrative-assistant>
+ <simal:research-officer>
+ <foaf:Person rdf:about="http://23p.com">
+ <foaf:name>21</foaf:name>
+ <foaf:homepage rdf:resource="http://23p.com/"/>
+ <foaf:depiction rdf:resource="http://24p.com/"/>
+ <foaf:mbox rdf:resource="mailto:[email protected]" />
+
<foaf:mbox_sha1sum>d9d7531e13d87dd5f3048ee268c7ecdb5b2d6a31</foaf:mbox_sha1sum>
+ </foaf:Person>
+ </simal:research-officer>
+ <maintainer>
+ <foaf:Person rdf:about="http://27p.com">
+ <foaf:name>25</foaf:name>
+ <foaf:homepage rdf:resource="http://27p.com/"/>
+ <foaf:depiction rdf:resource="http://28p.com/"/>
+ <foaf:mbox rdf:resource="mailto:[email protected]" />
+
<foaf:mbox_sha1sum>cc0461880ac45b6111c766e50ec369b8d451d707</foaf:mbox_sha1sum>
+ </foaf:Person>
+ </maintainer>
+ <developer>
+ <foaf:Person rdf:about="http://31p.com">
+ <foaf:name>29</foaf:name>
+ <foaf:homepage rdf:resource="http://31p.com/"/>
+ <foaf:depiction rdf:resource="http://32p.com/"/>
+ <foaf:mbox rdf:resource="mailto:[email protected]" />
+
<foaf:mbox_sha1sum>d3c9e765c537811c9af69f0d19dad6017c26efbb</foaf:mbox_sha1sum>
+ </foaf:Person>
+ </developer>
+ <documenter>
+ <foaf:Person rdf:about="http://35p.com">
+ <foaf:name>33</foaf:name>
+ <foaf:homepage rdf:resource="http://35p.com/"/>
+ <foaf:depiction rdf:resource="http://36p.com/"/>
+ <foaf:mbox rdf:resource="mailto:[email protected]" />
+
<foaf:mbox_sha1sum>6343e61891e42beb6315766812b63bbb309e0973</foaf:mbox_sha1sum>
+ </foaf:Person>
+ </documenter>
+ <tester>
+ <foaf:Person rdf:about="http://39p.com">
+ <foaf:name>37</foaf:name>
+ <foaf:homepage rdf:resource="http://39p.com/"/>
+ <foaf:depiction rdf:resource="http://40p.com/"/>
+ <foaf:mbox rdf:resource="mailto:[email protected]" />
+
<foaf:mbox_sha1sum>f96fe5e1586def77982a06396f3f9828af304c4e</foaf:mbox_sha1sum>
+ </foaf:Person>
+ </tester>
+ <helper>
+ <foaf:Person rdf:about="http://43p.com">
+ <foaf:name>41</foaf:name>
+ <foaf:homepage rdf:resource="http://43p.com/"/>
+ <foaf:depiction rdf:resource="http://44p.com/"/>
+ <foaf:mbox rdf:resource="mailto:[email protected]" />
+
<foaf:mbox_sha1sum>09360dae46c250ac0e63376e26e2df275fc15abf</foaf:mbox_sha1sum>
+ </foaf:Person>
+ </helper>
+ <translator>
+ <foaf:Person rdf:about="http://47p.com">
+ <foaf:name>45</foaf:name>
+ <foaf:homepage rdf:resource="http://47p.com/"/>
+ <foaf:depiction rdf:resource="http://48p.com/"/>
+ <foaf:mbox rdf:resource="mailto:[email protected]" />
+
<foaf:mbox_sha1sum>63d37e6884fbbf4466953e132426b541ac10061d</foaf:mbox_sha1sum>
+ </foaf:Person>
+ </translator>
+ <repository>
+ <HgRepository>
+ <location rdf:resource="http://57p.com"/>
+ <browse rdf:resource="http://57p.com"/>
+ </HgRepository>
+ </repository>
+ <programming-language>60</programming-language>
+ <programming-language>61</programming-language>
+ <programming-language>62</programming-language>
+ <programming-language>63</programming-language>
+</Project>
+</rdf:RDF>
=======================================
--- /dev/null
+++
/trunk/uk.ac.osswatch.simal.core/src/main/resources/testData/testAddFromFormSimpler.xml
Wed May 26 06:23:31 2010
@@ -0,0 +1,111 @@
+<!--
+ Copyright 2010 University of Oxford
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns="http://usefulinc.com/ns/doap#"
+ xmlns:foaf="http://xmlns.com/foaf/0.1/"
xmlns:v="http://www.w3.org/2006/vcard/ns#"
+ xmlns:dc="http://purl.org/dc/core/"
xmlns:dcterms="http://purl.org/dc/terms/"
+ xmlns:simal="http://oss-watch.ac.uk/ns/0.2/simal#"
xmlns:cerif="http://www.dotac.info/ontology/CERIF2008.owl#">
+ <Project rdf:about="http://simal.oss-watch.ac.uk/FromFormSimpler">
+ <created>2010-4-27</created>
+ <name>Full name of project</name>
+ <shortname>Unique</shortname>
+ <shortdesc xml:lang="en">Short project description (120 c
+ </shortdesc>
+ <description xml:lang="en">Long project description (3-5
+ sentences):</description>
+ <homepage rdf:resource="http://homepage.com" />
+ <blog rdf:resource="http://Project.xom" />
+ <foaf:seeAlso dc:title="Project blog"
rdf:resource="http://ATOM.com"
+ dc:format="application/rss+xml" />
+ <simal:reporter>
+ <foaf:Person
+
rdf:about="http://registry.oss-watch.ac.uk/people/c3280d032e60566faacf872360b2295dfe276a21">
+ <foaf:name>Perons responsible</foaf:name>
+ <foaf:mbox
rdf:resource="mailto:[email protected]" />
+
<foaf:mbox_sha1sum>c3280d032e60566faacf872360b2295dfe276a21
+ </foaf:mbox_sha1sum>
+ <foaf:phone>26541</foaf:phone>
+ <foaf:skypeID>dkyupw</foaf:skypeID>
+ </foaf:Person>
+ </simal:reporter>
+ <simal:reporter>
+ <foaf:Person rdfs:label="Project account"
+
rdf:about="http://registry.oss-watch.ac.uk/people/e6bb677cd7d7292d64932befba888ab4ab0c1fe8">
+ <foaf:mbox rdf:resource="mailto:[email protected]"
/>
+ </foaf:Person>
+ </simal:reporter>
+ <foaf:fundedBy>
+ <foaf:Organization rdf:about="http://www.jisc.ac.uk">
+ <foaf:name>JISC</foaf:name>
+ </foaf:Organization>
+ </foaf:fundedBy>
+ <simal:fundingManager>programme manager</simal:fundingManager>
+ <vendor>
+ <foaf:Organization dc:title="Lead institution">
+ <foaf:name>Name of lead institution</foaf:name>
+ <foaf:member>
+ <foaf:Organization
dc:title="Department">
+ <foaf:name>Department where
project is primarily located
+ </foaf:name>
+ <foaf:based_near>
+ <v:Address>
+
<v:postal-code>Postcode </v:postal-code>
+ </v:Address>
+ </foaf:based_near>
+ </foaf:Organization>
+ </foaf:member>
+ <simal:projectPartner>
+ <foaf:Organization>
+ <foaf:name>project</foaf:name>
+ </foaf:Organization>
+ </simal:projectPartner>
+ <simal:projectPartner>
+ <foaf:Organization>
+ <foaf:name>partners</foaf:name>
+ </foaf:Organization>
+ </simal:projectPartner>
+ </foaf:Organization>
+ </vendor>
+ <bug-database rdf:resource="http://issue.tracker.com" />
+ <license rdf:resource="http://usefulinc.com/doap/licenses/gplv3"
/>
+ <license rdf:resource="http://usefulinc.com/doap/licenses/CC-UK"
/>
+ <category
rdf:resource="http://registry.oss-watch.ac.uk/categories/web-basedtools"
+ rdfs:label="Web-based tools" />
+ <category
rdf:resource="http://registry.oss-watch.ac.uk/categories/report"
+ rdfs:label="Report" />
+ <audience>Teachers/Lecturers</audience>
+ <audience>Graduate Students</audience>
+ <simal:project-director>
+ <foaf:Person
+
rdf:about="http://registry.oss-watch.ac.uk/people/8b65345235bade6821c087cfe9d487c5be194ce6">
+ <foaf:name>project director</foaf:name>
+ <foaf:depiction
rdf:resource="http://pic.com/pic.jpg/" />
+ <foaf:mbox
rdf:resource="mailto:[email protected]" />
+
<foaf:mbox_sha1sum>8b65345235bade6821c087cfe9d487c5be194ce6
+ </foaf:mbox_sha1sum>
+ </foaf:Person>
+ </simal:project-director>
+ <repository>
+ <BKRepository>
+ <location rdf:resource="http://bit.keeper.com"
/>
+ <browse rdf:resource="http://bit.keeper.com" />
+ </BKRepository>
+ </repository>
+ <programming-language>primay</programming-language>
+ <programming-language>programming</programming-language>
+ <programming-language>languages</programming-language>
+ </Project>
+</rdf:RDF>
=======================================
--- /dev/null
+++
/trunk/uk.ac.osswatch.simal.core/src/test/java/uk/ac/osswatch/simal/integrationTest/model/repository/TestAddFileToRepository.java
Wed May 26 06:23:31 2010
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2010 University of Oxford
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package uk.ac.osswatch.simal.integrationTest.model.repository;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.net.URISyntaxException;
+
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import uk.ac.osswatch.simal.SimalRepositoryFactory;
+import uk.ac.osswatch.simal.model.IProject;
+import uk.ac.osswatch.simal.rdf.ISimalRepository;
+import uk.ac.osswatch.simal.rdf.SimalRepositoryException;
+
+import static junit.framework.Assert.fail;
+
+/**
+ * test common activities relating to Projects.
+ *
+ */
+public class TestAddFileToRepository extends BaseRepositoryTest {
+ private static final Logger LOGGER = LoggerFactory
+ .getLogger(TestAddFileToRepository.class);
+
+ private static final String[] PROJECT_URIS = {
+ "http://simal.oss-watch.ac.uk/FromForm",
+ "http://simal.oss-watch.ac.uk/FromFormSimpler" };
+
+ private static final String[] ADD_FROM_FORM_FILE = {
+ "testData/testAddFromForm.xml", "testData/testAddFromFormSimpler.xml"
};
+
+ @Test
+ public void testAdd() throws SimalRepositoryException,
URISyntaxException,
+ IOException {
+ int i = 0;
+ for (String testFileName : ADD_FROM_FORM_FILE) {
+ File testFile = new File(ISimalRepository.class.getClassLoader()
+ .getResource(testFileName).toURI());
+
+ FileInputStream fis = new FileInputStream(testFile);
+ try {
+ int x = fis.available();
+ byte b[] = new byte[x];
+ fis.read(b);
+ String data = new String(b);
+ getRepository().add(data);
+ } catch (Exception e) {
+ LOGGER.warn("Exception adding test data: " + e.getMessage(), e);
+ fail();
+ } finally {
+ fis.close();
+ IProject project1 =
SimalRepositoryFactory.getProjectService().getProject(PROJECT_URIS[i]);
+ if(project1 != null) {
+ project1.delete();
+ }
+ i++;
+ }
+ }
+ }
+
+}
=======================================
---
/trunk/uk.ac.osswatch.simal.core/src/test/java/uk/ac/osswatch/simal/integrationTest/model/repository/TestRepository.java
Wed Nov 25 15:03:27 2009
+++
/trunk/uk.ac.osswatch.simal.core/src/test/java/uk/ac/osswatch/simal/integrationTest/model/repository/TestRepository.java
Wed May 26 06:23:31 2010
@@ -42,6 +42,7 @@
import uk.ac.osswatch.simal.model.ModelSupport;
import uk.ac.osswatch.simal.rdf.ISimalRepository;
import uk.ac.osswatch.simal.rdf.SimalRepositoryException;
+import uk.ac.osswatch.simal.rdf.io.RDFUtils;
/**
* test common activities relating to Projects.
@@ -144,7 +145,10 @@
project1 =
SimalRepositoryFactory.getProjectService().findProjectBySeeAlso(TEST_PROJECT_URI);
assertNotNull("We don't seem to have added the test data as expected",
project1);
- logger.debug("Starting testAdd(data)");
+ testProjectID = project1.getUniqueSimalID();
+ testProjectURI = RDFUtils.getDefaultProjectURI(testProjectID);
+ testDeveloperURI = RDFUtils.getDefaultPersonURI(testDeveloperID);
+ logger.debug("Ending testAdd(data)");
}
@Test
--
You received this message because you are subscribed to the Google Groups "Simal
Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/simal-commits?hl=en.