public abstract class LdpTest extends Object
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_MODEL_TYPE |
static DateFormat |
df |
static String |
HTTP_LOG_FILENAME |
protected static PrintWriter |
httpLog
For HTTP details on validation failures
|
static String |
MANUAL
A grouping of tests that may not need to run as part of the regular
TestNG runs.
|
static String |
MAY
An item is truly optional.
|
static String |
MUST
An absolute requirement of the specification.
|
static String |
SHOULD
There may exist valid reasons in particular circumstances to ignore a
particular item, but the full implications must be understood and
carefully weighed before choosing a different course.
|
protected static PrintWriter |
skipLog
For skipped test logging
|
static String |
SKIPPED_LOG_FILENAME |
Constructor and Description |
---|
LdpTest() |
Modifier and Type | Method and Description |
---|---|
protected abstract com.jayway.restassured.specification.RequestSpecification |
buildBaseRequestSpecification()
Build a base RestAssured
RequestSpecification . |
protected void |
checkPreferenceAppliedHeader(com.jayway.restassured.response.Response response)
Asserts the response has a
Preference-Applied:
return=representation response header, but only if at
least one Preference-Applied header is present. |
void |
commonSetup(String outputDir,
String postTtl,
String httpLogging,
String skipLogging)
Initialization of generic resource model.
|
void |
commonTearDown() |
protected boolean |
containsLinkHeader(String linkContext,
String relation,
String linkTarget,
String requestUri,
com.jayway.restassured.response.Response response)
Tests if a Link response header with the expected context URI, link
relation, and target URI is present in an HTTP response.
|
com.hp.hpl.jena.rdf.model.Model |
getAsModel(String uri) |
protected com.hp.hpl.jena.rdf.model.Model |
getDefaultModel() |
protected String |
getFirstLinkForRelation(String linkContext,
String relation,
String requestUri,
com.jayway.restassured.response.Response response)
Gets the first link from
response with link relation rel . |
protected com.hp.hpl.jena.rdf.model.Resource |
getPrimaryTopic(com.hp.hpl.jena.rdf.model.Model model,
String location)
Given the location (URI), locate the appropriate "primary" resource within
the model.
|
com.hp.hpl.jena.rdf.model.Model |
getResourceAsModel(String uri,
String mediaType) |
protected boolean |
hasReturnRepresentation(List<com.jayway.restassured.response.Header> preferenceAppliedHeaders) |
static String |
include(String... preferences) |
static String |
omit(String... preferences) |
protected com.hp.hpl.jena.rdf.model.Model |
postContent() |
protected com.hp.hpl.jena.rdf.model.Model |
readModel(String path)
Builds a model from a turtle representation in a file
|
static String |
resolveIfRelative(String base,
String toResolve)
Resolves a URI if it's a relative path.
|
protected static String |
resolveIfRelative(String base,
URI toResolve) |
protected boolean |
restrictionsOnPostContent()
Are there any restrictions on content when creating resources? This is
assumed to be true if POST content was provided using the
postTtl
test parameter. |
protected List<String> |
splitLinks(com.jayway.restassured.response.Header linkHeader)
Splits an HTTP Link header that might have multiple links separated by a
comma.
|
public static final String SKIPPED_LOG_FILENAME
public static final String HTTP_LOG_FILENAME
public static final DateFormat df
public static final String DEFAULT_MODEL_TYPE
protected static PrintWriter httpLog
protected static PrintWriter skipLog
public static final String MUST
public static final String SHOULD
public static final String MAY
public static final String MANUAL
public LdpTest()
protected com.hp.hpl.jena.rdf.model.Model readModel(String path)
path
- public void commonSetup(String outputDir, String postTtl, String httpLogging, String skipLogging) throws IOException
postTtl
- the resource with Turtle content to use for POST requestshttpLogging
- whether to log HTTP request and response details on errorsIOException
public void commonTearDown()
protected abstract com.jayway.restassured.specification.RequestSpecification buildBaseRequestSpecification()
RequestSpecification
.public com.hp.hpl.jena.rdf.model.Model getAsModel(String uri)
public com.hp.hpl.jena.rdf.model.Model getResourceAsModel(String uri, String mediaType)
protected com.hp.hpl.jena.rdf.model.Model getDefaultModel()
protected com.hp.hpl.jena.rdf.model.Resource getPrimaryTopic(com.hp.hpl.jena.rdf.model.Model model, String location)
model
- location
- protected com.hp.hpl.jena.rdf.model.Model postContent()
protected boolean restrictionsOnPostContent()
postTtl
test parameter.
This method is used for
CommonContainerTest.testRelativeUriResolutionPost(String)
.
RdfSourceTest.restrictionsOnTestResourceContent()
protected boolean containsLinkHeader(String linkContext, String relation, String linkTarget, String requestUri, com.jayway.restassured.response.Response response)
linkContext
- the context of the Link (usually the request URI, but can be
changed with an anchor parameter)relation
- the expected link relation (rel)linkTarget
- the expected URIrequestUri
- the HTTP request URI (for determing a Link's context and
resolving relative URIs)response
- the HTTP responseprotected String getFirstLinkForRelation(String linkContext, String relation, String requestUri, com.jayway.restassured.response.Response response)
response
with link relation rel
.
Resolves relative URIs against the request URI if necessary.linkContext
- the context of the Link (usually the request URI, but can be
changed with an anchor parameter)relation
- the expected link relationrequestUri
- the HTTP request URI (for determing a Link's context and
resolving relative URIs)response
- the HTTP responsenull
if none was foundprotected List<String> splitLinks(com.jayway.restassured.response.Header linkHeader)
linkHeader
- the link header"<http://example.com/bt/bug432>; rel=related"
)protected void checkPreferenceAppliedHeader(com.jayway.restassured.response.Response response)
Preference-Applied:
return=representation
response header, but only if at
least one Preference-Applied
header is present.response
- the HTTP responseprotected boolean hasReturnRepresentation(List<com.jayway.restassured.response.Header> preferenceAppliedHeaders)
public static String resolveIfRelative(String base, String toResolve)
base
- the base URI to usetoResolve
- a URI that might be relativeprotected static String resolveIfRelative(String base, URI toResolve)
Copyright © 2014 World Wide Web Consortium (W3C). All rights reserved.