use of javax.ws.rs.core.EntityTag in project cxf by apache.
the class RequestImplTest method testStrictEtagsPreconditionNotMet.
@Test
public void testStrictEtagsPreconditionNotMet() {
metadata.putSingle("If-Match", new EntityTag("123", true).toString());
ResponseBuilder rb = new RequestImpl(m).evaluatePreconditions(new EntityTag("123"));
assertEquals("Precondition must not be met, strict comparison is required", 412, rb.build().getStatus());
}
use of javax.ws.rs.core.EntityTag in project cxf by apache.
the class RequestImplTest method testStarEtagsIfNotMatchPut.
@Test
public void testStarEtagsIfNotMatchPut() {
metadata.putSingle(HttpHeaders.IF_NONE_MATCH, "*");
m.put(Message.HTTP_REQUEST_METHOD, "PUT");
ResponseBuilder rb = new RequestImpl(m).evaluatePreconditions(new EntityTag("123"));
assertEquals("Precondition must not be met", 412, rb.build().getStatus());
}
use of javax.ws.rs.core.EntityTag in project cxf by apache.
the class RequestImplTest method testStarEtags.
@Test
public void testStarEtags() {
metadata.putSingle("If-Match", "*");
ResponseBuilder rb = new RequestImpl(m).evaluatePreconditions(new EntityTag("123"));
assertNull("Precondition must be met", rb);
}
use of javax.ws.rs.core.EntityTag in project cxf by apache.
the class RequestImplTest method testStrictEtagsPreconditionMet.
@Test
public void testStrictEtagsPreconditionMet() {
metadata.putSingle("If-Match", new EntityTag("123").toString());
ResponseBuilder rb = new RequestImpl(m).evaluatePreconditions(new EntityTag("123"));
assertNull("Precondition must be met", rb);
}
use of javax.ws.rs.core.EntityTag in project cxf by apache.
the class EntityTagHeaderProviderTest method testToString.
@Test
public void testToString() {
EntityTag tag = new EntityTag("");
assertEquals("\"\"", tag.toString());
tag = new EntityTag("", true);
assertEquals("W/\"\"", tag.toString());
tag = new EntityTag("bar");
assertEquals("\"bar\"", tag.toString());
}
Aggregations