[OLINGO-266] Merge remote-tracking branch 'origin/master' into olingo-266-tecsvc

This commit is contained in:
Stephan Klevenz 2014-05-26 10:58:35 +02:00
commit 4cb3b32afe
18 changed files with 278 additions and 64 deletions

View File

@ -37,7 +37,7 @@ public final class EntityContainerFactory<C extends CommonEdmEnabledODataClient<
private static final Map<String, EntityContainerFactory<?>> FACTORY_PER_SERVICEROOT =
new ConcurrentHashMap<String, EntityContainerFactory<?>>();
private static final Map<Class<?>, Object> ENTITY_CONTAINERS = new ConcurrentHashMap<Class<?>, Object>();
private final Map<Class<?>, Object> ENTITY_CONTAINERS = new ConcurrentHashMap<Class<?>, Object>();
@SuppressWarnings("unchecked")
private static <C extends CommonEdmEnabledODataClient<?>> EntityContainerFactory<C> getInstance(final C client) {

View File

@ -32,8 +32,6 @@ public final class EntityContainerInvocationHandler extends AbstractInvocationHa
private static final long serialVersionUID = 7379006755693410764L;
private final EntityContainerFactory<?> factory;
protected final String namespace;
private final String name;
@ -56,8 +54,7 @@ public final class EntityContainerInvocationHandler extends AbstractInvocationHa
throw new IllegalArgumentException(
ref.getName() + " is not annotated as @" + EntityContainer.class.getSimpleName());
}
this.factory = factory;
this.name = ((EntityContainer) annotation).name();
this.defaultEC = ((EntityContainer) annotation).isDefaultEntityContainer();
this.namespace = ((EntityContainer) annotation).namespace();

View File

