aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorttsanton2014-02-04 11:03:55 (EST)
committerttsanton2014-02-04 13:19:44 (EST)
commit9ca5e17d8b426af76cca7edfa194dae3c3fbaea7 (patch)
tree841f0f0d79fa6208b4ac941c63f5dba2bbaea4ac
parent8711bd522478b370f6736512556bad0b5822cd36 (diff)
downloadorg.eclipse.lyo.rio-9ca5e17d8b426af76cca7edfa194dae3c3fbaea7.zip
org.eclipse.lyo.rio-9ca5e17d8b426af76cca7edfa194dae3c3fbaea7.tar.gz
org.eclipse.lyo.rio-9ca5e17d8b426af76cca7edfa194dae3c3fbaea7.tar.bz2
Bug 427283 - Update QM server sample with additional resourcesrefs/changes/18/21518/2
- Updated the index page to reflect changes Change-Id: I1fd87eaf280d3d55746743766ed1cea49d8d0a46 Signed-off-by: ttsanton <ttsanton@us.ibm.com>
-rw-r--r--org.eclipse.lyo.oslc4j.qualitymanagement/WebContent/web/index.jsp6
-rw-r--r--org.eclipse.lyo.oslc4j.qualitymanagement/src/org/eclipse/lyo/oslc4j/qualitymanagement/servlet/Populate.java136
2 files changed, 138 insertions, 4 deletions
diff --git a/org.eclipse.lyo.oslc4j.qualitymanagement/WebContent/web/index.jsp b/org.eclipse.lyo.oslc4j.qualitymanagement/WebContent/web/index.jsp
index 452729b..2eb61c5 100644
--- a/org.eclipse.lyo.oslc4j.qualitymanagement/WebContent/web/index.jsp
+++ b/org.eclipse.lyo.oslc4j.qualitymanagement/WebContent/web/index.jsp
@@ -30,6 +30,10 @@
<p><a href="http://wiki.eclipse.org/Lyo/BuildingOSLC4J">Lyo/Building OSLC4J Wiki</a></p>
<p><a href="/OSLC4JRegistry/catalog/singleton">Catalog</a></p>
<p><a href="/OSLC4JQualityManagement/services/testPlans">List of Test Plans</a></p>
+<p><a href="/OSLC4JQualityManagement/services/testCases">List of Test Cases</a></p>
+<p><a href="/OSLC4JQualityManagement/services/testResults">List of Test Results</a></p>
+<p><a href="/OSLC4JQualityManagement/services/testExecutionRecords">List of Test Execution Records</a></p>
+<p><a href="/OSLC4JQualityManagement/services/testScripts"> List of Test Scripts</a></p>
</div>
<h3><b>Sample Dialogs</b></h3>
@@ -39,6 +43,8 @@
<p><a href="/OSLC4JQualityManagement/services/testCases/selector">TestCases Selector</a></p>
<p><a href="/OSLC4JQualityManagement/services/testCases/creator">TestCases Creator</a></p>
<p><a href="/OSLC4JQualityManagement/services/testResults/selector">TestResults Selector</a></p>
+<p><a href="/OSLC4JQualityManagement/services/testExecutionRecords/selector">TestExecutionRecord Selector</a></p>
+<p><a href="/OSLC4JQualityManagement/services/testScripts/selector">TestScript Selector</a></p>
</div>
</body>
diff --git a/org.eclipse.lyo.oslc4j.qualitymanagement/src/org/eclipse/lyo/oslc4j/qualitymanagement/servlet/Populate.java b/org.eclipse.lyo.oslc4j.qualitymanagement/src/org/eclipse/lyo/oslc4j/qualitymanagement/servlet/Populate.java
index 6822b4e..fac6092 100644
--- a/org.eclipse.lyo.oslc4j.qualitymanagement/src/org/eclipse/lyo/oslc4j/qualitymanagement/servlet/Populate.java
+++ b/org.eclipse.lyo.oslc4j.qualitymanagement/src/org/eclipse/lyo/oslc4j/qualitymanagement/servlet/Populate.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012 IBM Corporation.
+ * Copyright (c) 2012, 2014 IBM Corporation.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -19,9 +19,14 @@ import java.net.URI;
import java.net.URISyntaxException;
import java.util.Date;
+import org.eclipse.lyo.oslc4j.core.model.Link;
import org.eclipse.lyo.oslc4j.qualitymanagement.Persistence;
import org.eclipse.lyo.oslc4j.qualitymanagement.QmResource;
+import org.eclipse.lyo.oslc4j.qualitymanagement.TestCase;
+import org.eclipse.lyo.oslc4j.qualitymanagement.TestExecutionRecord;
import org.eclipse.lyo.oslc4j.qualitymanagement.TestPlan;
+import org.eclipse.lyo.oslc4j.qualitymanagement.TestResult;
+import org.eclipse.lyo.oslc4j.qualitymanagement.TestScript;
final class Populate
{
@@ -49,14 +54,28 @@ final class Populate
public void populate()
throws URISyntaxException
- {
- TestPlan testPlan = createTestPlan("Lyo Rio Test Plan", "This test plan will focus on testing the reference implementations of the OSLC domains.", "testPlans");
+ {
+ TestScript testScript = createTestScript("Lyo Rio Test Script", "This is a sample test script that lists the steps used to conduct the tests", "testScripts");
+ Persistence.addResource(testScript);
+
+ TestCase testCase = createTestCase("Lyo Rio Test Case", "This test case will determine whether a system exhibits the correct behavior under specific circumstances", "testCases");
+ Persistence.addResource(testCase);
+
+ TestPlan testPlan = createTestPlan("Lyo Rio Test Plan", "This test plan will focus on testing the reference implementations of the OSLC domains.", testCase, "testPlans");
Persistence.addResource(testPlan);
+
+ TestExecutionRecord testExecution = createTestExecutionRecord("Lyo Rio Test Execution Record", testPlan, testCase, "testExecutionRecords");
+ Persistence.addResource(testExecution);
+
+ TestResult testResult = createTestResult("Lyo Rio Test Result", "Sample Status", testPlan, testScript, testExecution, "testResults");
+ Persistence.addResource(testResult);
+
}
private TestPlan createTestPlan (final String title,
final String description,
- final String path)
+ final TestCase testCase,
+ final String path)
throws URISyntaxException
{
final TestPlan testPlan = new TestPlan();
@@ -70,6 +89,10 @@ final class Populate
testPlan.setServiceProvider(serviceProviderURI);
testPlan.setTitle(title);
testPlan.setDescription(description);
+
+ Link[] link = {new Link(testCase.getAbout())};
+
+ testPlan.setUsesTestCases(link);
final Date date = new Date();
testPlan.setCreated(date);
@@ -78,4 +101,109 @@ final class Populate
return testPlan;
}
+ private TestScript createTestScript (final String title,
+ final String description,
+ final String path)
+ throws URISyntaxException
+ {
+ final TestScript testScript = new TestScript();
+
+ final long identifier = Persistence.getNextIdentifier();
+
+ final URI about = new URI(basePath + "/" + path + "/" + identifier);
+
+ testScript.setAbout(about);
+ testScript.setIdentifier(String.valueOf(identifier));
+ testScript.setServiceProvider(serviceProviderURI);
+ testScript.setTitle(title);
+ testScript.setDescription(description);
+
+ final Date date = new Date();
+ testScript.setCreated(date);
+ testScript.setModified(date);
+
+ return testScript;
+ }
+
+ private TestCase createTestCase (final String title,
+ final String description,
+ final String path)
+ throws URISyntaxException
+ {
+ final TestCase testCase = new TestCase();
+
+ final long identifier = Persistence.getNextIdentifier();
+
+ final URI about = new URI(basePath + "/" + path + "/" + identifier);
+
+ testCase.setAbout(about);
+ testCase.setIdentifier(String.valueOf(identifier));
+ testCase.setServiceProvider(serviceProviderURI);
+ testCase.setTitle(title);
+ testCase.setDescription(description);
+
+ final Date date = new Date();
+ testCase.setCreated(date);
+ testCase.setModified(date);
+
+ return testCase;
+ }
+
+ private TestResult createTestResult(final String title,
+ final String status,
+ final TestPlan testPlan,
+ final TestScript testScript,
+ final TestExecutionRecord testExecute,
+ final String path)
+ throws URISyntaxException
+ {
+ final TestResult testResult = new TestResult();
+
+ final long identifier = Persistence.getNextIdentifier();
+
+ final URI about = new URI(basePath + "/" + path + "/" + identifier);
+
+ testResult.setAbout(about);
+ testResult.setIdentifier(String.valueOf(identifier));
+ testResult.setServiceProvider(serviceProviderURI);
+ testResult.setTitle(title);
+ testResult.setStatus(status);
+
+ testResult.setReportsOnTestPlan(new Link(testPlan.getAbout()));
+ testResult.setExecutesTestScript(new Link(testScript.getAbout()));
+ testResult.setProducedByTestExecutionRecord(new Link(testExecute.getAbout()));
+
+ final Date date = new Date();
+ testResult.setCreated(date);
+ testResult.setModified(date);
+
+ return testResult;
+ }
+
+ private TestExecutionRecord createTestExecutionRecord(final String title,
+ final TestPlan testPlan,
+ final TestCase testCase,
+ final String path)
+ throws URISyntaxException
+ {
+ final TestExecutionRecord testExecutionRecord = new TestExecutionRecord();
+
+ final long identifier = Persistence.getNextIdentifier();
+
+ final URI about = new URI(basePath + "/" + path + "/" + identifier);
+
+ testExecutionRecord.setAbout(about);
+ testExecutionRecord.setIdentifier(String.valueOf(identifier));
+ testExecutionRecord.setServiceProvider(serviceProviderURI);
+ testExecutionRecord.setTitle(title);
+
+ testExecutionRecord.setReportsOnTestPlan(new Link(testPlan.getAbout()));
+ testExecutionRecord.setRunsTestCase(new Link(testCase.getAbout()));
+
+ final Date date = new Date();
+ testExecutionRecord.setCreated(date);
+ testExecutionRecord.setModified(date);
+
+ return testExecutionRecord;
+ }
}