use of jakarta.activation.DataSource in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method clientDataSourceReaderTest.
/*
* @testName: clientDataSourceReaderTest
*
* @assertion_ids: JAXRS:SPEC:70;
*
* @test_Strategy: See Section 4.2.4 for a list of entity providers that MUST
* be supported by all JAX-RS implementations
*/
@Test
public void clientDataSourceReaderTest() throws Fault {
standardReaderInvocation(MediaType.WILDCARD_TYPE);
DataSource responseEntity = getResponse().readEntity(DataSource.class);
assertTrue(responseEntity != null, "Returned Entity is null!");
InputStreamReader reader;
try {
reader = new InputStreamReader(responseEntity.getInputStream());
} catch (IOException e) {
throw new Fault(e);
}
readerTest(reader);
}
use of jakarta.activation.DataSource in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method clientDataSourceProviderTest.
/*
* @testName: clientDataSourceProviderTest
*
* @assertion_ids: JAXRS:JAVADOC:863;
*
* @test_Strategy: DataSource All media types.
*
* for a zero-length response entities returns null or a corresponding Java
* object that represents zero-length data.
*/
@Test
@Tag("xml_binding")
public void clientDataSourceProviderTest() throws Fault {
setProperty(Property.REQUEST, buildRequest(Request.GET, "entity"));
invoke();
DataSource entity = getResponseBody(DataSource.class);
String content = null;
if (entity != null)
try {
content = JaxrsUtil.readFromStream(entity.getInputStream());
} catch (Exception e) {
throw new Fault(e);
}
assertTrue(content == null || content.length() == 0, "DataSource reader gets unexpected" + content);
}
use of jakarta.activation.DataSource in project spring-framework by spring-projects.
the class StandardClasses method standardClassDataHandler.
public JAXBElement<DataHandler> standardClassDataHandler() {
DataSource dataSource = new URLDataSource(getClass().getResource("spring-ws.png"));
DataHandler dataHandler = new DataHandler(dataSource);
return new JAXBElement<>(NAME, DataHandler.class, dataHandler);
}
use of jakarta.activation.DataSource in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method clientDataSourceWriterTest.
/*
* @testName: clientDataSourceWriterTest
*
* @assertion_ids: JAXRS:SPEC:70;
*
* @test_Strategy: See Section 4.2.4 for a list of entity providers that MUST
* be supported by all JAX-RS implementations
*/
@Test
public void clientDataSourceWriterTest() throws Fault {
DataSource ds = new StringDataSource(entity, MediaType.WILDCARD_TYPE);
standardWriterInvocation(ds);
}
Aggregations