This repository has been archived by the owner on Oct 12, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
/
TestScript.java
188 lines (162 loc) · 6.16 KB
/
TestScript.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
/*
* Copyright (c) 2020 Contributors to the Eclipse Foundation
*
* 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.
*
* SPDX-License-Identifier: EPL-1.0 OR BSD-3-Clause
*/
package org.eclipse.lyo.oslc4j.client.resources;
import java.net.URI;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import java.util.TreeSet;
import org.eclipse.lyo.oslc4j.core.annotation.OslcDescription;
import org.eclipse.lyo.oslc4j.core.annotation.OslcName;
import org.eclipse.lyo.oslc4j.core.annotation.OslcNamespace;
import org.eclipse.lyo.oslc4j.core.annotation.OslcPropertyDefinition;
import org.eclipse.lyo.oslc4j.core.annotation.OslcRange;
import org.eclipse.lyo.oslc4j.core.annotation.OslcReadOnly;
import org.eclipse.lyo.oslc4j.core.annotation.OslcResourceShape;
import org.eclipse.lyo.oslc4j.core.annotation.OslcTitle;
import org.eclipse.lyo.oslc4j.core.annotation.OslcValueType;
import org.eclipse.lyo.oslc4j.core.model.Link;
import org.eclipse.lyo.oslc4j.core.model.OslcConstants;
import org.eclipse.lyo.oslc4j.core.model.ValueType;
/**
* @see http://open-services.net/bin/view/Main/QmSpecificationV2#Resource_TestScript
*/
@OslcResourceShape(title = "Quality Management Resource Shape", describes = QmConstants.TYPE_TEST_SCRIPT)
@OslcNamespace(QmConstants.QUALITY_MANAGEMENT_NAMESPACE)
public final class TestScript
extends QmResource
{
private final Set<URI> contributors = new TreeSet<URI>();
private final Set<URI> creators = new TreeSet<URI>();
private final Set<Link> relatedChangeRequests = new HashSet<Link>();
private final Set<Link> validatesRequirements = new HashSet<Link>();
private URI executionInstructions;
private String description;
public TestScript()
{
super();
}
protected URI getRdfType() {
return URI.create(QmConstants.TYPE_TEST_SCRIPT);
}
public void addContributor(final URI contributor)
{
this.contributors.add(contributor);
}
public void addCreator(final URI creator)
{
this.creators.add(creator);
}
public void addRelatedChangeRequest(final Link relatedChangeRequest)
{
this.relatedChangeRequests.add(relatedChangeRequest);
}
public void addValidatesRequirement(final Link requirement)
{
this.validatesRequirements.add(requirement);
}
@OslcDescription("The person(s) who are responsible for the work needed to complete the change request.")
@OslcName("contributor")
@OslcPropertyDefinition(OslcConstants.DCTERMS_NAMESPACE + "contributor")
@OslcRange(QmConstants.TYPE_PERSON)
@OslcTitle("Contributors")
public URI[] getContributors()
{
return contributors.toArray(new URI[contributors.size()]);
}
@OslcDescription("Creator or creators of resource.")
@OslcName("creator")
@OslcPropertyDefinition(OslcConstants.DCTERMS_NAMESPACE + "creator")
@OslcRange(QmConstants.TYPE_PERSON)
@OslcTitle("Creators")
public URI[] getCreators()
{
return creators.toArray(new URI[creators.size()]);
}
@OslcDescription("Descriptive text (reference: Dublin Core) about resource represented as rich text in XHTML content.")
@OslcPropertyDefinition(OslcConstants.DCTERMS_NAMESPACE + "description")
@OslcTitle("Description")
@OslcValueType(ValueType.XMLLiteral)
public String getDescription()
{
return description;
}
@OslcDescription("Instructions for executing the test script.")
@OslcPropertyDefinition(QmConstants.QUALITY_MANAGEMENT_NAMESPACE + "executionInstructions")
@OslcTitle("Execution Instructions")
public URI getExecutionInstructions()
{
return executionInstructions;
}
@OslcDescription("A related change request.")
@OslcName("relatedChangeRequest")
@OslcPropertyDefinition(QmConstants.QUALITY_MANAGEMENT_NAMESPACE + "relatedChangeRequest")
@OslcRange(QmConstants.TYPE_CHANGE_REQUEST)
@OslcReadOnly(false)
@OslcTitle("Related Change Requests")
public Link[] getRelatedChangeRequests()
{
return relatedChangeRequests.toArray(new Link[relatedChangeRequests.size()]);
}
@OslcDescription("Requirement that is validated by the Test Case.")
@OslcName("validatesRequirement")
@OslcPropertyDefinition(QmConstants.QUALITY_MANAGEMENT_NAMESPACE + "validatesRequirement")
@OslcRange(QmConstants.TYPE_REQUIREMENT)
@OslcReadOnly(false)
@OslcTitle("Validates Requirement")
public Link[] getValidatesRequirements()
{
return validatesRequirements.toArray(new Link[validatesRequirements.size()]);
}
public void setContributors(final URI[] contributors)
{
this.contributors.clear();
if (contributors != null)
{
this.contributors.addAll(Arrays.asList(contributors));
}
}
public void setCreators(final URI[] creators)
{
this.creators.clear();
if (creators != null)
{
this.creators.addAll(Arrays.asList(creators));
}
}
public void setDescription(final String description)
{
this.description = description;
}
public void setExecutionInstructions(final URI executionInstructions)
{
this.executionInstructions = executionInstructions;
}
public void setRelatedChangeRequests(final Link[] relatedChangeRequests)
{
this.relatedChangeRequests.clear();
if (relatedChangeRequests != null)
{
this.relatedChangeRequests.addAll(Arrays.asList(relatedChangeRequests));
}
}
public void setValidatesRequirements(final Link[] validatesRequirements)
{
this.validatesRequirements.clear();
if (validatesRequirements != null)
{
this.validatesRequirements.addAll(Arrays.asList(validatesRequirements));
}
}
}