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
/
TestCase.java
255 lines (219 loc) · 8.2 KB
/
TestCase.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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
/*
* 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_TestCase
*/
@Deprecated
@OslcResourceShape(title = "Quality Management Resource Shape", describes = QmConstants.TYPE_TEST_CASE)
@OslcNamespace(QmConstants.QUALITY_MANAGEMENT_NAMESPACE)
public final class TestCase
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<String> subjects = new TreeSet<String>();
private final Set<Link> testsChangeRequests = new HashSet<Link>();
private final Set<Link> usesTestScripts = new HashSet<Link>();
private final Set<Link> validatesRequirements = new HashSet<Link>();
private String description;
public TestCase()
{
super();
}
protected URI getRdfType() {
return URI.create(QmConstants.TYPE_TEST_CASE);
}
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 addSubject(final String subject)
{
this.subjects.add(subject);
}
public void addTestsChangeRequest(final Link changeRequest)
{
this.testsChangeRequests.add(changeRequest);
}
public void addUsesTestScript(final Link testscript)
{
this.usesTestScripts.add(testscript);
}
public void addValidatesRequirement(final Link requirement)
{
this.validatesRequirements.add(requirement);
}
@OslcDescription("The person(s) who are responsible for the work needed to complete the test case.")
@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("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("Tag or keyword for a resource. Each occurrence of a dcterms:subject property denotes an additional tag for the resource.")
@OslcName("subject")
@OslcPropertyDefinition(OslcConstants.DCTERMS_NAMESPACE + "subject")
@OslcReadOnly(false)
@OslcTitle("Subjects")
public String[] getSubjects()
{
return subjects.toArray(new String[subjects.size()]);
}
@OslcDescription("Change Request tested by the Test Case.")
@OslcName("testsChangeRequest")
@OslcPropertyDefinition(QmConstants.QUALITY_MANAGEMENT_NAMESPACE + "testsChangeRequest")
@OslcRange(QmConstants.TYPE_CHANGE_REQUEST)
@OslcReadOnly(false)
@OslcTitle("Tests Change Request")
public Link[] getTestsChangeRequests()
{
return testsChangeRequests.toArray(new Link[testsChangeRequests.size()]);
}
@OslcDescription("Test Script used by the Test Case.")
@OslcName("usesTestScript")
@OslcPropertyDefinition(QmConstants.QUALITY_MANAGEMENT_NAMESPACE + "usesTestScript")
@OslcRange(QmConstants.TYPE_TEST_SCRIPT)
@OslcReadOnly(false)
@OslcTitle("Uses Test Script")
public Link[] getUsesTestScripts()
{
return usesTestScripts.toArray(new Link[usesTestScripts.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 setRelatedChangeRequests(final Link[] relatedChangeRequests)
{
this.relatedChangeRequests.clear();
if (relatedChangeRequests != null)
{
this.relatedChangeRequests.addAll(Arrays.asList(relatedChangeRequests));
}
}
public void setSubjects(final String[] subjects)
{
this.subjects.clear();
if (subjects != null)
{
this.subjects.addAll(Arrays.asList(subjects));
}
}
public void setTestsChangeRequests(final Link[] testsChangeRequests)
{
this.testsChangeRequests.clear();
if (testsChangeRequests != null)
{
this.testsChangeRequests.addAll(Arrays.asList(testsChangeRequests));
}
}
public void setUsesTestScripts(final Link[] usesTestScripts)
{
this.usesTestScripts.clear();
if (usesTestScripts != null)
{
this.usesTestScripts.addAll(Arrays.asList(usesTestScripts));
}
}
public void setValidatesRequirements(final Link[] validatesRequirements)
{
this.validatesRequirements.clear();
if (validatesRequirements != null)
{
this.validatesRequirements.addAll(Arrays.asList(validatesRequirements));
}
}
}