use of ee.jakarta.tck.ws.rs.api.rs.core.configurable.SingleCheckAssertable in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method getInstancesIsImmutableTest.
/*
* @testName: getInstancesIsImmutableTest
*
* @assertion_ids: JAXRS:JAVADOC:994; JAXRS:JAVADOC:758;
*
* @test_Strategy: Get the immutable set of registered provider instances to be
* utilized by the configurable instance.
*
* Register a provider ("singleton") instance
*/
@Test
public void getInstancesIsImmutableTest() throws Fault {
Assertable assertable = new SingleCheckAssertable() {
@Override
protected void check(Configurable<?> configurable) throws Fault {
registerNewProviderInstance(configurable.getConfiguration());
assertSizeAndLog(configurable.getConfiguration(), 0);
}
void assertSizeAndLog(Configuration config, int count) throws Fault {
assertTrue(config.getClasses().size() == count + registeredClassesCnt, "config.getClasses() return unexcepted size " + getLocation() + " : " + config.getClasses().size());
logMsg("Found", config.getClasses().size(), "providers");
}
void registerNewProviderInstance(Configuration config) {
try {
config.getInstances().add(new CallableProvider());
} catch (Exception e) {
// can throw exception or do nothing
// when adding to this immutable set
// or it can be a new hard copied set
}
}
};
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 getContractsIsNeverNullTest.
/*
* @testName: getContractsIsNeverNullTest
*
* @assertion_ids: JAXRS:JAVADOC:993;
*
* @test_Strategy: Get the extension contract registration information for a
* component of a given class. Method does not return null.
*/
@Test
public void getContractsIsNeverNullTest() throws Fault {
Assertable assertable = new SingleCheckAssertable() {
void assertNotNullAndLog(Configurable<?> config) throws Fault {
Map<Class<?>, Integer> map = config.getConfiguration().getContracts(MessageBodyReader.class);
assertNotNull(map, "getContracts is null", getLocation());
logMsg("#getContracts() 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 getPropertyIsNullTest.
/*
* @testName: getPropertyIsNullTest
*
* @assertion_ids: JAXRS:JAVADOC:996; JAXRS:JAVADOC:758;
*
* @test_Strategy: null if the property with such name is not configured.
*/
@Test
public void getPropertyIsNullTest() throws Fault {
Assertable assertable = new SingleCheckAssertable() {
void assertPropertyIsNull(Configurable<?> config) throws Fault {
assertTrue(config.getConfiguration().getProperty("property88") == null, "#getProperty('nonexisting') != null " + getLocation());
logMsg("#getProperty('nonexisting') is null as expected");
}
@Override
protected void check(Configurable<?> configurable) throws Fault {
assertPropertyIsNull(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 getAssertableWithRegisteredProviderClassesOnConfigurable.
// ///////////////////////////////////////////////////////////////////////
private Assertable getAssertableWithRegisteredProviderClassesOnConfigurable(final int configurableIndex, final int numberOfRegisteredClasses) {
Assertable assertable = new SingleCheckAssertable() {
@Override
protected void check(Configurable<?> configurable) throws Fault {
assertSizeAndLog(configurable);
}
void assertSizeAndLog(Configurable<?> config) throws Fault {
int size = config.getConfiguration().getClasses().size();
int shouldBe = getLocationIndex() >= configurableIndex ? numberOfRegisteredClasses : 0;
shouldBe += registeredClassesCnt;
assertEqualsInt(size, shouldBe, "unexpected number of registered classes found:", size, getLocation());
logMsg("Found", size, "provider(s) as expected");
}
};
return assertable;
}
Aggregations