@ -199,6 +199,7 @@ public abstract class AbstractServices {
@Consumes(ContentType.MULTIPART_MIXED)
@Produces(ContentType.APPLICATION_OCTET_STREAM + ";boundary=" + BOUNDARY)
public Response batch(
@HeaderParam("Authorization") @DefaultValue(StringUtils.EMPTY) String authorization,
@HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) String prefer,
final @Multipart MultipartBody attachment) {
try {
@ -294,7 +295,7 @@ public abstract class AbstractServices {
if (url == null) {
res = null;
} else {
final WebClient client = WebClient.create(url);
final WebClient client = WebClient.create(url, "odatajclient", "odatajclient", null);
client.headers(headers);
if ("DELETE".equals(method)) {

View File

@ -89,7 +89,8 @@ public abstract class AbstractTestITCase {
return customer;
}
protected void createAndDeleteOrder(final InMemoryEntities container) {
protected void createAndDeleteOrder(
final InMemoryEntities container, final EntityContainerFactory<EdmEnabledODataClient> containerFactory) {
final Order order = container.getOrders().newOrder();
order.setOrderID(105);

View File

@ -23,6 +23,7 @@ import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.ext.proxy.EntityContainerFactory;
import org.apache.olingo.client.api.v4.EdmEnabledODataClient;
import static org.apache.olingo.fit.proxy.v4.AbstractTestITCase.testAuthServiceRootURL;
import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.InMemoryEntities;
public class AuthEntityCreateTestITCase extends EntityCreateTestITCase {
@ -32,7 +33,7 @@ public class AuthEntityCreateTestITCase extends EntityCreateTestITCase {
private InMemoryEntities ime;
@Override
public EntityContainerFactory<EdmEnabledODataClient> getContainerFactory() {
protected EntityContainerFactory<EdmEnabledODataClient> getContainerFactory() {
if (ecf == null) {
ecf = EntityContainerFactory.getV4(testAuthServiceRootURL);
ecf.getClient().getConfiguration().setDefaultBatchAcceptFormat(ContentType.APPLICATION_OCTET_STREAM);
@ -49,4 +50,5 @@ public class AuthEntityCreateTestITCase extends EntityCreateTestITCase {
}
return ime;
}
}

View File

@ -29,9 +29,7 @@ public class AuthEntityRetrieveTestITCase extends EntityRetrieveTestITCase {
@Override
protected InMemoryEntities getContainer() {
final EntityContainerFactory<EdmEnabledODataClient> ecf =
EntityContainerFactory.getV4(testAuthServiceRootURL);
ecf.getClient().getConfiguration().setKeyAsSegment(true);
final EntityContainerFactory<EdmEnabledODataClient> ecf = EntityContainerFactory.getV4(testAuthServiceRootURL);
ecf.getClient().getConfiguration().setDefaultBatchAcceptFormat(ContentType.APPLICATION_OCTET_STREAM);
ecf.getClient().getConfiguration().
setHttpClientFactory(new BasicAuthHttpClientFactory("odatajclient", "odatajclient"));

View File

@ -56,7 +56,7 @@ import org.junit.Test;
*/
public class EntityCreateTestITCase extends AbstractTestITCase {
public EntityContainerFactory<EdmEnabledODataClient> getContainerFactory() {
protected EntityContainerFactory<EdmEnabledODataClient> getContainerFactory() {
return containerFactory;
}
@ -66,7 +66,7 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
@Test
public void createAndDelete() {
createAndDeleteOrder(getContainer());
createAndDeleteOrder(getContainer(), getContainerFactory());
}
@Test
@ -137,7 +137,7 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
getContainer().flush();
Customer actual = readCustomer(container, id);
Customer actual = readCustomer(getContainer(), id);
assertEquals(homeAddress.getCity(), actual.getHomeAddress().getCity());
assertEquals(1, actual.getOrders().size());
assertEquals(8, actual.getOrders().iterator().next().getOrderID(), 0);
@ -201,7 +201,7 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
assertEquals(id, order.getOrderID());
assertEquals(id, customer.getPersonID());
Customer actual = readCustomer(container, id);
Customer actual = readCustomer(getContainer(), id);
assertEquals(homeAddress.getCity(), actual.getHomeAddress().getCity());
assertEquals(1, actual.getOrders().size());
assertEquals(id, actual.getOrders().iterator().next().getOrderID());
@ -216,7 +216,7 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
order = getContainer().getOrders().get(id);
assertNull(order);
actual = readCustomer(container, id);
actual = readCustomer(getContainer(), id);
assertTrue(actual.getOrders().isEmpty());
getContainer().getCustomers().delete(actual.getPersonID());

View File

@ -68,7 +68,7 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
@Test
public void get() {
readCustomer(container, 1);
readCustomer(getContainer(), 1);
}
@Test
@ -120,14 +120,14 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
@Test
public void withInlineEntry() {
final Customer customer = readCustomer(container, 1);
final Customer customer = readCustomer(getContainer(), 1);
final Company company = customer.getCompany();
assertEquals(0, company.getCompanyID(), 0);
}
@Test
public void withInlineFeed() {
final Customer customer = readCustomer(container, 1);
final Customer customer = readCustomer(getContainer(), 1);
final OrderCollection orders = customer.getOrders();
assertEquals(1, orders.size());
assertEquals(8, orders.iterator().next().getOrderID(), 0);
@ -165,7 +165,7 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
@Test
public void contained() {
final PaymentInstrument instrument = container.getAccounts().get(101).getMyPaymentInstruments().get(101901);
final PaymentInstrument instrument = getContainer().getAccounts().get(101).getMyPaymentInstruments().get(101901);
assertNotNull(instrument);
assertEquals(101901, instrument.getPaymentInstrumentID(), 0);
assertNotNull(instrument.getCreatedDate());

View File

@ -30,12 +30,24 @@ import org.junit.Test;
public class KeyAsSegmentTestITCase extends AbstractTestITCase {
private InMemoryEntities getContainer() {
final EntityContainerFactory<EdmEnabledODataClient> ecf =
EntityContainerFactory.getV4(testKeyAsSegmentServiceRootURL);
ecf.getClient().getConfiguration().setKeyAsSegment(true);
ecf.getClient().getConfiguration().setDefaultBatchAcceptFormat(ContentType.APPLICATION_OCTET_STREAM);
return ecf.getEntityContainer(InMemoryEntities.class);
private EntityContainerFactory<EdmEnabledODataClient> ecf;
private InMemoryEntities ime;
protected EntityContainerFactory<EdmEnabledODataClient> getContainerFactory() {
if (ecf == null) {
ecf = EntityContainerFactory.getV4(testKeyAsSegmentServiceRootURL);
ecf.getClient().getConfiguration().setKeyAsSegment(true);
ecf.getClient().getConfiguration().setDefaultBatchAcceptFormat(ContentType.APPLICATION_OCTET_STREAM);
}
return ecf;
}
protected InMemoryEntities getContainer() {
if (ime == null) {
ime = getContainerFactory().getEntityContainer(InMemoryEntities.class);
}
return ime;
}
@Test
@ -45,7 +57,7 @@ public class KeyAsSegmentTestITCase extends AbstractTestITCase {
@Test
public void createAndDelete() {
createAndDeleteOrder(getContainer());
createAndDeleteOrder(getContainer(), getContainerFactory());
}
@Test
@ -58,5 +70,4 @@ public class KeyAsSegmentTestITCase extends AbstractTestITCase {
person = getContainer().getPeople().get(5);
assertEquals("middleN", person.getMiddleName());
}
}

View File

@ -0,0 +1,57 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.olingo.fit.proxy.v4;
import org.apache.olingo.client.api.http.HttpClientException;
import org.apache.olingo.client.core.http.BasicAuthHttpClientFactory;
import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.ext.proxy.EntityContainerFactory;
import org.apache.olingo.client.api.v4.EdmEnabledODataClient;
import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.InMemoryEntities;
import org.junit.Test;
public class UnauthorizedEntityCreateTestITCase extends AbstractTestITCase {
private EntityContainerFactory<EdmEnabledODataClient> ecf;
private InMemoryEntities ime;
public EntityContainerFactory<EdmEnabledODataClient> getContainerFactory() {
if (ecf == null) {
ecf = EntityContainerFactory.getV4(testAuthServiceRootURL);
ecf.getClient().getConfiguration().setDefaultBatchAcceptFormat(ContentType.APPLICATION_OCTET_STREAM);
ecf.getClient().getConfiguration().
setHttpClientFactory(new BasicAuthHttpClientFactory("not_auth", "not_auth"));
}
return ecf;
}
@Test(expected = HttpClientException.class)
public void unauthorizedCreate() {
createAndDeleteOrder(getContainer(), getContainerFactory());
}
protected InMemoryEntities getContainer() {
if (ime == null) {
ime = getContainerFactory().getEntityContainer(InMemoryEntities.class);
}
return ime;
}
}

View File

@ -0,0 +1,118 @@
/*
* Copyright 2014 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.olingo.fit.v4;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
import java.net.URI;
import org.apache.olingo.client.api.communication.header.HeaderName;
import org.apache.olingo.client.api.communication.request.batch.BatchManager;
import org.apache.olingo.client.api.communication.request.batch.ODataChangeset;
import org.apache.olingo.client.api.communication.request.batch.v4.ODataBatchRequest;
import org.apache.olingo.client.api.communication.request.cud.ODataEntityUpdateRequest;
import org.apache.olingo.client.api.communication.request.cud.v4.UpdateType;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
import org.apache.olingo.client.api.communication.response.ODataBatchResponse;
import org.apache.olingo.client.api.http.HttpClientException;
import org.apache.olingo.client.api.uri.v4.URIBuilder;
import org.apache.olingo.client.api.v4.ODataClient;
import org.apache.olingo.client.core.ODataClientFactory;
import org.apache.olingo.client.core.http.BasicAuthHttpClientFactory;
import org.apache.olingo.commons.api.domain.v4.ODataEntity;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.commons.api.format.ODataPubFormat;
public class AuthBatchTestITCase extends AbstractTestITCase {
private final static String ACCEPT = ContentType.APPLICATION_OCTET_STREAM;
@Test
public void clean() throws EdmPrimitiveTypeException {
final ODataClient authclient = ODataClientFactory.getV4();
batchRequest(authclient, testStaticServiceRootURL);
}
@Test
public void authorized() throws EdmPrimitiveTypeException {
final ODataClient authclient = ODataClientFactory.getV4();
authclient.getConfiguration().setHttpClientFactory(new BasicAuthHttpClientFactory("odatajclient", "odatajclient"));
batchRequest(authclient, testAuthServiceRootURL);
}
@Test(expected = HttpClientException.class)
public void unauthorized() throws EdmPrimitiveTypeException {
final ODataClient unauthclient = ODataClientFactory.getV4();
unauthclient.getConfiguration().setHttpClientFactory(new BasicAuthHttpClientFactory("not_auth", "not_auth"));
batchRequest(unauthclient, testAuthServiceRootURL);
}
@SuppressWarnings({"unchecked"})
private void batchRequest(final ODataClient client, final String baseURL) throws EdmPrimitiveTypeException {
// create your request
final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(baseURL);
request.setAccept(ACCEPT);
request.addCustomHeader("User-Agent", "Microsoft ADO.NET Data Client xxx");
request.addCustomHeader(HeaderName.acceptCharset, "UTF-8");
final BatchManager streamManager = request.payloadManager();
// -------------------------------------------
// Add retrieve item
// -------------------------------------------
// prepare URI
URIBuilder targetURI = client.newURIBuilder(baseURL);
targetURI.appendEntitySetSegment("Customers").appendKeySegment(1);
// create new request
ODataEntityRequest<ODataEntity> queryReq = client.getRetrieveRequestFactory().getEntityRequest(targetURI.build());
queryReq.setFormat(ODataPubFormat.JSON);
streamManager.addRequest(queryReq);
// -------------------------------------------
// -------------------------------------------
// Add changeset item
// -------------------------------------------
final ODataChangeset changeset = streamManager.addChangeset();
// Update Customer into the changeset
targetURI = client.newURIBuilder(baseURL).appendEntitySetSegment("Customers").appendKeySegment(1);
final URI editLink = targetURI.build();
final ODataEntity patch = client.getObjectFactory().newEntity(
new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Customer"));
patch.setEditLink(editLink);
patch.getProperties().add(client.getObjectFactory().newPrimitiveProperty(
"LastName",
client.getObjectFactory().newPrimitiveValueBuilder().buildString("new last name")));
final ODataEntityUpdateRequest<ODataEntity> changeReq =
client.getCUDRequestFactory().getEntityUpdateRequest(UpdateType.PATCH, patch);
changeReq.setFormat(ODataPubFormat.JSON_FULL_METADATA);
changeset.addRequest(changeReq);
// -------------------------------------------
final ODataBatchResponse response = streamManager.getResponse();
assertEquals(200, response.getStatusCode());
assertEquals("OK", response.getStatusMessage());
}
}

View File

@ -39,16 +39,14 @@ public class ErrorResponseTestITCase extends AbstractTestITCase {
appendEntitySetSegment("Customers").appendKeySegment(32).
build();
final ODataEntityRequest<ODataEntity> req = getClient().getRetrieveRequestFactory().getEntityRequest(readURI);
try {
final ODataEntity read = read(ODataPubFormat.JSON, readURI);
read(ODataPubFormat.JSON, readURI);
fail("should have got exception");
} catch (Exception ex) {
final ODataError err = ((ODataClientErrorException) ex).getODataError();
// verify details
final ODataErrorDetail detail = (ODataErrorDetail) err.getDetails().get(0);
final ODataErrorDetail detail = err.getDetails().get(0);
assertEquals("Code should be correct", "301", detail.getCode());
assertEquals("Target should be correct", "$search", detail.getTarget());
assertEquals("Message should be correct", "$search query option not supported", detail.getMessage());

View File

@ -54,7 +54,9 @@ public class ODataClientErrorException extends RuntimeException {
* @param error OData error to be wrapped.
*/
public ODataClientErrorException(final StatusLine statusLine, final ODataError error) {
super((StringUtils.isBlank(error.getCode()) ? StringUtils.EMPTY : "(" + error.getCode() + ") ")
super(error == null
? statusLine.toString()
: (StringUtils.isBlank(error.getCode()) ? StringUtils.EMPTY : "(" + error.getCode() + ") ")
+ error.getMessage() + " [" + statusLine.toString() + "]");
this.statusLine = statusLine;

View File

@ -16,6 +16,8 @@
package org.apache.olingo.client.core.communication.request;
import java.io.IOException;
import java.io.InputStream;
import org.apache.http.Header;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
@ -24,6 +26,7 @@ import org.apache.olingo.client.api.CommonEdmEnabledODataClient;
import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.ODataClientErrorException;
import org.apache.olingo.client.api.communication.ODataServerErrorException;
import org.apache.olingo.client.api.communication.header.HeaderName;
import org.apache.olingo.client.api.http.HttpClientException;
import org.apache.olingo.commons.api.domain.ODataError;
import org.apache.olingo.commons.core.data.JSONODataErrorImpl;
@ -57,12 +60,12 @@ public abstract class AbstractRequest {
// If using and Edm enabled client, checks that the cached service root matches the request URI
if (odataClient instanceof CommonEdmEnabledODataClient
&& !request.getURI().toASCIIString().startsWith(
((CommonEdmEnabledODataClient) odataClient).getServiceRoot())) {
((CommonEdmEnabledODataClient) odataClient).getServiceRoot())) {
throw new IllegalArgumentException(
String.format("The current request URI %s does not match the configured service root %s",
request.getURI().toASCIIString(),
((CommonEdmEnabledODataClient) odataClient).getServiceRoot()));
request.getURI().toASCIIString(),
((CommonEdmEnabledODataClient) odataClient).getServiceRoot()));
}
}
@ -75,7 +78,18 @@ public abstract class AbstractRequest {
if (httpEntity == null) {
throw new ODataClientErrorException(response.getStatusLine());
} else {
final boolean isXML = !accept.contains("json");
boolean isXML;
if (!accept.contains("json") && !accept.contains("xml")) {
isXML = true;
for (Header header : response.getHeaders(HeaderName.contentType.toString())) {
if (header.getValue() != null && header.getValue().contains("json")) {
isXML = false;
}
}
} else {
isXML = !accept.contains("json");
}
ODataError error;
try {
error = odataClient.getReader().readError(httpEntity.getContent(), isXML);

View File

@ -91,15 +91,27 @@ public abstract class AbstractODataStreamedRequest<V extends ODataResponse, T ex
public T payloadManager() {
payloadManager = getPayloadManager();
((HttpEntityEnclosingRequestBase) request).setEntity(
URIUtils.buildInputStreamEntity(odataClient, payloadManager.getBody()));
if (URIUtils.shouldUseRepeatableHttpBodyEntry(odataClient)) {
futureWrapper.setWrapped(odataClient.getConfiguration().getExecutor().submit(new Callable<HttpResponse>() {
@Override
public HttpResponse call() throws Exception {
((HttpEntityEnclosingRequestBase) request).setEntity(
URIUtils.buildInputStreamEntity(odataClient, payloadManager.getBody()));
futureWrapper.setWrapped(odataClient.getConfiguration().getExecutor().submit(new Callable<HttpResponse>() {
@Override
public HttpResponse call() throws Exception {
return doExecute();
}
}));
return doExecute();
}
}));
} else {
((HttpEntityEnclosingRequestBase) request).setEntity(
URIUtils.buildInputStreamEntity(odataClient, payloadManager.getBody()));
futureWrapper.setWrapped(odataClient.getConfiguration().getExecutor().submit(new Callable<HttpResponse>() {
@Override
public HttpResponse call() throws Exception {
return doExecute();
}
}));
}
// returns the stream manager object
return (T) payloadManager;

View File

@ -373,7 +373,7 @@ public final class URIUtils {
return value;
}
private static boolean shouldUseRepeatableHttpBodyEntry(final CommonODataClient<?> client) {
public static boolean shouldUseRepeatableHttpBodyEntry(final CommonODataClient<?> client) {
// returns true for authentication request in case of http401 which needs retry so requires being repeatable.
HttpClientFactory httpclientFactory = client.getConfiguration().getHttpClientFactory();
if (httpclientFactory instanceof BasicAuthHttpClientFactory) {
@ -391,24 +391,13 @@ public final class URIUtils {
public static HttpEntity buildInputStreamEntity(final CommonODataClient<?> client, final InputStream input) {
HttpEntity entity;
// --------------------------
// Check just required by batch requests since their ansynchronous entity specification mechanism
// --------------------------
boolean contentAvailable;
try {
contentAvailable = input.available() > 0;
} catch (IOException ex) {
contentAvailable = false;
}
// --------------------------
boolean repeatableRequired = shouldUseRepeatableHttpBodyEntry(client);
if (!contentAvailable || !repeatableRequired) {
if (!shouldUseRepeatableHttpBodyEntry(client)) {
entity = new InputStreamEntity(input, -1);
} else {
byte[] bytes = new byte[0];
try {
bytes = IOUtils.toByteArray(input);
IOUtils.closeQuietly(input);
} catch (IOException e) {
LOG.error("While reading input for not chunked encoding", e);
}

View File

@ -53,11 +53,23 @@ public class EdmBinary extends SingletonPrimitiveType {
}
private static boolean validateMaxLength(final String value, final Integer maxLength) {
return maxLength == null ? true
: // Every three bytes are represented as four base-64 characters.
// Additionally, there could be up to two padding "=" characters
// if the number of bytes is not a multiple of three.
maxLength >= value.length() * 3 / 4 - (value.endsWith("==") ? 2 : value.endsWith("=") ? 1 : 0);
return maxLength == null ? true :
// Every three bytes are represented as four base-64 characters.
// Additionally, there could be up to two padding "=" characters
// if the number of bytes is not a multiple of three,
// and there could be line feeds, possibly with carriage returns.
maxLength >= (value.length() - lineEndingsLength(value)) * 3 / 4
- (value.endsWith("==") ? 2 : value.endsWith("=") ? 1 : 0);
}
private static int lineEndingsLength(final String value) {
int result = 0;
int index = 0;
while ((index = value.indexOf('\n', index)) >= 0) {
result += index > 0 && value.charAt(index - 1) == '\r' ? 2 : 1;
index++;
}
return result;
}
@Override

View File

@ -97,6 +97,8 @@ public class EdmBinaryTest extends PrimitiveTypeBaseTest {
byte[].class)));
assertTrue(Arrays.equals(binary, instance.valueOfString("qrvM3e7_", null, Integer.MAX_VALUE, null, null, null,
byte[].class)));
assertTrue(Arrays.equals(binary, instance.valueOfString("\nqrvM\n3e7_\r\n", null, 6, null, null, null,
byte[].class)));
expectFacetsErrorInValueOfString(instance, "qrvM3e7_", null, 3, null, null, null);
expectContentErrorInValueOfString(instance, "@");