use of ee.jakarta.tck.ws.rs.api.rs.core.configurable.SingleCheckAssertable in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method getRuntimeTypeTest.
/*
* @testName: getRuntimeTypeTest
*
* @assertion_ids: JAXRS:JAVADOC:998;
*
* @test_Strategy: Get the runtime type of this configuration context.
*/
@Test
public void getRuntimeTypeTest() throws Fault {
Assertable assertable = new SingleCheckAssertable() {
void assertNotNullAndLog(Configurable<?> config) throws Fault {
assertEquals(RuntimeType.CLIENT, config.getConfiguration().getRuntimeType(), "getRuntimeType() is unexpected", config.getConfiguration().getRuntimeType(), getLocation());
logMsg("#getRuntimeType() is", RuntimeType.CLIENT, "as expected", getLocation());
}
@Override
protected void check(Configurable<?> configurable) throws Fault {
assertNotNullAndLog(configurable);
}
};
checkConfigWithProperties(assertable);
}
use of ee.jakarta.tck.ws.rs.api.rs.core.configurable.SingleCheckAssertable in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method getContractsTest.
/*
* @testName: getContractsTest
*
* @assertion_ids: JAXRS:JAVADOC:993;
*
* @test_Strategy: Get the extension contract registration information for a
* component of a given class.
*/
@Test
public void getContractsTest() throws Fault {
final int priority = 124;
Assertable assertable = new SingleCheckAssertable() {
void assertNotNullAndLog(Configurable<?> config) throws Fault {
Map<Class<?>, Integer> map = config.getConfiguration().getContracts(CallableProvider.class);
assertEqualsInt(1, map.size(), "Unexpected contract size", map.size());
Class<?> contract = map.entrySet().iterator().next().getKey();
assertEquals(MessageBodyReader.class, contract, "Unexpected contract", contract, getLocation());
logMsg("#getContracts() is", contract, "as expected", getLocation());
int p = map.get(contract);
assertEqualsInt(priority, p, "Unexpected priority", p);
logMsg("Found expected priority", p);
}
@Override
protected void check(Configurable<?> configurable) throws Fault {
assertNotNullAndLog(configurable);
}
};
Registrar registrar = new Registrar() {
@Override
public void register(Configurable<?> config, Object registerable) {
Map<Class<?>, Integer> map = new HashMap<Class<?>, Integer>();
map.put(MessageBodyReader.class, priority);
config.register(CallableProvider.class, map);
}
};
checkConfigWithProperties(registrar, assertable);
}
use of ee.jakarta.tck.ws.rs.api.rs.core.configurable.SingleCheckAssertable in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method getInstancesIsNeverNullTest.
/*
* @testName: getInstancesIsNeverNullTest
*
* @assertion_ids: JAXRS:JAVADOC:994; JAXRS:JAVADOC:758;
*
* @test_Strategy: The returned value shall never be null.
*
* Register a provider ("singleton") instance
*/
@Test
public void getInstancesIsNeverNullTest() throws Fault {
Assertable assertable = new SingleCheckAssertable() {
void assertNotNullAndLog(Configurable<?> config) throws Fault {
assertNotNull(config.getConfiguration().getInstances(), "config.getInstances() shall never be null", getLocation());
logMsg("#getInstances() is not null as expected", getLocation());
}
@Override
protected void check(Configurable<?> configurable) throws Fault {
assertNotNullAndLog(configurable);
}
};
checkConfigWithProperties(assertable);
}
use of ee.jakarta.tck.ws.rs.api.rs.core.configurable.SingleCheckAssertable in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method getAssertableWithRegisteredProviderInstancesOnConfigurable.
private Assertable getAssertableWithRegisteredProviderInstancesOnConfigurable(final int configurableIndex, final int numberOfRegisteredInstances) {
Assertable assertable = new SingleCheckAssertable() {
@Override
protected void check(Configurable<?> configurable) throws Fault {
assertSizeAndLog(configurable);
}
void assertSizeAndLog(Configurable<?> config) throws Fault {
int size = config.getConfiguration().getInstances().size();
int shouldBe = getLocationIndex() >= configurableIndex ? numberOfRegisteredInstances : 0;
shouldBe += registeredInstancesCnt;
assertEqualsInt(size, shouldBe, "unexpected number of registered classes found:", size, getLocation());
logMsg("Found", size, "provider(s) as expected");
}
};
return assertable;
}
use of ee.jakarta.tck.ws.rs.api.rs.core.configurable.SingleCheckAssertable in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method getClassesIsNeverNullTest.
/*
* @testName: getClassesIsNeverNullTest
*
* @assertion_ids: JAXRS:JAVADOC:992; JAXRS:JAVADOC:758;
*
* @test_Strategy: The returned value shall never be null.
*
* Register a provider ("singleton") instance
*/
@Test
public void getClassesIsNeverNullTest() throws Fault {
Assertable assertable = new SingleCheckAssertable() {
@Override
protected void check(Configurable<?> configurable) throws Fault {
assertNotNullAndLog(configurable);
}
void assertNotNullAndLog(Configurable<?> config) throws Fault {
assertNotNull(config.getConfiguration().getClasses(), "#getClasses shall never be null", getLocation());
logMsg("#getClasses() is not null as expected", getLocation());
}
};
checkConfigWithProperties(assertable);
}
Aggregations