summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYuhong Yin2012-05-29 23:12:27 (EDT)
committer Yuhong Yin2012-05-29 23:12:27 (EDT)
commitda38ce1c94e6f948dbbdf2fe4a50be417871a548 (patch)
tree1181db3f2e9abbd980123b7d6dbb3859574dbc9e
parent4168fd1f63f95e95d1062bd7544bafb3b9dd5f75 (diff)
downloadorg.eclipse.lyo.testsuite-da38ce1c94e6f948dbbdf2fe4a50be417871a548.zip
org.eclipse.lyo.testsuite-da38ce1c94e6f948dbbdf2fe4a50be417871a548.tar.gz
org.eclipse.lyo.testsuite-da38ce1c94e6f948dbbdf2fe4a50be417871a548.tar.bz2
Bug 379588 - Refactor the test suite and add QM testsrefs/changes/64/6164/1
-rw-r--r--org.eclipse.lyo.testsuite.server/assessment/cm/config/cq/cq-setupv1.properties5
-rw-r--r--org.eclipse.lyo.testsuite.server/assessment/cm/config/rtc/rtc-json-template.json4
-rw-r--r--org.eclipse.lyo.testsuite.server/assessment/cm/config/rtc/rtc-json-template2.json4
-rw-r--r--org.eclipse.lyo.testsuite.server/assessment/cm/config/rtc/rtc-setupv2.properties4
-rw-r--r--org.eclipse.lyo.testsuite.server/assessment/cm/config/rtc/rtc-template2.xml2
-rw-r--r--org.eclipse.lyo.testsuite.server/config/rqm/rqm-setupv2.properties18
-rw-r--r--org.eclipse.lyo.testsuite.server/config/rqm/rqm-template2.xml4
-rw-r--r--org.eclipse.lyo.testsuite.server/config/rqm/rqm-update2.xml2
-rw-r--r--org.eclipse.lyo.testsuite.server/config/rtc/rtc-json-template.json4
-rw-r--r--org.eclipse.lyo.testsuite.server/config/rtc/rtc-json-template2.json4
-rw-r--r--org.eclipse.lyo.testsuite.server/config/rtc/rtc-setupv2.properties4
-rw-r--r--org.eclipse.lyo.testsuite.server/config/rtc/rtc-template2.xml2
-rw-r--r--org.eclipse.lyo.testsuite.server/pom.xml10
-rw-r--r--org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/CoreResourceJsonTests.java156
-rw-r--r--org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/CoreResourceRdfXmlTests.java239
-rw-r--r--org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/CoreResourceXmlTests.java284
-rw-r--r--org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/ServiceProviderRdfXmlTests.java2
-rw-r--r--org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/SimplifiedQueryAtomTests.java1
-rw-r--r--org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/TestsBase.java104
-rw-r--r--org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/cm/ChangeRequestJsonTests.java118
-rw-r--r--org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/cm/ChangeRequestRdfXmlTests.java176
-rw-r--r--org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/cm/ChangeRequestXmlTests.java220
-rw-r--r--org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/qm/TestCaseRdfXmlTests.java48
-rw-r--r--org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/qm/TestCaseXmlTests.java59
-rw-r--r--org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/qm/TestExecutionRecordRdfXmlTests.java47
-rw-r--r--org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/qm/TestExecutionRecordXmlTests.java71
-rw-r--r--org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/qm/TestPlanRdfXmlTests.java47
-rw-r--r--org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/qm/TestPlanXmlTests.java52
-rw-r--r--org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/qm/TestResultRdfXmlTests.java47
-rw-r--r--org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/qm/TestResultXmlTests.java113
-rw-r--r--org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/qm/TestScriptRdfXmlTests.java47
-rw-r--r--org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/qm/TestScriptXmlTests.java58
-rw-r--r--org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/server/DynamicSuiteBuilder.java15
-rw-r--r--org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/server/util/OSLCConstants.java27
-rw-r--r--org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/server/util/OSLCNamespaceContext.java6
35 files changed, 1473 insertions, 531 deletions
diff --git a/org.eclipse.lyo.testsuite.server/assessment/cm/config/cq/cq-setupv1.properties b/org.eclipse.lyo.testsuite.server/assessment/cm/config/cq/cq-setupv1.properties
index 5354e47..8dd0de2 100644
--- a/org.eclipse.lyo.testsuite.server/assessment/cm/config/cq/cq-setupv1.properties
+++ b/org.eclipse.lyo.testsuite.server/assessment/cm/config/cq/cq-setupv1.properties
@@ -15,7 +15,7 @@
###############################################################################
##GENERAL PROPERTIES##
#The location of the top level ServiceProviderCatalog or Service Description Document
-baseUri=http://quagmire.rtp.raleigh.ibm.com/cqweb/oslc/repo/7.0.0/db/
+baseUri=https://quagmire.rtp.raleigh.ibm.com/cqweb/oslc/repo/7.0.0/db/
#Implementation name (for identification purposes)
implName=CQ
#The authentication style (currently supports only BASIC, not FORM)
@@ -27,9 +27,6 @@ pw=
# Values: http://open-services.net/xmlns/cm/1.0/ | http://open-services.net/ns/cm# | both
testVersions=http://open-services.net/xmlns/cm/1.0/
-# Values: 1 | 2 | both
-testVersions=1
-
##QUERY PROPERTIES##
#The query parameter that should be used to test equality
queryEqualityProperty=Headline
diff --git a/org.eclipse.lyo.testsuite.server/assessment/cm/config/rtc/rtc-json-template.json b/org.eclipse.lyo.testsuite.server/assessment/cm/config/rtc/rtc-json-template.json
index ac2d12b..0503719 100644
--- a/org.eclipse.lyo.testsuite.server/assessment/cm/config/rtc/rtc-json-template.json
+++ b/org.eclipse.lyo.testsuite.server/assessment/cm/config/rtc/rtc-json-template.json
@@ -1,6 +1,6 @@
{
"dc:title":"templatedDefect",
"dc:description":"templatedDefect",
- "dc:type":{"rdf:resource":"https:\/\/quagmire.rtp.raleigh.ibm.com:9443\/ccm\/oslc\/types\/_gvEIUPJkEd-aL_39nkcG1w\/com.ibm.team.apt.workItemType.story"},
- "rtc_cm:filedAgainst":{"rdf:resource":"https:\/\/quagmire.rtp.raleigh.ibm.com:9443\/ccm\/resource\/itemOid\/com.ibm.team.workitem.Category\/_h1wDkPJkEd-aL_39nkcG1w"}
+ "dc:type":{"rdf:resource":"https:\/\/quagmire.rtp.raleigh.ibm.com:14443\/ccm\/oslc\/types\/_gvEIUPJkEd-aL_39nkcG1w\/defect"},
+ "rtc_cm:filedAgainst":{"rdf:resource":"https:\/\/quagmire.rtp.raleigh.ibm.com:14443\/ccm\/resource\/itemOid\/com.ibm.team.workitem.Category\/_YmXa8phVEeGB3JzLyv0BEg"}
} \ No newline at end of file
diff --git a/org.eclipse.lyo.testsuite.server/assessment/cm/config/rtc/rtc-json-template2.json b/org.eclipse.lyo.testsuite.server/assessment/cm/config/rtc/rtc-json-template2.json
index 2cbe9f7..3cffe3d 100644
--- a/org.eclipse.lyo.testsuite.server/assessment/cm/config/rtc/rtc-json-template2.json
+++ b/org.eclipse.lyo.testsuite.server/assessment/cm/config/rtc/rtc-json-template2.json
@@ -1,6 +1,6 @@
{
"dcterms:title":"templatedDefect",
"dcterms:description":"templatedDefect",
- "dcterms:type":{"rdf:resource":"https:\/\/quagmire.rtp.raleigh.ibm.com:14443\/ccm\/oslc\/types\/_0BaKsZM6EeGkr92VMSYrdg\/com.ibm.team.apt.workItemType.story"},
- "rtc_cm:filedAgainst":{"rdf:resource":"https:\/\/quagmire.rtp.raleigh.ibm.com:14443\/ccm\/resource\/itemOid\/com.ibm.team.workitem.Category\//_0qfj8pM6EeGkr92VMSYrdg"}
+ "dcterms:type":{"rdf:resource":"https:\/\/quagmire.rtp.raleigh.ibm.com:14443\/ccm\/oslc\/types\/_YBdMgJhUEeGB3JzLyv0BEg\/defect"},
+ "rtc_cm:filedAgainst":{"rdf:resource":"https:\/\/quagmire.rtp.raleigh.ibm.com:14443\/ccm\/resource\/itemOid\/com.ibm.team.workitem.Category\/_YmXa8phVEeGB3JzLyv0BEg"}
} \ No newline at end of file
diff --git a/org.eclipse.lyo.testsuite.server/assessment/cm/config/rtc/rtc-setupv2.properties b/org.eclipse.lyo.testsuite.server/assessment/cm/config/rtc/rtc-setupv2.properties
index c13a6a6..a32cf1e 100644
--- a/org.eclipse.lyo.testsuite.server/assessment/cm/config/rtc/rtc-setupv2.properties
+++ b/org.eclipse.lyo.testsuite.server/assessment/cm/config/rtc/rtc-setupv2.properties
@@ -29,10 +29,14 @@ pw=oslctest
# Values: http://open-services.net/xmlns/cm/1.0/ | http://open-services.net/ns/cm# | both
testVersions=http://open-services.net/ns/cm#
+# Specify a service provider to use if there are multiple
+
+useThisServiceProvider = https://quagmire.rtp.raleigh.ibm.com:14443/ccm/oslc/contexts/_YBdMgJhUEeGB3JzLyv0BEg/workitems/services.xml
# Determine if tests should follow all possible links: Service Catalogs, Service Providers, Query Capabilities, etc.
# Default is runOnlyOnce=true, which will either use the 1st entry it encounters or use the services labeled as the defaults.
runOnlyOnce=true
+
##QUERY PROPERTIES##
# The query parameter that should be used to test equality
queryEqualityProperty=dcterms:title
diff --git a/org.eclipse.lyo.testsuite.server/assessment/cm/config/rtc/rtc-template2.xml b/org.eclipse.lyo.testsuite.server/assessment/cm/config/rtc/rtc-template2.xml
index 416b97e..d392344 100644
--- a/org.eclipse.lyo.testsuite.server/assessment/cm/config/rtc/rtc-template2.xml
+++ b/org.eclipse.lyo.testsuite.server/assessment/cm/config/rtc/rtc-template2.xml
@@ -13,4 +13,4 @@
Steve Speicher - initial API and implementation
-->
- <rdf:RDF xmlns:dcterms="http://purl.org/dc/terms/" xmlns:oslc="http://open-services.net/ns/core#" xmlns:oslc_cm="http://open-services.net/ns/cm#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rtc_cm="http://jazz.net/xmlns/prod/jazz/rtc/cm/1.0/"> <oslc_cm:ChangeRequest> <dcterms:title>templatedDefect</dcterms:title> <dcterms:description>templatedDefect</dcterms:description> <rtc_cm:type rdf:resource="https://quagmire.rtp.raleigh.ibm.com:14443/ccm/oslc/types/_0BaKsZM6EeGkr92VMSYrdg/com.ibm.team.apt.workItemType.story"/> <dcterms:type>Story</dcterms:type> <rtc_cm:filedAgainst rdf:resource="https://quagmire.rtp.raleigh.ibm.com:14443/ccm/resource/itemOid/com.ibm.team.workitem.Category/_0qfj8pM6EeGkr92VMSYrdg"/> </oslc_cm:ChangeRequest> </rdf:RDF> \ No newline at end of file
+ <rdf:RDF xmlns:dcterms="http://purl.org/dc/terms/" xmlns:oslc="http://open-services.net/ns/core#" xmlns:oslc_cm="http://open-services.net/ns/cm#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rtc_cm="http://jazz.net/xmlns/prod/jazz/rtc/cm/1.0/"> <oslc_cm:ChangeRequest> <dcterms:title>templatedDefect</dcterms:title> <dcterms:description>templatedDefect</dcterms:description> <rtc_cm:type rdf:resource="https://quagmire.rtp.raleigh.ibm.com:14443/ccm/oslc/types/_YBdMgJhUEeGB3JzLyv0BEg/defect"/> <dcterms:type>Defect</dcterms:type> <rtc_cm:filedAgainst rdf:resource="https://quagmire.rtp.raleigh.ibm.com:14443/ccm/resource/itemOid/com.ibm.team.workitem.Category/_YmXa8phVEeGB3JzLyv0BEg"/> </oslc_cm:ChangeRequest> </rdf:RDF> \ No newline at end of file
diff --git a/org.eclipse.lyo.testsuite.server/config/rqm/rqm-setupv2.properties b/org.eclipse.lyo.testsuite.server/config/rqm/rqm-setupv2.properties
index 42bc497..4c2685c 100644
--- a/org.eclipse.lyo.testsuite.server/config/rqm/rqm-setupv2.properties
+++ b/org.eclipse.lyo.testsuite.server/config/rqm/rqm-setupv2.properties
@@ -12,20 +12,28 @@
# Contributors:
#
# Steve Speicher - initial API and implementation
+# Yuhong Yin
###############################################################################
+
+## Notes
+# You need to have at least one TestPlan, TestCase, TestScript, TestExecutionRecord and TestResult resource
+# They each need to be named "templatedDefect"
+
##GENERAL PROPERTIES##
# The location of the top level ServiceProviderCatalog or Service Description Document
-baseUri=https://quagmire.rtp.raleigh.ibm.com:14444/qm/oslc_qm/catalog
+baseUri=https://quagmire.rtp.raleigh.ibm.com:14443/qm/oslc_qm/catalog
+
# Used to pick which provider to use from the forest of all project areas
-useThisServiceProvider=https://quagmire.rtp.raleigh.ibm.com:14444/qm/oslc_qm/contexts/_IitrYGJCEeGnCNnu6VIFIQ/services.xml
+useThisServiceProvider=https://quagmire.rtp.raleigh.ibm.com:14443/qm/oslc_qm/contexts/_bm5CIJhUEeGDA6OFwsbBDQ/services.xml
+
# Implementation name (for identification purposes)
implName=RQM
# The authentication style (currently supports only BASIC and FORM)
authMethod=FORM
-formUri=https://quagmire.rtp.raleigh.ibm.com:14444/qm/authenticated/j_security_check
+formUri=https://quagmire.rtp.raleigh.ibm.com:14443/qm/authenticated/j_security_check
#The authentication credentials
-userId=oslctest
-pw=oslctest
+userId=vince
+pw=vince
# Values: http://open-services.net/xmlns/cm/1.0/ | http://open-services.net/ns/cm# | both
testVersions=http://open-services.net/ns/qm#
diff --git a/org.eclipse.lyo.testsuite.server/config/rqm/rqm-template2.xml b/org.eclipse.lyo.testsuite.server/config/rqm/rqm-template2.xml
index 9ec4972..ace4ee3 100644
--- a/org.eclipse.lyo.testsuite.server/config/rqm/rqm-template2.xml
+++ b/org.eclipse.lyo.testsuite.server/config/rqm/rqm-template2.xml
@@ -23,10 +23,10 @@
xmlns:oslc="http://open-services.net/ns/core#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:calm="http://jazz.net/xmlns/prod/jazz/calm/1.0/" >
- <rdf:Description rdf:about="https://quagmire.rtp.raleigh.ibm.com:14444/qm/oslc_qm/stubby">
+ <rdf:Description rdf:about="https://quagmire.rtp.raleigh.ibm.com:14443/qm/oslc_qm/stubby">
<rdf:type rdf:resource="http://open-services.net/ns/qm#TestScript"/>
<dcterms:description rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Steve's test-</dcterms:description>
- <dcterms:contributor rdf:resource="https://quagmire.rtp.raleigh.ibm.com:14444/jts/users/unassigned"/>
+ <dcterms:contributor rdf:resource="https://quagmire.rtp.raleigh.ibm.com:14443/jts/users/unassigned"/>
<dcterms:title rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Steves other Test Script</dcterms:title>
</rdf:Description>
</rdf:RDF> \ No newline at end of file
diff --git a/org.eclipse.lyo.testsuite.server/config/rqm/rqm-update2.xml b/org.eclipse.lyo.testsuite.server/config/rqm/rqm-update2.xml
index 4f14c1e..02f42e0 100644
--- a/org.eclipse.lyo.testsuite.server/config/rqm/rqm-update2.xml
+++ b/org.eclipse.lyo.testsuite.server/config/rqm/rqm-update2.xml
@@ -26,7 +26,7 @@
<rdf:Description rdf:about="">
<rdf:type rdf:resource="http://open-services.net/ns/qm#TestScript"/>
<dcterms:description rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Updated test script</dcterms:description>
- <dcterms:contributor rdf:resource="https://quagmire.rtp.raleigh.ibm.com:14444/jts/users/unassigned"/>
+ <dcterms:contributor rdf:resource="https://quagmire.rtp.raleigh.ibm.com:14443/jts/users/unassigned"/>
<dcterms:title rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Updated test script</dcterms:title>
</rdf:Description>
</rdf:RDF> \ No newline at end of file
diff --git a/org.eclipse.lyo.testsuite.server/config/rtc/rtc-json-template.json b/org.eclipse.lyo.testsuite.server/config/rtc/rtc-json-template.json
index ac2d12b..0503719 100644
--- a/org.eclipse.lyo.testsuite.server/config/rtc/rtc-json-template.json
+++ b/org.eclipse.lyo.testsuite.server/config/rtc/rtc-json-template.json
@@ -1,6 +1,6 @@
{
"dc:title":"templatedDefect",
"dc:description":"templatedDefect",
- "dc:type":{"rdf:resource":"https:\/\/quagmire.rtp.raleigh.ibm.com:9443\/ccm\/oslc\/types\/_gvEIUPJkEd-aL_39nkcG1w\/com.ibm.team.apt.workItemType.story"},
- "rtc_cm:filedAgainst":{"rdf:resource":"https:\/\/quagmire.rtp.raleigh.ibm.com:9443\/ccm\/resource\/itemOid\/com.ibm.team.workitem.Category\/_h1wDkPJkEd-aL_39nkcG1w"}
+ "dc:type":{"rdf:resource":"https:\/\/quagmire.rtp.raleigh.ibm.com:14443\/ccm\/oslc\/types\/_gvEIUPJkEd-aL_39nkcG1w\/defect"},
+ "rtc_cm:filedAgainst":{"rdf:resource":"https:\/\/quagmire.rtp.raleigh.ibm.com:14443\/ccm\/resource\/itemOid\/com.ibm.team.workitem.Category\/_YmXa8phVEeGB3JzLyv0BEg"}
} \ No newline at end of file
diff --git a/org.eclipse.lyo.testsuite.server/config/rtc/rtc-json-template2.json b/org.eclipse.lyo.testsuite.server/config/rtc/rtc-json-template2.json
index 44e12b6..3cffe3d 100644
--- a/org.eclipse.lyo.testsuite.server/config/rtc/rtc-json-template2.json
+++ b/org.eclipse.lyo.testsuite.server/config/rtc/rtc-json-template2.json
@@ -1,6 +1,6 @@
{
"dcterms:title":"templatedDefect",
"dcterms:description":"templatedDefect",
- "dcterms:type":{"rdf:resource":"https:\/\/quagmire.rtp.raleigh.ibm.com:14443\/ccm\/oslc\/types\/_0BaKsZM6EeGkr92VMSYrdg\/com.ibm.team.apt.workItemType.story"},
- "rtc_cm:filedAgainst":{"rdf:resource":"https:\/\/quagmire.rtp.raleigh.ibm.com:14443\/ccm\/resource\/itemOid\/com.ibm.team.workitem.Category\/_0qfj8pM6EeGkr92VMSYrdg"}
+ "dcterms:type":{"rdf:resource":"https:\/\/quagmire.rtp.raleigh.ibm.com:14443\/ccm\/oslc\/types\/_YBdMgJhUEeGB3JzLyv0BEg\/defect"},
+ "rtc_cm:filedAgainst":{"rdf:resource":"https:\/\/quagmire.rtp.raleigh.ibm.com:14443\/ccm\/resource\/itemOid\/com.ibm.team.workitem.Category\/_YmXa8phVEeGB3JzLyv0BEg"}
} \ No newline at end of file
diff --git a/org.eclipse.lyo.testsuite.server/config/rtc/rtc-setupv2.properties b/org.eclipse.lyo.testsuite.server/config/rtc/rtc-setupv2.properties
index c13a6a6..a32cf1e 100644
--- a/org.eclipse.lyo.testsuite.server/config/rtc/rtc-setupv2.properties
+++ b/org.eclipse.lyo.testsuite.server/config/rtc/rtc-setupv2.properties
@@ -29,10 +29,14 @@ pw=oslctest
# Values: http://open-services.net/xmlns/cm/1.0/ | http://open-services.net/ns/cm# | both
testVersions=http://open-services.net/ns/cm#
+# Specify a service provider to use if there are multiple
+
+useThisServiceProvider = https://quagmire.rtp.raleigh.ibm.com:14443/ccm/oslc/contexts/_YBdMgJhUEeGB3JzLyv0BEg/workitems/services.xml
# Determine if tests should follow all possible links: Service Catalogs, Service Providers, Query Capabilities, etc.
# Default is runOnlyOnce=true, which will either use the 1st entry it encounters or use the services labeled as the defaults.
runOnlyOnce=true
+
##QUERY PROPERTIES##
# The query parameter that should be used to test equality
queryEqualityProperty=dcterms:title
diff --git a/org.eclipse.lyo.testsuite.server/config/rtc/rtc-template2.xml b/org.eclipse.lyo.testsuite.server/config/rtc/rtc-template2.xml
index 416b97e..d392344 100644
--- a/org.eclipse.lyo.testsuite.server/config/rtc/rtc-template2.xml
+++ b/org.eclipse.lyo.testsuite.server/config/rtc/rtc-template2.xml
@@ -13,4 +13,4 @@
Steve Speicher - initial API and implementation
-->
- <rdf:RDF xmlns:dcterms="http://purl.org/dc/terms/" xmlns:oslc="http://open-services.net/ns/core#" xmlns:oslc_cm="http://open-services.net/ns/cm#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rtc_cm="http://jazz.net/xmlns/prod/jazz/rtc/cm/1.0/"> <oslc_cm:ChangeRequest> <dcterms:title>templatedDefect</dcterms:title> <dcterms:description>templatedDefect</dcterms:description> <rtc_cm:type rdf:resource="https://quagmire.rtp.raleigh.ibm.com:14443/ccm/oslc/types/_0BaKsZM6EeGkr92VMSYrdg/com.ibm.team.apt.workItemType.story"/> <dcterms:type>Story</dcterms:type> <rtc_cm:filedAgainst rdf:resource="https://quagmire.rtp.raleigh.ibm.com:14443/ccm/resource/itemOid/com.ibm.team.workitem.Category/_0qfj8pM6EeGkr92VMSYrdg"/> </oslc_cm:ChangeRequest> </rdf:RDF> \ No newline at end of file
+ <rdf:RDF xmlns:dcterms="http://purl.org/dc/terms/" xmlns:oslc="http://open-services.net/ns/core#" xmlns:oslc_cm="http://open-services.net/ns/cm#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rtc_cm="http://jazz.net/xmlns/prod/jazz/rtc/cm/1.0/"> <oslc_cm:ChangeRequest> <dcterms:title>templatedDefect</dcterms:title> <dcterms:description>templatedDefect</dcterms:description> <rtc_cm:type rdf:resource="https://quagmire.rtp.raleigh.ibm.com:14443/ccm/oslc/types/_YBdMgJhUEeGB3JzLyv0BEg/defect"/> <dcterms:type>Defect</dcterms:type> <rtc_cm:filedAgainst rdf:resource="https://quagmire.rtp.raleigh.ibm.com:14443/ccm/resource/itemOid/com.ibm.team.workitem.Category/_YmXa8phVEeGB3JzLyv0BEg"/> </oslc_cm:ChangeRequest> </rdf:RDF> \ No newline at end of file
diff --git a/org.eclipse.lyo.testsuite.server/pom.xml b/org.eclipse.lyo.testsuite.server/pom.xml
index 97d817a..2fc80fc 100644
--- a/org.eclipse.lyo.testsuite.server/pom.xml
+++ b/org.eclipse.lyo.testsuite.server/pom.xml
@@ -23,7 +23,11 @@
<name>Test Client - HTTPClient </name>
<groupId>org.eclipse.lyo</groupId>
<version>1.0.0-SNAPSHOT</version>
-
+
+ <properties>
+ <skipTests>true</skipTests>
+ </properties>
+
<repositories>
<repository>
<id>oauth</id>
@@ -130,7 +134,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-report-plugin</artifactId>
+ <artifactId>maven-surefire-report-plugin</artifactId>
</plugin>
</plugins>
@@ -143,7 +147,7 @@
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-report-plugin</artifactId>
+ <artifactId>maven-surefire-report-plugin</artifactId>
</plugin>
</plugins>
</reporting>
diff --git a/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/CoreResourceJsonTests.java b/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/CoreResourceJsonTests.java
new file mode 100644
index 0000000..369d18b
--- /dev/null
+++ b/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/CoreResourceJsonTests.java
@@ -0,0 +1,156 @@
+/*******************************************************************************
+ * Copyright (c) 2012 IBM Corporation.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * Yuhong Yin - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.lyo.testsuite.oslcv2;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assume.assumeNotNull;
+import static org.junit.Assume.assumeTrue;
+
+import java.io.IOException;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.xpath.XPathException;
+import javax.xml.xpath.XPathExpressionException;
+
+import org.apache.commons.httpclient.HttpStatus;
+import org.apache.http.HttpResponse;
+import org.apache.http.util.EntityUtils;
+import org.apache.wink.json4j.JSON;
+import org.apache.wink.json4j.JSONArtifact;
+import org.apache.wink.json4j.JSONException;
+import org.apache.wink.json4j.JSONObject;
+import org.eclipse.lyo.testsuite.oslcv2.TestsBase;
+import org.eclipse.lyo.testsuite.server.util.OSLCConstants;
+import org.eclipse.lyo.testsuite.server.util.OSLCUtils;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.xml.sax.SAXException;
+
+/**
+ * This class provides JUnit tests with JSON format for the validation of an OSLC core resource.
+ *
+ */
+@RunWith(Parameterized.class)
+public abstract class CoreResourceJsonTests extends TestsBase {
+ private HttpResponse response;
+ private String responseBody;
+ protected JSONObject doc;
+
+ public CoreResourceJsonTests(String thisUrl)
+ throws IOException, ParserConfigurationException, SAXException, XPathExpressionException, NullPointerException, JSONException
+ {
+ super(thisUrl);
+
+ // If currentUrl is null, it means that the query didn't match any
+ // records. This isn't exactly a failure, but there's nothing more we
+ // can test.
+ assumeNotNull(currentUrl);
+ response = OSLCUtils.getResponseFromUrl(setupBaseUrl, currentUrl, basicCreds,
+ OSLCConstants.CT_JSON, headers);
+ responseBody = EntityUtils.toString(response.getEntity());
+ int sc = response.getStatusLine().getStatusCode();
+
+ // Some records in the system might not be accessible to this user. This
+ // isn't a failure, but there's nothing more we can test.
+ assumeTrue(sc != HttpStatus.SC_FORBIDDEN && sc != HttpStatus.SC_UNAUTHORIZED);
+
+ // Make sure the request succeeded before continuing.
+ assertEquals(HttpStatus.SC_OK, sc);
+
+ //Get JSON doc from response
+ JSONArtifact userData = JSON.parse(responseBody);
+
+ if (userData instanceof JSONArtifact) {
+ doc = (JSONObject)userData;
+ }
+ }
+
+ @Before
+ public void setup()
+ throws IOException, ParserConfigurationException, SAXException, XPathException
+ {
+ super.setup();
+ }
+
+ @Test
+ //
+ // Verify that the OSLC Core Resource has one and only one dcterms:title
+ //
+ public void CoreResourceHasOneTitle() throws JSONException
+ {
+ assertTrue(doc.get(OSLCConstants.DCTERMS_TITLE) instanceof String);
+ }
+
+ @Test
+ public void CoreResourceHasAtMostOneDescription() throws JSONException
+ {
+ if ( doc.containsKey(OSLCConstants.DCTERMS_DESC) ) {
+ assertTrue(doc.get(OSLCConstants.DCTERMS_DESC) instanceof String);
+ }
+ }
+
+ @Test
+ public void CoreResourceHasAtMostOneIdentifier() throws JSONException
+ {
+ if ( doc.containsKey(OSLCConstants.DCTERMS_ID) ) {
+ assertTrue( (doc.get(OSLCConstants.DCTERMS_ID) instanceof String) ||
+ (doc.get(OSLCConstants.DCTERMS_ID) instanceof Integer));
+ }
+ }
+
+ @Test
+ public void CoreResourceHasAtMostOneName() throws JSONException
+ {
+ if ( doc.containsKey(OSLCConstants.DCTERMS_NAME) ) {
+ assertTrue(doc.get(OSLCConstants.DCTERMS_NAME) instanceof String);
+ }
+ }
+
+ @Test
+ public void CoreResourceHasAtMostOneCreatedDate() throws JSONException
+ {
+ if ( doc.containsKey(OSLCConstants.DCTERMS_CREATED) ) {
+ assertTrue(doc.get(OSLCConstants.DCTERMS_CREATED) instanceof String);
+ }
+ }
+
+ @Test
+ public void CoreResourceHasAtMostOneModifiedDate() throws JSONException
+ {
+ if ( doc.containsKey(OSLCConstants.DCTERMS_MODIFIED) ) {
+ assertTrue(doc.get(OSLCConstants.DCTERMS_MODIFIED) instanceof String);
+ }
+ }
+
+ @Test
+ public void CoreResourceHasAtMostOneDiscussion() throws JSONException
+ {
+ if ( doc.containsKey("oslc:discussion") ) {
+ assertTrue(doc.get("oslc:discussion") instanceof JSONObject);
+ }
+ }
+
+ @Test
+ public void CoreResourceHasAtMostOneInstanceShape() throws JSONException
+ {
+ if ( doc.containsKey("oslc:instanceShape") ) {
+ assertTrue(doc.get("oslc:instanceShape") instanceof JSONObject);
+ }
+ }
+}
diff --git a/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/CoreResourceRdfXmlTests.java b/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/CoreResourceRdfXmlTests.java
new file mode 100644
index 0000000..144bddf
--- /dev/null
+++ b/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/CoreResourceRdfXmlTests.java
@@ -0,0 +1,239 @@
+/*******************************************************************************
+ * Copyright (c) 2012 IBM Corporation.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * Yuhong Yin - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.lyo.testsuite.oslcv2;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assume.assumeNotNull;
+import static org.junit.Assume.assumeTrue;
+
+import java.io.IOException;
+import java.net.URLEncoder;
+import java.util.ArrayList;
+import java.util.Collection;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.xpath.XPathException;
+import javax.xml.xpath.XPathExpressionException;
+
+import org.apache.commons.httpclient.HttpStatus;
+import org.apache.http.HttpResponse;
+import org.eclipse.lyo.testsuite.server.util.OSLCConstants;
+import org.eclipse.lyo.testsuite.server.util.OSLCUtils;
+import org.eclipse.lyo.testsuite.server.util.RDFUtils;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+import org.xml.sax.SAXException;
+
+import com.hp.hpl.jena.rdf.model.Model;
+import com.hp.hpl.jena.rdf.model.ModelFactory;
+import com.hp.hpl.jena.rdf.model.Property;
+import com.hp.hpl.jena.rdf.model.RDFNode;
+import com.hp.hpl.jena.rdf.model.Resource;
+import com.hp.hpl.jena.rdf.model.Selector;
+import com.hp.hpl.jena.rdf.model.SimpleSelector;
+import com.hp.hpl.jena.rdf.model.StmtIterator;
+import com.hp.hpl.jena.vocabulary.RDF;
+
+/**
+ * This class provides JUnit tests with JSON format for the validation of an OSLC core resource.
+ *
+ */
+@RunWith(Parameterized.class)
+public abstract class CoreResourceRdfXmlTests extends TestsBase {
+ private HttpResponse response;
+ private Model fRdfModel = ModelFactory.createDefaultModel();
+ private Resource fResource = null;
+
+ protected static String resourceTypeQuery = "";
+ protected static String xpathSubStmt = "";
+
+ public CoreResourceRdfXmlTests(String thisUrl)
+ throws IOException,ParserConfigurationException, SAXException, XPathExpressionException, NullPointerException {
+
+ super(thisUrl);
+
+ // If currentUrl is null, it means that the query didn't match any
+ // records. This isn't exactly a failure, but there's nothing more we
+ // can test.
+ assumeNotNull(currentUrl);
+ response = OSLCUtils.getResponseFromUrl(setupBaseUrl, currentUrl, basicCreds, OSLCConstants.CT_RDF,
+ headers);
+ // Some records in the system might not be accessible to this user. This
+ // isn't a failure, but there's nothing more we can test.
+ int sc = response.getStatusLine().getStatusCode();
+ assumeTrue(sc != HttpStatus.SC_FORBIDDEN && sc != HttpStatus.SC_UNAUTHORIZED);
+ // Make sure the request succeeded before continuing.
+ assertEquals(HttpStatus.SC_OK, sc);
+
+ fRdfModel.read(response.getEntity().getContent(),
+ OSLCUtils.absoluteUrlFromRelative(setupBaseUrl, currentUrl),
+ OSLCConstants.JENA_RDF_XML);
+ RDFUtils.validateModel(fRdfModel);
+
+ fResource = (Resource) fRdfModel.getResource(currentUrl);
+ assumeTrue(fRdfModel.contains(fResource, RDF.type,
+ fRdfModel.createResource(OSLCConstants.CM_CHANGE_REQUEST_TYPE)));
+
+ }
+
+ @Parameters
+ protected static Collection<Object[]> getAllDescriptionUrls(String eval) throws IOException
+ {
+ //Checks the ServiceProviderCatalog at the specified baseUrl of the REST service in order to grab all urls
+ //to other ServiceProvidersCatalogs contained within it, recursively, in order to find the URLs of all
+ //query factories of the REST service.
+ ArrayList<String> serviceUrls = getServiceProviderURLsUsingRdfXml(setupProps.getProperty("baseUri"), onlyOnce);
+
+ ArrayList<String> capabilityURLsUsingRdfXml = TestsBase.getCapabilityURLsUsingRdfXml(
+ OSLCConstants.QUERY_BASE_PROP,
+ serviceUrls,
+ true,
+ null,
+ getResourceTypeQuery(),
+ getxpathSubStmt());
+
+ String where = setupProps.getProperty("changeRequestsWhere");
+ if (where == null) {
+ String queryProperty = setupProps.getProperty("queryEqualityProperty");
+ String queryPropertyValue = setupProps.getProperty("queryEqualityValue");
+ where = queryProperty + "=\"" + queryPropertyValue + "\"";
+ }
+
+ String additionalParameters = setupProps.getProperty("queryAdditionalParameters");
+ String query = (additionalParameters.length() == 0) ? "?" : "?" + additionalParameters + "&";
+ query = query + "oslc.where=" + URLEncoder.encode(where, "UTF-8") + "&oslc.pageSize=1";
+
+ ArrayList<String> results = new ArrayList<String>();
+ for (String queryBaseUri : capabilityURLsUsingRdfXml) {
+ String queryUrl = OSLCUtils.addQueryStringToURL(queryBaseUri, query);
+ HttpResponse resp = OSLCUtils.getResponseFromUrl(setupBaseUrl, queryUrl, basicCreds,
+ OSLCConstants.CT_RDF, headers);
+ Model queryModel = ModelFactory.createDefaultModel();
+ queryModel.read(resp.getEntity().getContent(), queryBaseUri, OSLCConstants.JENA_RDF_XML);
+ RDFUtils.validateModel(queryModel);
+
+ Property member = queryModel.createProperty(eval);
+
+ Resource queryBase = queryModel.getResource(queryBaseUri);
+ Selector select = new SimpleSelector(queryBase, member, (RDFNode)null);
+ StmtIterator statements = queryModel.listStatements(select);
+
+ while (statements.hasNext()) {
+ results.add(statements.nextStatement().getObject().toString());
+ if (onlyOnce) return toCollection(results);
+ }
+ if (!results.isEmpty() && onlyOnce)
+ break;
+ }
+ return toCollection(results);
+ }
+
+ @Before
+ public void setup() throws IOException, ParserConfigurationException, SAXException, XPathException
+ {
+ super.setup();
+ }
+
+ @Test
+ public void CoreResourceHasOneTitle()
+ {
+ StmtIterator listStatements = getStatementsForProp(OSLCConstants.DC_TITLE_PROP);
+ int size=listStatements.toList().size();
+ assertTrue("Can have 1 dc:title, found "+size, size == 1);
+ }
+
+ @Test
+ public void CoreResourceHasAtMostOneDescription()
+ {
+ StmtIterator listStatements = getStatementsForProp(OSLCConstants.DC_DESC_PROP);
+ int size=listStatements.toList().size();
+ assertTrue("Can have <=1 dc:description, found "+size, size <= 1);
+ }
+
+ @Test
+ public void CoreResourceHasAtMostOneIdentifier()
+ {
+ StmtIterator listStatements = getStatementsForProp(OSLCConstants.DC_ID_PROP);
+ int size=listStatements.toList().size();
+ assertTrue("Can have <=1 dc:identifier, found "+size, size <= 1);
+ }
+
+ @Test
+ public void CoreResourceHasAtMostOneName()
+ {
+ StmtIterator listStatements = getStatementsForProp(OSLCConstants.DC_NAME_PROP);
+ int size=listStatements.toList().size();
+ assertTrue("Can have <=1 dc:name, found "+size, size <= 1);
+ }
+
+ @Test
+ public void CoreResourceHasAtMostOneCreatedDate()
+ {
+ StmtIterator listStatements = getStatementsForProp(OSLCConstants.DC_CREATED_PROP);
+ int size=listStatements.toList().size();
+ assertTrue("Can have <=1 dc:created, found "+size, size <= 1);
+ }
+
+ @Test
+ public void CoreResourceHasAtMostOneModifiedDate()
+ {
+ StmtIterator listStatements = getStatementsForProp(OSLCConstants.DC_MODIFIED_PROP);
+ int size=listStatements.toList().size();
+ assertTrue("Can have <=1 dc:modified, found "+size, size <= 1);
+ }
+
+ @Test
+ public void CoreResourceHasAtMostOneDiscussion()
+ {
+ StmtIterator listStatements = getStatementsForProp(OSLCConstants.DISCUSSION_PROP);
+ int size=listStatements.toList().size();
+ assertTrue("Can have <=1 oslc:discussion, found "+size, size <= 1);
+ }
+
+ @Test
+ public void CoreResourceHasAtMostOneInstanceShape()
+ {
+ StmtIterator listStatements = getStatementsForProp(OSLCConstants.INST_SHAPE_PROP);
+ int size=listStatements.toList().size();
+ assertTrue("Can have <=1 oslc:instanceShape, found "+size, size <= 1);
+ }
+
+ protected StmtIterator getStatementsForProp(String propUri) {
+ Property prop = fRdfModel.getProperty(propUri);
+ Selector select = new SimpleSelector(fResource, prop, (RDFNode)null);
+ return fRdfModel.listStatements(select);
+ }
+
+ protected static void setResourceTypeQuery (String rT) {
+ resourceTypeQuery = rT;
+ }
+
+ protected static String getResourceTypeQuery() {
+ return resourceTypeQuery;
+ }
+
+ protected static void setxpathSubStmt (String x) {
+ xpathSubStmt = x;
+ }
+
+ protected static String getxpathSubStmt() {
+ return xpathSubStmt;
+ }
+}
diff --git a/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/CoreResourceXmlTests.java b/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/CoreResourceXmlTests.java
new file mode 100644
index 0000000..b009cc9
--- /dev/null
+++ b/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/CoreResourceXmlTests.java
@@ -0,0 +1,284 @@
+/*******************************************************************************
+ * Copyright (c) 2012 IBM Corporation.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * Yuhong Yin - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.lyo.testsuite.oslcv2;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.junit.Assume.assumeNotNull;
+import static org.junit.Assume.assumeTrue;
+
+import java.io.IOException;
+import java.net.URLEncoder;
+import java.util.ArrayList;
+import java.util.Collection;
+
+import javax.xml.bind.DatatypeConverter;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathException;
+import javax.xml.xpath.XPathExpressionException;
+
+import org.apache.commons.httpclient.HttpStatus;
+import org.apache.http.HttpResponse;
+import org.apache.http.util.EntityUtils;
+import org.eclipse.lyo.testsuite.server.util.OSLCConstants;
+import org.eclipse.lyo.testsuite.server.util.OSLCUtils;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+@RunWith(Parameterized.class)
+public abstract class CoreResourceXmlTests extends TestsBase {
+ protected HttpResponse response;
+ protected String responseBody;
+ protected Document doc;
+ protected String node = "";
+ protected static String resourceTypeQuery = "";
+ protected static String xpathSubStmt = "";
+
+ public CoreResourceXmlTests(String thisUrl)
+ throws IOException, ParserConfigurationException, SAXException, XPathExpressionException
+ {
+ super(thisUrl);
+
+ // If currentUrl is null, it means that the query didn't match any
+ // records. This isn't exactly a failure, but there's nothing more we
+ // can test.
+ assumeNotNull(currentUrl);
+ response = OSLCUtils.getResponseFromUrl(setupBaseUrl, currentUrl, basicCreds, OSLCConstants.CT_XML,
+ headers);
+ responseBody = EntityUtils.toString(response.getEntity());
+ int sc = response.getStatusLine().getStatusCode();
+
+ // Some records in the system might not be accessible to this user. This
+ // isn't a failure, but there's nothing more we can test.
+ assumeTrue(sc != HttpStatus.SC_FORBIDDEN && sc != HttpStatus.SC_UNAUTHORIZED);
+
+ // Make sure the request succeeded before continuing.
+ assertEquals(HttpStatus.SC_OK, sc);
+
+ //Get XML Doc from response
+ doc = OSLCUtils.createXMLDocFromResponseBody(responseBody);
+ }
+
+ @Before
+ public void setup() throws IOException, ParserConfigurationException, SAXException, XPathException
+ {
+ super.setup();
+
+
+ }
+
+ @Parameters
+ protected static Collection<Object[]> getAllDescriptionUrls(String eval)
+ throws IOException, ParserConfigurationException, SAXException, XPathException
+ {
+ ArrayList<String> results = new ArrayList<String>();
+
+ //Checks the ServiceProviderCatalog at the specified baseUrl of the REST service in order to grab all urls
+ //to other ServiceProvidersCatalogs contained within it, recursively, in order to find the URLs of all
+ //query factories of the REST service.
+
+ String v = "//oslc_v2:QueryCapability/oslc_v2:queryBase/@rdf:resource";
+
+ ArrayList<String> serviceUrls = getServiceProviderURLsUsingXML(null);
+ ArrayList<String> capabilityURLsUsingXML =
+ TestsBase.getCapabilityURLsUsingXML(v, getxpathSubStmt(), getResourceTypeQuery(), serviceUrls, true);
+
+ // Once we have the query URL, look for a resource to validate
+ String where = setupProps.getProperty("changeRequestsWhere");
+ if (where == null) {
+ String queryProperty = setupProps.getProperty("queryEqualityProperty");
+ String queryPropertyValue = setupProps.getProperty("queryEqualityValue");
+ where = queryProperty + "=\"" + queryPropertyValue + "\"";
+ }
+
+ String additionalParameters = setupProps.getProperty("queryAdditionalParameters");
+ String query = (additionalParameters.length() == 0) ? "?" : "?" + additionalParameters + "&";
+ query = query + "oslc.where=" + URLEncoder.encode(where, "UTF-8") + "&oslc.pageSize=1";
+
+ for (String queryBase : capabilityURLsUsingXML) {
+ String queryUrl = OSLCUtils.addQueryStringToURL(queryBase, query);
+ HttpResponse resp = OSLCUtils.getResponseFromUrl(setupBaseUrl, queryUrl, basicCreds,
+ OSLCConstants.CT_XML, headers);
+ String respBody = EntityUtils.toString(resp.getEntity());
+ EntityUtils.consume(resp.getEntity());
+ assertTrue("Received " +resp.getStatusLine(), (resp.getStatusLine().getStatusCode() == HttpStatus.SC_OK));
+
+ //Get XML Doc from response
+ Document doc = OSLCUtils.createXMLDocFromResponseBody(respBody);
+
+ //Check for results by reference (rdf:resource)
+ Node result = (Node) OSLCUtils.getXPath().evaluate(
+ eval,
+ doc, XPathConstants.NODE);
+
+ if (result == null)
+ //No results by reference. Check for inline results (rdf:about)
+ result = (Node) OSLCUtils.getXPath().evaluate(
+ "//rdfs:member/oslc_cm_v2:ChangeRequest/@rdf:about", doc,
+ XPathConstants.NODE);
+ if (result != null)
+ results.add(result.getNodeValue());
+ if (onlyOnce)
+ break;
+ }
+ return toCollection(results);
+ }
+
+ @Test
+ public void CoreResourceHasOneTitle() throws XPathExpressionException
+ {
+ String eval = "//" + getNode() + "/" + "dc:title";
+
+ NodeList titles = (NodeList) OSLCUtils.getXPath().evaluate(eval,
+ doc, XPathConstants.NODESET);
+
+ assertEquals(getFailureMessage(), 1, titles.getLength());
+ }
+
+ @Test
+ public void CoreResourceHasAtMostOneDescription() throws XPathExpressionException
+ {
+ String eval = "//" + getNode() + "/" + "dc:description";
+
+ NodeList descriptions = (NodeList) OSLCUtils.getXPath().evaluate(eval,
+ doc, XPathConstants.NODESET);
+
+ assertTrue(getFailureMessage(), descriptions.getLength() <= 1);
+ }
+
+ @Test
+ public void CoreResourceHasAtMostOneIdentifier() throws XPathExpressionException
+ {
+ String eval = "//" + getNode() + "/" + "dc:identifier";
+
+ NodeList ids = (NodeList) OSLCUtils.getXPath().evaluate(eval,
+ doc, XPathConstants.NODESET);
+ assertTrue(getFailureMessage(), ids.getLength() <= 1);
+ }
+
+ @Test
+ public void CoreResourceHasAtMostOneName() throws XPathExpressionException
+ {
+ String eval = "//" + getNode() + "/" + "dc:name";
+
+ NodeList names = (NodeList) OSLCUtils.getXPath().evaluate(eval,
+ doc, XPathConstants.NODESET);
+ assertTrue(getFailureMessage(), names.getLength() <= 1);
+ }
+
+ @Test
+ public void CoreResourceHasAtMostOneCreatedDate() throws XPathExpressionException
+ {
+ String eval = "//" + getNode() + "/" + "dc:created";
+
+ NodeList createdDates = (NodeList) OSLCUtils.getXPath().evaluate(eval,
+ doc, XPathConstants.NODESET);
+ assertTrue(getFailureMessage(), createdDates.getLength() <= 1);
+ //If there is a created date, verify the format.
+ if (createdDates.getLength() > 0)
+ {
+ try
+ {
+ DatatypeConverter.parseDateTime(createdDates.item(0).getTextContent());
+ }
+ catch (Exception e)
+ {
+ fail("Created date not in valid XSD format");
+ }
+ }
+ }
+
+ @Test
+ public void CoreResourceHasAtMostOneModifiedDate() throws XPathExpressionException
+ {
+ String eval = "//" + getNode() + "/" + "dc:modified";
+
+ NodeList modifiedDates = (NodeList) OSLCUtils.getXPath().evaluate(eval,
+ doc, XPathConstants.NODESET);
+ assertTrue(getFailureMessage(), modifiedDates.getLength() <= 1);
+
+ //If there is a modified date, verify the format.
+ if (modifiedDates.getLength() > 0)
+ {
+ try
+ {
+ final String dateString = modifiedDates.item(0).getTextContent();
+ DatatypeConverter.parseDateTime(dateString);
+ }
+ catch (Exception e)
+ {
+ fail("Modified date not in valid XSD format");
+ }
+ }
+ }
+
+ @Test
+ public void CoreResourceHasAtMostOneDiscussion() throws XPathExpressionException
+ {
+ String eval = "//" + getNode() + "/" + "oslc:discussion";
+
+ NodeList discussions = (NodeList) OSLCUtils.getXPath().evaluate(eval,
+ doc, XPathConstants.NODESET);
+ assertTrue(getFailureMessage(), discussions.getLength() <= 1);
+ }
+
+ @Test
+ public void CoreResourceHasAtMostOneInstanceShape() throws XPathExpressionException
+ {
+ String eval = "//" + getNode() + "/" + "oslc:instanceShape";
+
+ NodeList instances = (NodeList)OSLCUtils.getXPath().evaluate(eval,
+ doc, XPathConstants.NODESET);
+ assertTrue(getFailureMessage(), instances.getLength() <= 1);
+ }
+
+ protected String getFailureMessage() {
+ return "Problems with XML representation of OSLC ChangeRequest <" + currentUrl + ">";
+ }
+
+ protected void setNode (String namespace, String resource) {
+ node = namespace + ":" + resource;
+ }
+
+ protected String getNode() {
+ return node;
+ }
+
+ protected static void setResourceTypeQuery (String rT) {
+ resourceTypeQuery = rT;
+ }
+
+ protected static String getResourceTypeQuery() {
+ return resourceTypeQuery;
+ }
+
+ protected static void setxpathSubStmt (String x) {
+ xpathSubStmt = x;
+ }
+
+ protected static String getxpathSubStmt() {
+ return xpathSubStmt;
+ }
+}
diff --git a/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/ServiceProviderRdfXmlTests.java b/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/ServiceProviderRdfXmlTests.java
index a1c56f4..cbb994f 100644
--- a/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/ServiceProviderRdfXmlTests.java
+++ b/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/ServiceProviderRdfXmlTests.java
@@ -106,7 +106,7 @@ public class ServiceProviderRdfXmlTests extends TestsBase {
//ArrayList to contain the urls from all SPCs
Collection<Object[]> data = new ArrayList<Object[]>();
- ArrayList<String> serviceURLs = TestsBase.getServiceProviderURLsUsingRdfXml(base, false);
+ ArrayList<String> serviceURLs = TestsBase.getServiceProviderURLsUsingRdfXml(base, true);
for (String serviceURL : serviceURLs) {
data.add(new Object[] {serviceURL});
diff --git a/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/SimplifiedQueryAtomTests.java b/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/SimplifiedQueryAtomTests.java
index b694124..4554696 100644
--- a/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/SimplifiedQueryAtomTests.java
+++ b/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/SimplifiedQueryAtomTests.java
@@ -46,7 +46,6 @@ import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
/**
diff --git a/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/TestsBase.java b/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/TestsBase.java
index 535f8a9..45f0c3d 100644
--- a/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/TestsBase.java
+++ b/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/TestsBase.java
@@ -1,4 +1,5 @@
/*******************************************************************************
+ * Copyright (c) 2011, 2012 IBM Corporation.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -9,8 +10,8 @@
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* Contributors:
- *
* Steve Speicher - initial API and implementation
+ * Yuhong Yin
*******************************************************************************/
package org.eclipse.lyo.testsuite.oslcv2;
@@ -162,7 +163,7 @@ public class TestsBase {
}
return data;
}
-
+
public static ArrayList<String> getServiceProviderURLsUsingXML(String inBaseURL, boolean dontGoDeep)
throws IOException, XPathException, ParserConfigurationException,
SAXException {
@@ -284,11 +285,28 @@ public class TestsBase {
}
return data;
}
+
+ public static ArrayList<String> getCapabilityURLsUsingXML(
+ String xpathStmt,
+ ArrayList<String> serviceUrls,
+ boolean useDefaultUsage)
+ throws IOException, ParserConfigurationException, SAXException, XPathExpressionException {
+
+ return getCapabilityURLsUsingXML(xpathStmt,
+ "//oslc_v2:usage/@rdf:resource",
+ OSLCConstants.USAGE_DEFAULT_URI,
+ serviceUrls,
+ useDefaultUsage);
+ }
- public static ArrayList<String> getCapabilityURLsUsingXML(String xpathStmt,
- ArrayList<String> serviceUrls, boolean useDefaultUsage) throws IOException,
- ParserConfigurationException, SAXException,
- XPathExpressionException {
+ public static ArrayList<String> getCapabilityURLsUsingXML(
+ String xpathStmt,
+ String xpathSubStmt,
+ String rT,
+ ArrayList<String> serviceUrls,
+ boolean useDefaultUsage)
+ throws IOException, ParserConfigurationException, SAXException, XPathExpressionException {
+
// Collection to contain the creationFactory urls from all SPs
ArrayList<String> data = new ArrayList<String>();
String firstUrl = null;
@@ -298,22 +316,25 @@ public class TestsBase {
basicCreds, OSLCConstants.CT_XML, headers);
Document baseDoc = OSLCUtils.createXMLDocFromResponseBody(EntityUtils
- .toString(resp.getEntity()));
-
+ .toString(resp.getEntity()));
+
NodeList sDescs = (NodeList) OSLCUtils.getXPath().evaluate(
xpathStmt,
- baseDoc, XPathConstants.NODESET);
- String xpathSubStmt = "../../oslc_v2:usage/@rdf:resource";
+ baseDoc, XPathConstants.NODESET);
+
for (int i = 0; i < sDescs.getLength(); i++) {
if (firstUrl == null)
- firstUrl = sDescs.item(i).getNodeValue();
+ firstUrl = sDescs.item(i).getNodeValue();
+
if (useDefaultUsage) {
NodeList usages = (NodeList) OSLCUtils.getXPath().evaluate(
xpathSubStmt,
- sDescs.item(i), XPathConstants.NODESET);
+ sDescs.item(i), XPathConstants.NODESET);
+
for (int u=0; u < usages.getLength(); u++) {
String usageValue = usages.item(u).getNodeValue();
- if (OSLCConstants.USAGE_DEFAULT_URI.equals(usageValue)) {
+ //if (OSLCConstants.USAGE_DEFAULT_URI.equals(usageValue)) {
+ if (rT.equals(usageValue) && (u ==i)) {
data.add(sDescs.item(i).getNodeValue());
return data;
}
@@ -396,11 +417,35 @@ public class TestsBase {
public static ArrayList<String> getCapabilityURLsUsingRdfXml(String propertyUri,
ArrayList<String> serviceUrls, boolean useDefaultUsage) throws IOException {
- return getCapabilityURLsUsingRdfXml(propertyUri, serviceUrls, useDefaultUsage, null);
- }
-
- public static ArrayList<String> getCapabilityURLsUsingRdfXml(String propertyUri,
- ArrayList<String> serviceUrls, boolean useDefaultUsage, String[] types) throws IOException {
+ return getCapabilityURLsUsingRdfXml(
+ propertyUri,
+ serviceUrls,
+ useDefaultUsage,
+ null,
+ OSLCConstants.USAGE_PROP,
+ OSLCConstants.USAGE_DEFAULT_URI
+ );
+ }
+
+ public static ArrayList<String> getCapabilityURLsUsingRdfXml(String propertyUri,
+ ArrayList<String> serviceUrls, boolean useDefaultUsage, String[] types) throws IOException {
+ return getCapabilityURLsUsingRdfXml(
+ propertyUri,
+ serviceUrls,
+ useDefaultUsage,
+ types,
+ OSLCConstants.USAGE_PROP,
+ OSLCConstants.USAGE_DEFAULT_URI
+ );
+ }
+
+ public static ArrayList<String> getCapabilityURLsUsingRdfXml(
+ String propertyUri,
+ ArrayList<String> serviceUrls,
+ boolean useDefaultUsage,
+ String[] types,
+ String prop,
+ String eval) throws IOException {
// Collection to contain the creationFactory urls from all SPs
ArrayList<String> data = new ArrayList<String>();
String firstUrl = null;
@@ -411,20 +456,25 @@ public class TestsBase {
Model spModel = ModelFactory.createDefaultModel();
spModel.read(resp.getEntity().getContent(), base, OSLCConstants.JENA_RDF_XML);
RDFUtils.validateModel(spModel);
-
- Property capProp = spModel.createProperty(propertyUri);
- Property usageProp = spModel.createProperty(OSLCConstants.USAGE_PROP);
+
+ Property capProp = spModel.createProperty(propertyUri);
+ Property usageProp = spModel.createProperty(prop);
Selector select = new SimpleSelector(null, capProp, (RDFNode)null);
- StmtIterator statements = spModel.listStatements(select);
+ StmtIterator statements = spModel.listStatements(select);
+
while (statements.hasNext()) {
- Statement stmt = statements.nextStatement();
+ Statement stmt = statements.nextStatement();
+
if (firstUrl == null)
firstUrl = stmt.getObject().toString();
if (useDefaultUsage) {
- StmtIterator usages = stmt.getSubject().listProperties(usageProp);
- while (usages.hasNext()) {
- Statement usageStmt = usages.nextStatement();
- if (OSLCConstants.USAGE_DEFAULT_URI.equals(usageStmt.getObject().toString())) {
+ StmtIterator usages = stmt.getSubject().listProperties(usageProp);
+
+ while (usages.hasNext()) {
+
+ Statement usageStmt = usages.nextStatement();
+
+ if (eval.equals(usageStmt.getObject().toString())){
data.add(stmt.getObject().toString());
return data;
}
diff --git a/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/cm/ChangeRequestJsonTests.java b/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/cm/ChangeRequestJsonTests.java
index d177897..14b41f7 100644
--- a/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/cm/ChangeRequestJsonTests.java
+++ b/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/cm/ChangeRequestJsonTests.java
@@ -15,10 +15,7 @@
*******************************************************************************/
package org.eclipse.lyo.testsuite.oslcv2.cm;
-import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
-import static org.junit.Assume.assumeNotNull;
-import static org.junit.Assume.assumeTrue;
import java.io.IOException;
import java.net.URLEncoder;
@@ -29,7 +26,6 @@ import javax.xml.parsers.ParserConfigurationException;
import javax.xml.xpath.XPathException;
import javax.xml.xpath.XPathExpressionException;
-import org.apache.commons.httpclient.HttpStatus;
import org.apache.http.HttpResponse;
import org.apache.http.util.EntityUtils;
import org.apache.wink.json4j.JSON;
@@ -37,10 +33,9 @@ import org.apache.wink.json4j.JSONArray;
import org.apache.wink.json4j.JSONArtifact;
import org.apache.wink.json4j.JSONException;
import org.apache.wink.json4j.JSONObject;
-import org.eclipse.lyo.testsuite.oslcv2.TestsBase;
+import org.eclipse.lyo.testsuite.oslcv2.CoreResourceJsonTests;
import org.eclipse.lyo.testsuite.server.util.OSLCConstants;
import org.eclipse.lyo.testsuite.server.util.OSLCUtils;
-import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@@ -53,48 +48,15 @@ import org.xml.sax.SAXException;
* to test against, checking the relationship of elements in the JSON representation of the change request.
*/
@RunWith(Parameterized.class)
-public class ChangeRequestJsonTests extends TestsBase {
- private HttpResponse response;
- private String responseBody;
- private JSONObject doc;
+public class ChangeRequestJsonTests extends CoreResourceJsonTests {
- public ChangeRequestJsonTests(String thisUrl)
- throws IOException, ParserConfigurationException, SAXException, XPathExpressionException, NullPointerException, JSONException
- {
- super(thisUrl);
-
- // If currentUrl is null, it means that the query didn't match any
- // records. This isn't exactly a failure, but there's nothing more we
- // can test.
- assumeNotNull(currentUrl);
- response = OSLCUtils.getResponseFromUrl(setupBaseUrl, currentUrl, basicCreds,
- OSLCConstants.CT_JSON, headers);
- responseBody = EntityUtils.toString(response.getEntity());
- int sc = response.getStatusLine().getStatusCode();
-
- // Some records in the system might not be accessible to this user. This
- // isn't a failure, but there's nothing more we can test.
- assumeTrue(sc != HttpStatus.SC_FORBIDDEN && sc != HttpStatus.SC_UNAUTHORIZED);
-
- // Make sure the request succeeded before continuing.
- assertEquals(HttpStatus.SC_OK, sc);
-
- //Get JSON doc from response
- JSONArtifact userData = JSON.parse(responseBody);
+ public ChangeRequestJsonTests(String thisUrl) throws IOException,
+ ParserConfigurationException, SAXException,
+ XPathExpressionException, NullPointerException, JSONException {
- if (userData instanceof JSONArtifact) {
- doc = (JSONObject)userData;
- }
-
+ super(thisUrl);
}
-
- @Before
- public void setup()
- throws IOException, ParserConfigurationException, SAXException, XPathException
- {
- super.setup();
- }
-
+
@Parameters
public static Collection<Object[]> getAllDescriptionUrls()
throws IOException, NullPointerException, XPathException, ParserConfigurationException, SAXException, JSONException
@@ -169,72 +131,6 @@ public class ChangeRequestJsonTests extends TestsBase {
return toCollection(results);
}
-
- @Test
- //
- // Verify that the Change Request has one and only one dcterms:title
- //
- public void changeRequestHasOneTitle() throws JSONException
- {
- assertTrue(doc.get(OSLCConstants.DCTERMS_TITLE) instanceof String);
- }
-
- @Test
- public void changeRequestHasAtMostOneDescription() throws JSONException
- {
- if ( doc.containsKey(OSLCConstants.DCTERMS_DESC) ) {
- assertTrue(doc.get(OSLCConstants.DCTERMS_DESC) instanceof String);
- }
- }
-
- @Test
- public void changeRequestHasAtMostOneIdentifier() throws JSONException
- {
- if ( doc.containsKey(OSLCConstants.DCTERMS_ID) ) {
- assertTrue( (doc.get(OSLCConstants.DCTERMS_ID) instanceof String) ||
- (doc.get(OSLCConstants.DCTERMS_ID) instanceof Integer));
- }
- }
-
- @Test
- public void changeRequestHasAtMostOneName() throws JSONException
- {
- if ( doc.containsKey(OSLCConstants.DCTERMS_NAME) ) {
- assertTrue(doc.get(OSLCConstants.DCTERMS_NAME) instanceof String);
- }
- }
-
- @Test
- public void changeRequestHasAtMostOneCreatedDate() throws JSONException
- {
- if ( doc.containsKey(OSLCConstants.DCTERMS_CREATED) ) {
- assertTrue(doc.get(OSLCConstants.DCTERMS_CREATED) instanceof String);
- }
- }
-
- @Test
- public void changeRequestHasAtMostOneModifiedDate() throws JSONException
- {
- if ( doc.containsKey(OSLCConstants.DCTERMS_MODIFIED) ) {
- assertTrue(doc.get(OSLCConstants.DCTERMS_MODIFIED) instanceof String);
- }
- }
-
- @Test
- public void changeRequestHasAtMostOneDiscussion() throws JSONException
- {
- if ( doc.containsKey("oslc:discussion") ) {
- assertTrue(doc.get("oslc:discussion") instanceof JSONObject);
- }
- }
-
- @Test
- public void changeRequestHasAtMostOneInstanceShape() throws JSONException
- {
- if ( doc.containsKey("oslc:instanceShape") ) {
- assertTrue(doc.get("oslc:instanceShape") instanceof JSONObject);
- }
- }
@Test
public void changeRequestHasAtMostOneCloseDate() throws JSONException
diff --git a/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/cm/ChangeRequestRdfXmlTests.java b/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/cm/ChangeRequestRdfXmlTests.java
index cd9bc20..986d3fd 100644
--- a/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/cm/ChangeRequestRdfXmlTests.java
+++ b/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/cm/ChangeRequestRdfXmlTests.java
@@ -15,44 +15,23 @@
*******************************************************************************/
package org.eclipse.lyo.testsuite.oslcv2.cm;
-import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
-import static org.junit.Assume.assumeNotNull;
-import static org.junit.Assume.assumeTrue;
import java.io.IOException;
-import java.net.URLEncoder;
-import java.util.ArrayList;
import java.util.Collection;
import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.xpath.XPathException;
import javax.xml.xpath.XPathExpressionException;
-
-import org.apache.commons.httpclient.HttpStatus;
-import org.apache.http.HttpResponse;
-import org.eclipse.lyo.testsuite.oslcv2.TestsBase;
+import org.eclipse.lyo.testsuite.oslcv2.CoreResourceRdfXmlTests;
import org.eclipse.lyo.testsuite.server.util.OSLCConstants;
-import org.eclipse.lyo.testsuite.server.util.OSLCUtils;
-import org.eclipse.lyo.testsuite.server.util.RDFUtils;
-import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
import org.xml.sax.SAXException;
-import com.hp.hpl.jena.rdf.model.Model;
-import com.hp.hpl.jena.rdf.model.ModelFactory;
-import com.hp.hpl.jena.rdf.model.Property;
-import com.hp.hpl.jena.rdf.model.RDFNode;
-import com.hp.hpl.jena.rdf.model.Resource;
-import com.hp.hpl.jena.rdf.model.Selector;
-import com.hp.hpl.jena.rdf.model.SimpleSelector;
import com.hp.hpl.jena.rdf.model.StmtIterator;
-import com.hp.hpl.jena.vocabulary.RDF;
-
/**
* This class provides JUnit tests for the validation of a change request returned by accessing the change
@@ -60,155 +39,24 @@ import com.hp.hpl.jena.vocabulary.RDF;
* to test against, checking the relationship of elements in the XML representation of the change request.
*/
@RunWith(Parameterized.class)
-public class ChangeRequestRdfXmlTests extends TestsBase {
- private HttpResponse response;
- private Model fRdfModel = ModelFactory.createDefaultModel();
- private Resource fResource = null;
+public class ChangeRequestRdfXmlTests extends CoreResourceRdfXmlTests {
- public ChangeRequestRdfXmlTests(String url) throws IOException, ParserConfigurationException, SAXException, XPathExpressionException
- {
- super(url);
- // If currentUrl is null, it means that the query didn't match any
- // records. This isn't exactly a failure, but there's nothing more we
- // can test.
- assumeNotNull(currentUrl);
- response = OSLCUtils.getResponseFromUrl(setupBaseUrl, currentUrl, basicCreds, OSLCConstants.CT_RDF,
- headers);
- // Some records in the system might not be accessible to this user. This
- // isn't a failure, but there's nothing more we can test.
- int sc = response.getStatusLine().getStatusCode();
- assumeTrue(sc != HttpStatus.SC_FORBIDDEN && sc != HttpStatus.SC_UNAUTHORIZED);
- // Make sure the request succeeded before continuing.
- assertEquals(HttpStatus.SC_OK, sc);
-
- fRdfModel.read(response.getEntity().getContent(),
- OSLCUtils.absoluteUrlFromRelative(setupBaseUrl, currentUrl),
- OSLCConstants.JENA_RDF_XML);
- RDFUtils.validateModel(fRdfModel);
-
- fResource = (Resource) fRdfModel.getResource(currentUrl);
- assumeTrue(fRdfModel.contains(fResource, RDF.type,
- fRdfModel.createResource(OSLCConstants.CM_CHANGE_REQUEST_TYPE)));
+ public ChangeRequestRdfXmlTests(String thisUrl)
+ throws IOException, ParserConfigurationException, SAXException, XPathExpressionException, NullPointerException {
+ super(thisUrl);
}
- @Before
- public void setup() throws IOException, ParserConfigurationException, SAXException, XPathException
- {
- super.setup();
- }
-
@Parameters
- public static Collection<Object[]> getAllDescriptionUrls() throws IOException
- {
- //Checks the ServiceProviderCatalog at the specified baseUrl of the REST service in order to grab all urls
- //to other ServiceProvidersCatalogs contained within it, recursively, in order to find the URLs of all
- //query factories of the REST service.
- ArrayList<String> serviceUrls = getServiceProviderURLsUsingRdfXml(setupProps.getProperty("baseUri"), onlyOnce);
- ArrayList<String> capabilityURLsUsingRdfXml = TestsBase.getCapabilityURLsUsingRdfXml(OSLCConstants.QUERY_BASE_PROP, serviceUrls, true);
- String where = setupProps.getProperty("changeRequestsWhere");
- if (where == null) {
- String queryProperty = setupProps.getProperty("queryEqualityProperty");
- String queryPropertyValue = setupProps.getProperty("queryEqualityValue");
- where = queryProperty + "=\"" + queryPropertyValue + "\"";
- }
-
- String additionalParameters = setupProps.getProperty("queryAdditionalParameters");
- String query = (additionalParameters.length() == 0) ? "?" : "?" + additionalParameters + "&";
- query = query + "oslc.where=" + URLEncoder.encode(where, "UTF-8") + "&oslc.pageSize=1";
-
- ArrayList<String> results = new ArrayList<String>();
- for (String queryBaseUri : capabilityURLsUsingRdfXml) {
- String queryUrl = OSLCUtils.addQueryStringToURL(queryBaseUri, query);
- HttpResponse resp = OSLCUtils.getResponseFromUrl(setupBaseUrl, queryUrl, basicCreds,
- OSLCConstants.CT_RDF, headers);
- Model queryModel = ModelFactory.createDefaultModel();
- queryModel.read(resp.getEntity().getContent(), queryBaseUri, OSLCConstants.JENA_RDF_XML);
- RDFUtils.validateModel(queryModel);
-
- Property member = queryModel.createProperty(OSLCConstants.RDFS_MEMBER);
- Resource queryBase = queryModel.getResource(queryBaseUri);
- Selector select = new SimpleSelector(queryBase, member, (RDFNode)null);
- StmtIterator statements = queryModel.listStatements(select);
- while (statements.hasNext()) {
- results.add(statements.nextStatement().getObject().toString());
- if (onlyOnce) return toCollection(results);
- }
- if (!results.isEmpty() && onlyOnce)
- break;
- }
- return toCollection(results);
- }
+ public static Collection<Object[]> getAllDescriptionUrls() throws IOException {
- protected StmtIterator getStatementsForProp(String propUri) {
- Property prop = fRdfModel.getProperty(propUri);
- Selector select = new SimpleSelector(fResource, prop, (RDFNode)null);
- return fRdfModel.listStatements(select);
- }
-
- @Test
- public void changeRequestHasOneTitle()
- {
- StmtIterator listStatements = getStatementsForProp(OSLCConstants.DC_TITLE_PROP);
- int size=listStatements.toList().size();
- assertTrue("Can have 1 dc:title, found "+size, size == 1);
- }
-
- @Test
- public void changeRequestHasAtMostOneDescription()
- {
- StmtIterator listStatements = getStatementsForProp(OSLCConstants.DC_DESC_PROP);
- int size=listStatements.toList().size();
- assertTrue("Can have <=1 dc:description, found "+size, size <= 1);
- }
-
- @Test
- public void changeRequestHasAtMostOneIdentifier()
- {
- StmtIterator listStatements = getStatementsForProp(OSLCConstants.DC_ID_PROP);
- int size=listStatements.toList().size();
- assertTrue("Can have <=1 dc:identifier, found "+size, size <= 1);
- }
-
- @Test
- public void changeRequestHasAtMostOneName()
- {
- StmtIterator listStatements = getStatementsForProp(OSLCConstants.DC_NAME_PROP);
- int size=listStatements.toList().size();
- assertTrue("Can have <=1 dc:name, found "+size, size <= 1);
- }
-
- @Test
- public void changeRequestHasAtMostOneCreatedDate()
- {
- StmtIterator listStatements = getStatementsForProp(OSLCConstants.DC_CREATED_PROP);
- int size=listStatements.toList().size();
- assertTrue("Can have <=1 dc:created, found "+size, size <= 1);
- }
-
- @Test
- public void changeRequestHasAtMostOneModifiedDate()
- {
- StmtIterator listStatements = getStatementsForProp(OSLCConstants.DC_MODIFIED_PROP);
- int size=listStatements.toList().size();
- assertTrue("Can have <=1 dc:modified, found "+size, size <= 1);
- }
-
- @Test
- public void changeRequestHasAtMostOneDiscussion()
- {
- StmtIterator listStatements = getStatementsForProp(OSLCConstants.DISCUSSION_PROP);
- int size=listStatements.toList().size();
- assertTrue("Can have <=1 oslc:discussion, found "+size, size <= 1);
- }
-
- @Test
- public void changeRequestHasAtMostOneInstanceShape()
- {
- StmtIterator listStatements = getStatementsForProp(OSLCConstants.INST_SHAPE_PROP);
- int size=listStatements.toList().size();
- assertTrue("Can have <=1 oslc:instanceShape, found "+size, size <= 1);
+ setResourceTypeQuery(OSLCConstants.USAGE_PROP);
+ setxpathSubStmt("//oslc_v2:QueryCapability/oslc:resourceType/@rdf:resource");
+
+ return getAllDescriptionUrls(eval);
}
+ public static String eval = OSLCConstants.RDFS_MEMBER;
+
@Test
public void changeRequestHasAtMostOneCloseDate()
{
diff --git a/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/cm/ChangeRequestXmlTests.java b/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/cm/ChangeRequestXmlTests.java
index fe49789..6ec902f 100644
--- a/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/cm/ChangeRequestXmlTests.java
+++ b/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/cm/ChangeRequestXmlTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 IBM Corporation.
+ * Copyright (c) 2011, 2012 IBM Corporation.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -12,18 +12,14 @@
* Contributors:
*
* Steve Speicher - initial API and implementation
+ * Yuhong Yin
*******************************************************************************/
package org.eclipse.lyo.testsuite.oslcv2.cm;
-import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import static org.junit.Assume.assumeNotNull;
-import static org.junit.Assume.assumeTrue;
import java.io.IOException;
-import java.net.URLEncoder;
-import java.util.ArrayList;
import java.util.Collection;
import javax.xml.bind.DatatypeConverter;
@@ -32,203 +28,45 @@ import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathException;
import javax.xml.xpath.XPathExpressionException;
-
-import org.apache.commons.httpclient.HttpStatus;
-import org.apache.http.HttpResponse;
-import org.apache.http.util.EntityUtils;
-import org.eclipse.lyo.testsuite.oslcv2.TestsBase;
+import org.eclipse.lyo.testsuite.oslcv2.CoreResourceXmlTests;
import org.eclipse.lyo.testsuite.server.util.OSLCConstants;
import org.eclipse.lyo.testsuite.server.util.OSLCUtils;
-import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
-
/**
* This class provides JUnit tests for the validation of a change request returned by accessing the change
* request's URL directly. It runs the equality query from the properties file and grabs the first result
* to test against, checking the relationship of elements in the XML representation of the change request.
*/
@RunWith(Parameterized.class)
-public class ChangeRequestXmlTests extends TestsBase {
- private HttpResponse response;
- private String responseBody;
- private Document doc;
-
- public ChangeRequestXmlTests(String thisUrl) throws IOException, ParserConfigurationException, SAXException, XPathExpressionException
- {
- super(thisUrl);
-
- // If currentUrl is null, it means that the query didn't match any
- // records. This isn't exactly a failure, but there's nothing more we
- // can test.
- assumeNotNull(currentUrl);
- response = OSLCUtils.getResponseFromUrl(setupBaseUrl, currentUrl, basicCreds, OSLCConstants.CT_XML,
- headers);
- responseBody = EntityUtils.toString(response.getEntity());
- int sc = response.getStatusLine().getStatusCode();
-
- // Some records in the system might not be accessible to this user. This
- // isn't a failure, but there's nothing more we can test.
- assumeTrue(sc != HttpStatus.SC_FORBIDDEN && sc != HttpStatus.SC_UNAUTHORIZED);
-
- // Make sure the request succeeded before continuing.
- assertEquals(HttpStatus.SC_OK, sc);
-
- //Get XML Doc from response
- doc = OSLCUtils.createXMLDocFromResponseBody(responseBody);
- }
-
- @Before
- public void setup() throws IOException, ParserConfigurationException, SAXException, XPathException
- {
- super.setup();
- }
-
- @Parameters
- public static Collection<Object[]> getAllDescriptionUrls() throws IOException, ParserConfigurationException, SAXException, XPathException
- {
- //Checks the ServiceProviderCatalog at the specified baseUrl of the REST service in order to grab all urls
- //to other ServiceProvidersCatalogs contained within it, recursively, in order to find the URLs of all
- //query factories of the REST service.
- String v = "//oslc_v2:QueryCapability/oslc_v2:queryBase/@rdf:resource";
- ArrayList<String> serviceUrls = getServiceProviderURLsUsingXML(null);
- ArrayList<String> capabilityURLsUsingXML = TestsBase.getCapabilityURLsUsingXML(v, serviceUrls, true);
-
- // Once we have the query URL, look for a resource to validate
- String where = setupProps.getProperty("changeRequestsWhere");
- if (where == null) {
- String queryProperty = setupProps.getProperty("queryEqualityProperty");
- String queryPropertyValue = setupProps.getProperty("queryEqualityValue");
- where = queryProperty + "=\"" + queryPropertyValue + "\"";
- }
-
- String additionalParameters = setupProps.getProperty("queryAdditionalParameters");
- String query = (additionalParameters.length() == 0) ? "?" : "?" + additionalParameters + "&";
- query = query + "oslc.where=" + URLEncoder.encode(where, "UTF-8") + "&oslc.pageSize=1";
-
- ArrayList<String> results = new ArrayList<String>();
- for (String queryBase : capabilityURLsUsingXML) {
- String queryUrl = OSLCUtils.addQueryStringToURL(queryBase, query);
- HttpResponse resp = OSLCUtils.getResponseFromUrl(setupBaseUrl, queryUrl, basicCreds,
- OSLCConstants.CT_XML, headers);
- String respBody = EntityUtils.toString(resp.getEntity());
- EntityUtils.consume(resp.getEntity());
- assertTrue("Received " +resp.getStatusLine(), (resp.getStatusLine().getStatusCode() == HttpStatus.SC_OK));
- //Get XML Doc from response
- Document doc = OSLCUtils.createXMLDocFromResponseBody(respBody);
- //Check for results by reference (rdf:resource)
- Node result = (Node) OSLCUtils.getXPath().evaluate("//rdfs:member/@rdf:resource",
- doc, XPathConstants.NODE);
- if (result == null)
- //No results by reference. Check for inline results (rdf:about)
- result = (Node) OSLCUtils.getXPath().evaluate(
- "//rdfs:member/oslc_cm_v2:ChangeRequest/@rdf:about", doc,
- XPathConstants.NODE);
- if (result != null)
- results.add(result.getNodeValue());
- if (onlyOnce)
- break;
- }
- return toCollection(results);
- }
-
- @Test
- public void changeRequestHasOneTitle() throws XPathExpressionException
- {
- // All change requests have exactly one title.
- NodeList titles = (NodeList) OSLCUtils.getXPath().evaluate("//oslc_cm_v2:ChangeRequest/dc:title",
- doc, XPathConstants.NODESET);
- assertEquals(getFailureMessage(), 1, titles.getLength());
- }
-
- @Test
- public void changeRequestHasAtMostOneDescription() throws XPathExpressionException
- {
- NodeList descriptions = (NodeList) OSLCUtils.getXPath().evaluate("//oslc_cm_v2:ChangeRequest/dc:description",
- doc, XPathConstants.NODESET);
- assertTrue(getFailureMessage(), descriptions.getLength() <= 1);
- }
-
- @Test
- public void changeRequestHasAtMostOneIdentifier() throws XPathExpressionException
- {
- NodeList ids = (NodeList) OSLCUtils.getXPath().evaluate("//oslc_cm_v2:ChangeRequest/dc:identifier",
- doc, XPathConstants.NODESET);
- assertTrue(getFailureMessage(), ids.getLength() <= 1);
- }
-
- @Test
- public void changeRequestHasAtMostOneName() throws XPathExpressionException
- {
- NodeList names = (NodeList) OSLCUtils.getXPath().evaluate("//oslc_cm_v2:ChangeRequest/dc:name",
- doc, XPathConstants.NODESET);
- assertTrue(getFailureMessage(), names.getLength() <= 1);
- }
-
- @Test
- public void changeRequestHasAtMostOneCreatedDate() throws XPathExpressionException
- {
- NodeList createdDates = (NodeList) OSLCUtils.getXPath().evaluate("//oslc_cm_v2:ChangeRequest/dc:created",
- doc, XPathConstants.NODESET);
- assertTrue(getFailureMessage(), createdDates.getLength() <= 1);
- //If there is a created date, verify the format.
- if (createdDates.getLength() > 0)
- {
- try
- {
- DatatypeConverter.parseDateTime(createdDates.item(0).getTextContent());
- }
- catch (Exception e)
- {
- fail("Created date not in valid XSD format");
- }
- }
- }
-
- @Test
- public void changeRequestHasAtMostOneModifiedDate() throws XPathExpressionException
- {
- NodeList modifiedDates = (NodeList) OSLCUtils.getXPath().evaluate("//oslc_cm_v2:ChangeRequest/dc:modified",
- doc, XPathConstants.NODESET);
- assertTrue(getFailureMessage(), modifiedDates.getLength() <= 1);
- //If there is a modified date, verify the format.
- if (modifiedDates.getLength() > 0)
- {
- try
- {
- final String dateString = modifiedDates.item(0).getTextContent();
- DatatypeConverter.parseDateTime(dateString);
- }
- catch (Exception e)
- {
- fail("Modified date not in valid XSD format");
- }
- }
- }
-
- @Test
- public void changeRequestHasAtMostOneDiscussion() throws XPathExpressionException
- {
- NodeList discussions = (NodeList) OSLCUtils.getXPath().evaluate("//oslc_cm_v2:ChangeRequest/oslc:discussion",
- doc, XPathConstants.NODESET);
- assertTrue(getFailureMessage(), discussions.getLength() <= 1);
- }
-
- @Test
- public void changeRequestHasAtMostOneInstanceShape() throws XPathExpressionException
- {
- NodeList instances = (NodeList)OSLCUtils.getXPath().evaluate("//oslc_cm_v2:ChangeRequest/oslc:instanceShape",
- doc, XPathConstants.NODESET);
- assertTrue(getFailureMessage(), instances.getLength() <= 1);
- }
-
+public class ChangeRequestXmlTests extends CoreResourceXmlTests {
+
+ public ChangeRequestXmlTests(String thisUrl) throws IOException,
+ ParserConfigurationException, SAXException,
+ XPathExpressionException {
+
+ super(thisUrl);
+ setNode(ns, resource);
+ }
+
+ @Parameters
+ public static Collection<Object[]> getAllDescriptionUrls()
+ throws IOException, ParserConfigurationException, SAXException, XPathException {
+
+ setResourceTypeQuery(OSLCConstants.CORE_DEFAULT);
+ setxpathSubStmt("//oslc_v2:usage/@rdf:resource");
+ return getAllDescriptionUrls(eval);
+ }
+
+ public static String ns = "oslc_cm_v2";
+ public static String resource = "ChangeRequest";
+ public static String eval = "//rdfs:member/@rdf:resource";
+
@Test
public void changeRequestHasAtMostOneCloseDate() throws XPathExpressionException
{
@@ -303,9 +141,5 @@ public class ChangeRequestXmlTests extends TestsBase {
NodeList verifiedEles = (NodeList) OSLCUtils.getXPath().evaluate("//oslc_cm_v2:ChangeRequest/" +
"oslc_cm_v2:verified", doc, XPathConstants.NODESET);
assertTrue(getFailureMessage(), verifiedEles.getLength() <= 1);
- }
-
- private String getFailureMessage() {
- return "Problems with XML representation of OSLC ChangeRequest <" + currentUrl + ">";
- }
+ }
}
diff --git a/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/qm/TestCaseRdfXmlTests.java b/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/qm/TestCaseRdfXmlTests.java
new file mode 100644
index 0000000..89387bc
--- /dev/null
+++ b/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/qm/TestCaseRdfXmlTests.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2012 IBM Corporation.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * Yuhong Yin - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.lyo.testsuite.oslcv2.qm;
+
+import java.io.IOException;
+import java.util.Collection;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.xpath.XPathExpressionException;
+
+import org.eclipse.lyo.testsuite.oslcv2.CoreResourceRdfXmlTests;
+import org.eclipse.lyo.testsuite.server.util.OSLCConstants;
+import org.junit.runners.Parameterized.Parameters;
+import org.xml.sax.SAXException;
+
+public class TestCaseRdfXmlTests extends CoreResourceRdfXmlTests {
+
+ public TestCaseRdfXmlTests(String thisUrl)
+ throws IOException, ParserConfigurationException, SAXException, XPathExpressionException, NullPointerException {
+
+ super(thisUrl);
+ }
+
+ @Parameters
+ public static Collection<Object[]> getAllDescriptionUrls() throws IOException {
+
+ setResourceTypeQuery(OSLCConstants.RESOURCE_TYPE_PROP);
+ setxpathSubStmt(OSLCConstants.QM_TEST_CASE_QUERY);
+
+ return getAllDescriptionUrls(eval);
+ }
+
+ public static String eval = OSLCConstants.QM_TEST_CASE;
+
+}
diff --git a/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/qm/TestCaseXmlTests.java b/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/qm/TestCaseXmlTests.java
new file mode 100644
index 0000000..eff03b2
--- /dev/null
+++ b/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/qm/TestCaseXmlTests.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2012 IBM Corporation.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * Yuhong Yin - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.lyo.testsuite.oslcv2.qm;
+
+import java.io.IOException;
+import java.util.Collection;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.xpath.XPathException;
+import javax.xml.xpath.XPathExpressionException;
+
+import org.eclipse.lyo.testsuite.oslcv2.CoreResourceXmlTests;
+import org.eclipse.lyo.testsuite.server.util.OSLCConstants;
+import org.junit.Test;
+import org.junit.runners.Parameterized.Parameters;
+import org.xml.sax.SAXException;
+
+public class TestCaseXmlTests extends CoreResourceXmlTests {
+
+ public TestCaseXmlTests(String thisUrl)
+ throws IOException, ParserConfigurationException, SAXException, XPathExpressionException, NullPointerException {
+
+ super(thisUrl);
+ setNode(ns, resource);
+ }
+
+ @Parameters
+ public static Collection<Object[]> getAllDescriptionUrls()
+ throws IOException, ParserConfigurationException, SAXException, XPathException {
+
+ setResourceTypeQuery(OSLCConstants.QM_TEST_CASE_QUERY);
+ setxpathSubStmt("//oslc_v2:QueryCapability/oslc:resourceType/@rdf:resource");
+
+ return getAllDescriptionUrls(eval);
+ }
+
+ @Test
+ public void TestCaseRelatedChangeRequest() throws XPathExpressionException
+ {
+ // TestCase specific test
+ }
+
+ public static String ns = "oslc_qm_v2";
+ public static String resource = "TestCase";
+ public static String eval = "//" + ns + ":" + resource + "/@rdf:about";
+} \ No newline at end of file
diff --git a/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/qm/TestExecutionRecordRdfXmlTests.java b/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/qm/TestExecutionRecordRdfXmlTests.java
new file mode 100644
index 0000000..37bd127
--- /dev/null
+++ b/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/qm/TestExecutionRecordRdfXmlTests.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2012 IBM Corporation.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * Yuhong Yin - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.lyo.testsuite.oslcv2.qm;
+
+import java.io.IOException;
+import java.util.Collection;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.xpath.XPathExpressionException;
+
+import org.eclipse.lyo.testsuite.oslcv2.CoreResourceRdfXmlTests;
+import org.eclipse.lyo.testsuite.server.util.OSLCConstants;
+import org.junit.runners.Parameterized.Parameters;
+import org.xml.sax.SAXException;
+
+public class TestExecutionRecordRdfXmlTests extends CoreResourceRdfXmlTests {
+
+ public TestExecutionRecordRdfXmlTests(String thisUrl)
+ throws IOException, ParserConfigurationException, SAXException, XPathExpressionException, NullPointerException {
+
+ super(thisUrl);
+ }
+
+ @Parameters
+ public static Collection<Object[]> getAllDescriptionUrls() throws IOException {
+
+ setResourceTypeQuery(OSLCConstants.RESOURCE_TYPE_PROP);
+ setxpathSubStmt(OSLCConstants.QM_TEST_EXECUTION_RECORD_QUERY);
+
+ return getAllDescriptionUrls(eval);
+ }
+
+ public static String eval = OSLCConstants.QM_TEST_EXECUTION_RECORD;
+}
diff --git a/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/qm/TestExecutionRecordXmlTests.java b/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/qm/TestExecutionRecordXmlTests.java
new file mode 100644
index 0000000..755157c
--- /dev/null
+++ b/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/qm/TestExecutionRecordXmlTests.java
@@ -0,0 +1,71 @@
+package org.eclipse.lyo.testsuite.oslcv2.qm;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+import java.util.Collection;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathException;
+import javax.xml.xpath.XPathExpressionException;
+
+import org.eclipse.lyo.testsuite.oslcv2.CoreResourceXmlTests;
+import org.eclipse.lyo.testsuite.server.util.OSLCConstants;
+import org.eclipse.lyo.testsuite.server.util.OSLCUtils;
+import org.junit.Test;
+import org.junit.runners.Parameterized.Parameters;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+public class TestExecutionRecordXmlTests extends CoreResourceXmlTests {
+
+ public TestExecutionRecordXmlTests(String thisUrl)
+ throws IOException, ParserConfigurationException, SAXException, XPathExpressionException, NullPointerException {
+
+ super(thisUrl);
+ setNode(ns, resource);
+ }
+
+ @Parameters
+ public static Collection<Object[]> getAllDescriptionUrls()
+ throws IOException, ParserConfigurationException, SAXException, XPathException {
+
+ setResourceTypeQuery(OSLCConstants.QM_TEST_EXECUTION_RECORD_QUERY);
+ setxpathSubStmt("//oslc_v2:QueryCapability/oslc:resourceType/@rdf:resource");
+ return getAllDescriptionUrls(eval);
+
+ }
+
+ @Test
+ public void TestExecutionRecordHasOneReportsOnTestPlan() throws XPathExpressionException
+ {
+ String eval = "//" + getNode() + "/" + "oslc_qm_v2:reportsOnTestPlan";
+
+ NodeList results = (NodeList) OSLCUtils.getXPath().evaluate(eval,
+ doc, XPathConstants.NODESET);
+
+ assertEquals(getFailureMessage(), 1, results.getLength());
+ }
+
+ @Test
+ public void TestExecutionRecordHasOneRunsTestCase() throws XPathExpressionException
+ {
+ String eval = "//" + getNode() + "/" + "oslc_qm_v2:runsTestCase";
+
+ NodeList results = (NodeList) OSLCUtils.getXPath().evaluate(eval,
+ doc, XPathConstants.NODESET);
+
+ assertEquals(getFailureMessage(), 1, results.getLength());
+ }
+
+ @Test
+ public void TestExecutionRecordRelatedChangeRequest() throws XPathExpressionException
+ {
+ // TestCase specific test
+ }
+
+ public static String ns = "oslc_qm_v2";
+ public static String resource = "TestExecutionRecord";
+ public static String eval = "//" + ns + ":" + resource + "/@rdf:about";
+} \ No newline at end of file
diff --git a/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/qm/TestPlanRdfXmlTests.java b/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/qm/TestPlanRdfXmlTests.java
new file mode 100644
index 0000000..ceb781a
--- /dev/null
+++ b/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/qm/TestPlanRdfXmlTests.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2012 IBM Corporation.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * Yuhong Yin - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.lyo.testsuite.oslcv2.qm;
+
+import java.io.IOException;
+import java.util.Collection;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.xpath.XPathExpressionException;
+
+import org.eclipse.lyo.testsuite.oslcv2.CoreResourceRdfXmlTests;
+import org.eclipse.lyo.testsuite.server.util.OSLCConstants;
+import org.junit.runners.Parameterized.Parameters;
+import org.xml.sax.SAXException;
+
+public class TestPlanRdfXmlTests extends CoreResourceRdfXmlTests {
+
+ public TestPlanRdfXmlTests(String thisUrl)
+ throws IOException, ParserConfigurationException, SAXException, XPathExpressionException, NullPointerException {
+
+ super(thisUrl);
+ }
+
+ @Parameters
+ public static Collection<Object[]> getAllDescriptionUrls() throws IOException {
+
+ setResourceTypeQuery(OSLCConstants.RESOURCE_TYPE_PROP);
+ setxpathSubStmt(OSLCConstants.QM_TEST_PLAN_QUERY);
+
+ return getAllDescriptionUrls(eval);
+ }
+
+ public static String eval = OSLCConstants.QM_TEST_PLAN;
+}
diff --git a/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/qm/TestPlanXmlTests.java b/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/qm/TestPlanXmlTests.java
new file mode 100644
index 0000000..14b2448
--- /dev/null
+++ b/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/qm/TestPlanXmlTests.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2012 IBM Corporation.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * Yuhong Yin - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.lyo.testsuite.oslcv2.qm;
+
+import java.io.IOException;
+import java.util.Collection;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.xpath.XPathException;
+import javax.xml.xpath.XPathExpressionException;
+
+import org.eclipse.lyo.testsuite.oslcv2.CoreResourceXmlTests;
+import org.eclipse.lyo.testsuite.server.util.OSLCConstants;
+import org.junit.runners.Parameterized.Parameters;
+import org.xml.sax.SAXException;
+
+public class TestPlanXmlTests extends CoreResourceXmlTests {
+
+ public TestPlanXmlTests(String thisUrl)
+ throws IOException, ParserConfigurationException, SAXException, XPathExpressionException, NullPointerException {
+
+ super(thisUrl);
+ setNode(ns, resource);
+ }
+
+ @Parameters
+ public static Collection<Object[]> getAllDescriptionUrls()
+ throws IOException, ParserConfigurationException, SAXException, XPathException {
+
+ setResourceTypeQuery(OSLCConstants.QM_TEST_PLAN_QUERY);
+ setxpathSubStmt("//oslc_v2:QueryCapability/oslc:resourceType/@rdf:resource");
+
+ return getAllDescriptionUrls(eval);
+ }
+
+ public static String ns = "oslc_qm_v2";
+ public static String resource = "TestPlan";
+ public static String eval = "//" + ns + ":" + resource + "/@rdf:about";
+} \ No newline at end of file
diff --git a/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/qm/TestResultRdfXmlTests.java b/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/qm/TestResultRdfXmlTests.java
new file mode 100644
index 0000000..999eb9c
--- /dev/null
+++ b/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/qm/TestResultRdfXmlTests.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2012 IBM Corporation.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * Yuhong Yin - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.lyo.testsuite.oslcv2.qm;
+
+import java.io.IOException;
+import java.util.Collection;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.xpath.XPathExpressionException;
+
+import org.eclipse.lyo.testsuite.oslcv2.CoreResourceRdfXmlTests;
+import org.eclipse.lyo.testsuite.server.util.OSLCConstants;
+import org.junit.runners.Parameterized.Parameters;
+import org.xml.sax.SAXException;
+
+public class TestResultRdfXmlTests extends CoreResourceRdfXmlTests {
+
+ public TestResultRdfXmlTests(String thisUrl)
+ throws IOException, ParserConfigurationException, SAXException, XPathExpressionException, NullPointerException {
+
+ super(thisUrl);
+ }
+
+ @Parameters
+ public static Collection<Object[]> getAllDescriptionUrls() throws IOException {
+
+ setResourceTypeQuery(OSLCConstants.RESOURCE_TYPE_PROP);
+ setxpathSubStmt(OSLCConstants.QM_TEST_RESULT_QUERY);
+
+ return getAllDescriptionUrls(eval);
+ }
+
+ public static String eval = OSLCConstants.QM_TEST_RESULT;
+}
diff --git a/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/qm/TestResultXmlTests.java b/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/qm/TestResultXmlTests.java
new file mode 100644
index 0000000..d5d272b
--- /dev/null
+++ b/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/qm/TestResultXmlTests.java
@@ -0,0 +1,113 @@
+/*******************************************************************************
+ * Copyright (c) 2012 IBM Corporation.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * Yuhong Yin - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.lyo.testsuite.oslcv2.qm;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+import java.util.Collection;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathException;
+import javax.xml.xpath.XPathExpressionException;
+
+import org.eclipse.lyo.testsuite.oslcv2.CoreResourceXmlTests;
+import org.eclipse.lyo.testsuite.server.util.OSLCConstants;
+import org.eclipse.lyo.testsuite.server.util.OSLCUtils;
+import org.junit.Test;
+import org.junit.runners.Parameterized.Parameters;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+public class TestResultXmlTests extends CoreResourceXmlTests {
+
+ public TestResultXmlTests(String thisUrl)
+ throws IOException, ParserConfigurationException, SAXException, XPathExpressionException, NullPointerException {
+
+ super(thisUrl);
+
+ setNode(ns, resource);
+ }
+
+ @Parameters
+ public static Collection<Object[]> getAllDescriptionUrls()
+ throws IOException, ParserConfigurationException, SAXException, XPathException {
+
+ setResourceTypeQuery(OSLCConstants.QM_TEST_RESULT_QUERY);
+ setxpathSubStmt("//oslc_v2:QueryCapability/oslc:resourceType/@rdf:resource");
+ return getAllDescriptionUrls(eval);
+ }
+
+ @Test
+ public void TestResultHasOneStatus() throws XPathExpressionException
+ {
+ String eval = "//" + getNode() + "/" + "oslc_qm_v2:status";
+
+ NodeList statuses = (NodeList) OSLCUtils.getXPath().evaluate(eval,
+ doc, XPathConstants.NODESET);
+
+ assertEquals(getFailureMessage(), 1, statuses.getLength());
+ }
+
+ @Test
+ public void TestResultHasOneExecutesTestScript() throws XPathExpressionException
+ {
+ String eval = "//" + getNode() + "/" + "oslc_qm_v2:executesTestScript";
+
+ NodeList results = (NodeList) OSLCUtils.getXPath().evaluate(eval,
+ doc, XPathConstants.NODESET);
+
+ assertEquals(getFailureMessage(), 1, results.getLength());
+ }
+
+ @Test
+ public void TestResultHasOneProducedByTestExecutionRecord() throws XPathExpressionException
+ {
+ String eval = "//" + getNode() + "/" + "oslc_qm_v2:producedByTestExecutionRecord";
+
+ NodeList results = (NodeList) OSLCUtils.getXPath().evaluate(eval,
+ doc, XPathConstants.NODESET);
+
+ assertEquals(getFailureMessage(), 1, results.getLength());
+ }
+
+ @Test
+ public void TestResultHasOneReportsOnTestCase() throws XPathExpressionException
+ {
+ String eval = "//" + getNode() + "/" + "oslc_qm_v2:reportsOnTestCase";
+
+ NodeList results = (NodeList) OSLCUtils.getXPath().evaluate(eval,
+ doc, XPathConstants.NODESET);
+
+ assertEquals(getFailureMessage(), 1, results.getLength());
+ }
+
+ @Test
+ public void TestResultHasOneReportsOnTestPlan() throws XPathExpressionException
+ {
+ String eval = "//" + getNode() + "/" + "oslc_qm_v2:reportsOnTestPlan";
+
+ NodeList results = (NodeList) OSLCUtils.getXPath().evaluate(eval,
+ doc, XPathConstants.NODESET);
+
+ assertEquals(getFailureMessage(), 1, results.getLength());
+ }
+
+ public static String ns = "oslc_qm_v2";
+ public static String resource = "TestResult";
+ public static String eval = "//" + ns + ":" + resource + "/@rdf:about";
+} \ No newline at end of file
diff --git a/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/qm/TestScriptRdfXmlTests.java b/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/qm/TestScriptRdfXmlTests.java
new file mode 100644
index 0000000..e748a67
--- /dev/null
+++ b/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/qm/TestScriptRdfXmlTests.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2012 IBM Corporation.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * Yuhong Yin - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.lyo.testsuite.oslcv2.qm;
+
+import java.io.IOException;
+import java.util.Collection;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.xpath.XPathExpressionException;
+
+import org.eclipse.lyo.testsuite.oslcv2.CoreResourceRdfXmlTests;
+import org.eclipse.lyo.testsuite.server.util.OSLCConstants;
+import org.junit.runners.Parameterized.Parameters;
+import org.xml.sax.SAXException;
+
+public class TestScriptRdfXmlTests extends CoreResourceRdfXmlTests {
+
+ public TestScriptRdfXmlTests(String thisUrl)
+ throws IOException, ParserConfigurationException, SAXException, XPathExpressionException, NullPointerException {
+
+ super(thisUrl);
+ }
+
+ @Parameters
+ public static Collection<Object[]> getAllDescriptionUrls() throws IOException {
+
+ setResourceTypeQuery(OSLCConstants.RESOURCE_TYPE_PROP);
+ setxpathSubStmt(OSLCConstants.QM_TEST_SCRIPT_QUERY);
+
+ return getAllDescriptionUrls(eval);
+ }
+
+ public static String eval = OSLCConstants.QM_TEST_SCRIPT;
+}
diff --git a/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/qm/TestScriptXmlTests.java b/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/qm/TestScriptXmlTests.java
new file mode 100644
index 0000000..53b208f
--- /dev/null
+++ b/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/oslcv2/qm/TestScriptXmlTests.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2012 IBM Corporation.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * Yuhong Yin - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.lyo.testsuite.oslcv2.qm;
+
+import java.io.IOException;
+import java.util.Collection;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.xpath.XPathException;
+import javax.xml.xpath.XPathExpressionException;
+
+import org.eclipse.lyo.testsuite.oslcv2.CoreResourceXmlTests;
+import org.eclipse.lyo.testsuite.server.util.OSLCConstants;
+import org.junit.Test;
+import org.junit.runners.Parameterized.Parameters;
+import org.xml.sax.SAXException;
+
+public class TestScriptXmlTests extends CoreResourceXmlTests {
+
+ public TestScriptXmlTests(String thisUrl)
+ throws IOException, ParserConfigurationException, SAXException, XPathExpressionException, NullPointerException {
+
+ super(thisUrl);
+ setNode(ns, resource);
+ }
+
+ @Parameters
+ public static Collection<Object[]> getAllDescriptionUrls()
+ throws IOException, ParserConfigurationException, SAXException, XPathException {
+
+ setResourceTypeQuery(OSLCConstants.QM_TEST_SCRIPT_QUERY);
+ setxpathSubStmt("//oslc_v2:QueryCapability/oslc:resourceType/@rdf:resource");
+ return getAllDescriptionUrls(eval);
+ }
+
+ @Test
+ public void TestScriptRelatedChangeRequest() throws XPathExpressionException
+ {
+ // TestCase specific test
+ }
+
+ public static String ns = "oslc_qm_v2";
+ public static String resource = "TestScript";
+ public static String eval = "//" + ns + ":" + resource + "/@rdf:about";
+} \ No newline at end of file
diff --git a/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/server/DynamicSuiteBuilder.java b/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/server/DynamicSuiteBuilder.java
index e42b643..1347201 100644
--- a/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/server/DynamicSuiteBuilder.java
+++ b/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/server/DynamicSuiteBuilder.java
@@ -20,7 +20,6 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.Properties;
-
import org.eclipse.lyo.testsuite.oslcv2.TestsBase;
import org.eclipse.lyo.testsuite.server.oslcv1tests.CreationAndUpdateTests;
import org.eclipse.lyo.testsuite.server.oslcv1tests.OAuthTests;
@@ -84,6 +83,20 @@ public class DynamicSuiteBuilder
testsToRun.add(org.eclipse.lyo.testsuite.oslcv2.cm.ChangeRequestRdfXmlTests.class);
testsToRun.add(org.eclipse.lyo.testsuite.oslcv2.cm.ChangeRequestJsonTests.class);
testsToRun.add(org.eclipse.lyo.testsuite.oslcv2.SimplifiedQueryJsonTests.class);
+ }
+
+ if (OSLCConstants.OSLC_QM_V2.equals(testVersions)) {
+ testsToRun.add(org.eclipse.lyo.testsuite.oslcv2.qm.TestPlanXmlTests.class);
+ testsToRun.add(org.eclipse.lyo.testsuite.oslcv2.qm.TestCaseXmlTests.class);
+ testsToRun.add(org.eclipse.lyo.testsuite.oslcv2.qm.TestScriptXmlTests.class);
+ testsToRun.add(org.eclipse.lyo.testsuite.oslcv2.qm.TestExecutionRecordXmlTests.class);
+ testsToRun.add(org.eclipse.lyo.testsuite.oslcv2.qm.TestResultXmlTests.class);
+
+ testsToRun.add(org.eclipse.lyo.testsuite.oslcv2.qm.TestPlanRdfXmlTests.class);
+ testsToRun.add(org.eclipse.lyo.testsuite.oslcv2.qm.TestCaseRdfXmlTests.class);
+ testsToRun.add(org.eclipse.lyo.testsuite.oslcv2.qm.TestScriptRdfXmlTests.class);
+ testsToRun.add(org.eclipse.lyo.testsuite.oslcv2.qm.TestExecutionRecordRdfXmlTests.class);
+ testsToRun.add(org.eclipse.lyo.testsuite.oslcv2.qm.TestResultRdfXmlTests.class);
}
}
testsToRun.add(org.eclipse.lyo.testsuite.oslcv2.CreationAndUpdateRdfXmlTests.class);
diff --git a/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/server/util/OSLCConstants.java b/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/server/util/OSLCConstants.java
index 02b035c..a1bdbbf 100644
--- a/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/server/util/OSLCConstants.java
+++ b/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/server/util/OSLCConstants.java
@@ -25,12 +25,14 @@ public interface OSLCConstants {
static String RDF = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
static String RDFS = "http://www.w3.org/2000/01/rdf-schema#";
static String ATOM = "http://www.w3.org/2005/Atom";
- static String OSLC_V2 = "http://open-services.net/ns/core#";
+ static String OSLC_V2 = "http://open-services.net/ns/core#";
+ static String CORE_DEFAULT = "http://open-services.net/ns/core#default";
static String OSLC_CM_V2 = "http://open-services.net/ns/cm#";
static String OSLC_AM_V2 = "http://open-services.net/ns/am#";
static String OSLC_ASSET_V2 = "http://open-services.net/ns/asset#";
static String OSLC_QM_V2 = "http://open-services.net/ns/qm#";
- static String OSLC_RM_V2 = "http://open-services.net/ns/rm#";
+ static String OSLC_RM_V2 = "http://open-services.net/ns/rm#";
+
// Version 1.0 namespace definitions
static String OSLC_DISC = "http://open-services.net/xmlns/discovery/1.0/";
static String OSLC_CM = "http://open-services.net/xmlns/cm/1.0/";
@@ -68,7 +70,8 @@ public interface OSLCConstants {
public static final String SERVICE_PROVIDER_TYPE = OSLC_V2 + "ServiceProvider";
public static final String SERVICE_PROVIDER_CATALOG_PROP = OSLC_V2 + "serviceProviderCatalog";
public static final String SERVICE_PROVIDER_CATALOG_TYPE = OSLC_V2 + "ServiceProviderCatalog";
- public static final String CREATION_PROP = OSLC_V2 + "creation";
+ public static final String CREATION_PROP = OSLC_V2 + "creation";
+ public static final String QUERY_CAPABILITY_PROP = OSLC_V2 + "QueryCapability";
public static final String QUERY_BASE_PROP = OSLC_V2 + "queryBase";
public static final String RESP_INFO_TYPE = OSLC_V2 + "ResponseInfo";
public static final String SERVICE_PROP = OSLC_V2 + "service";
@@ -79,8 +82,7 @@ public interface OSLCConstants {
public static final String TOTAL_COUNT_PROP = OSLC_V2 + "totalCount";
public static final String RESOURCE_TYPE_PROP = OSLC_V2 + "resourceType";
public static final String RESOURCE_SHAPE_PROP = OSLC_V2 + "resourceShape";
-
-
+ public static final String DESCRIPTION_PROP = OSLC_V2 + "Description";
// OSLC CM 2.0
public static final String CM_CHANGE_REQUEST_TYPE = OSLC_CM_V2 + "ChangeRequest";
public static final String CM_CLOSE_DATE_PROP = OSLC_CM_V2 + "closeDate";
@@ -91,7 +93,20 @@ public interface OSLCConstants {
public static final String CM_APPROVED_PROP = OSLC_CM_V2 + "approved";
public static final String CM_REVIEWED_PROP = OSLC_CM_V2 + "reviewed";
public static final String CM_VERIFIED_PROP = OSLC_CM_V2 + "verified";
-
+
+ // OSLC QM 2.0
+ public static final String QM_TEST_PLAN = OSLC_QM_V2 + "testPlan";
+ public static final String QM_TEST_CASE = OSLC_QM_V2 + "testCase";
+ public static final String QM_TEST_SCRIPT = OSLC_QM_V2 + "testScript";
+ public static final String QM_TEST_RESULT = OSLC_QM_V2 + "testResult";
+ public static final String QM_TEST_EXECUTION_RECORD = OSLC_QM_V2 + "testExecutionRecord";
+
+ public static final String QM_TEST_PLAN_QUERY = OSLC_QM_V2 + "TestPlanQuery";
+ public static final String QM_TEST_CASE_QUERY = OSLC_QM_V2 + "TestCaseQuery";
+ public static final String QM_TEST_SCRIPT_QUERY = OSLC_QM_V2 + "TestScriptQuery";
+ public static final String QM_TEST_RESULT_QUERY = OSLC_QM_V2 + "TestResultQuery";
+ public static final String QM_TEST_EXECUTION_RECORD_QUERY = OSLC_QM_V2 + "TestExecutionRecordQuery";
+
// RDF
public static final String RDF_TYPE_PROP = RDF + "type";
public static final String RDFS_MEMBER = RDFS + "member";
diff --git a/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/server/util/OSLCNamespaceContext.java b/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/server/util/OSLCNamespaceContext.java
index 7a4ac8b..c687bb3 100644
--- a/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/server/util/OSLCNamespaceContext.java
+++ b/org.eclipse.lyo.testsuite.server/src/main/java/org/eclipse/lyo/testsuite/server/util/OSLCNamespaceContext.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 IBM Corporation.
+ * Copyright (c) 2011, 2012 IBM Corporation.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -12,6 +12,7 @@
* Contributors:
*
* Steve Speicher - initial API and implementation
+ * Yuhong Yin
*******************************************************************************/
package org.eclipse.lyo.testsuite.server.util;
@@ -37,7 +38,8 @@ public class OSLCNamespaceContext implements NamespaceContext {
else if ("oslc_cm".equals(prefix)) return OSLCConstants.OSLC_CM;
else if ("rtc_cm".equals(prefix)) return OSLCConstants.RTC_CM;
else if ("atom".equals(prefix)) return OSLCConstants.ATOM;
- else if ("oslc_cm_v2".equals(prefix)) return OSLCConstants.OSLC_CM_V2;
+ else if ("oslc_cm_v2".equals(prefix)) return OSLCConstants.OSLC_CM_V2;
+ else if ("oslc_qm_v2".equals(prefix)) return OSLCConstants.OSLC_QM_V2;
return XMLConstants.NULL_NS_URI;
}
public String getPrefix(String uri) {return null;}