use of org.apache.geode.test.dunit.IgnoredException in project geode by apache.
the class DistributedSystemDUnitTest method generateSevereAlert.
private void generateSevereAlert(final VM anyVM) {
anyVM.invoke("generateSevereAlert", () -> {
IgnoredException ignoredException = addIgnoredException(SEVERE_LEVEL_MESSAGE);
logger.fatal(SEVERE_LEVEL_MESSAGE);
ignoredException.remove();
});
}
use of org.apache.geode.test.dunit.IgnoredException in project geode by apache.
the class GemfireDataCommandsDUnitTest method doTestSelectWithGfshEnvVariables.
public void doTestSelectWithGfshEnvVariables(boolean statusActive) {
Random random = new Random(System.nanoTime());
int randomInteger = random.nextInt(COUNT);
String query = "query --query=\"select ID , status , createTime , pk, floatMinValue from ${DATA_REGION} where ID <= ${PORTFOLIO_ID}" + " and status='${STATUS}'" + "\" --interactive=false";
executeCommand("set variable --name=DATA_REGION --value=" + DATA_REGION_NAME_PATH);
executeCommand("set variable --name=PORTFOLIO_ID --value=" + randomInteger);
executeCommand("set variable --name=STATUS --value=" + (statusActive ? "active" : "inactive"));
CommandResult cmdResult = executeCommand(query);
printCommandOutput(cmdResult);
validateSelectResult(cmdResult, true, -1, null);
IgnoredException ex = addIgnoredException(QueryInvalidException.class.getSimpleName(), Host.getHost(0).getVM(0));
try {
query = "query --query=\"select ID , status , createTime , pk, floatMinValue from ${DATA_REGION2} where ID <= ${PORTFOLIO_ID2}" + " and status='${STATUS2}'" + "\" --interactive=false";
cmdResult = executeCommand(query);
printCommandOutput(cmdResult);
validateSelectResult(cmdResult, false, 0, null);
} finally {
ex.remove();
}
}
use of org.apache.geode.test.dunit.IgnoredException in project geode by apache.
the class CacheXml66DUnitTest method testSerializationRegistration.
@Test
public void testSerializationRegistration() throws Exception {
CacheCreation cc = new CacheCreation();
SerializerCreation sc = new SerializerCreation();
cc.setSerializerCreation(sc);
sc.registerInstantiator(DS1.class, 15);
sc.registerInstantiator(DS2.class, 16);
sc.registerSerializer(GoodSerializer.class);
testXml(cc);
// Now make sure all of the classes were registered....
assertEquals(15, InternalInstantiator.getClassId(DS1.class));
assertEquals(16, InternalInstantiator.getClassId(DS2.class));
assertEquals(GoodSerializer.class, InternalDataSerializer.getSerializer(101).getClass());
sc = new SerializerCreation();
sc.registerInstantiator(NotDataSerializable.class, 15);
closeCache();
cc.setSerializerCreation(sc);
IgnoredException expectedException = IgnoredException.addIgnoredException("While reading Cache XML file");
try {
testXml(cc);
fail("Instantiator should not have registered due to bad class.");
} catch (Exception e) {
} finally {
expectedException.remove();
}
sc = new SerializerCreation();
sc.registerSerializer(BadSerializer.class);
closeCache();
cc.setSerializerCreation(sc);
IgnoredException expectedException1 = IgnoredException.addIgnoredException("While reading Cache XML file");
try {
testXml(cc);
fail("Serializer should not have registered due to bad class.");
} catch (Exception e) {
} finally {
expectedException1.remove();
}
}
use of org.apache.geode.test.dunit.IgnoredException in project geode by apache.
the class CacheXml66DUnitTest method testBadInt.
/**
* Tests parsing an XML file with a bad integer
*/
@Test
public void testBadInt() throws Exception {
setXmlFile(findFile("badInt.xml"));
IgnoredException expectedException = IgnoredException.addIgnoredException("While reading Cache XML file");
try {
getCache();
fail("Should have thrown a CacheXmlException");
} catch (CacheXmlException ex) {
Throwable cause = ex.getCause();
assertNotNull("Expected a cause", cause);
assertTrue("Didn't expect cause:" + cause + " (a " + cause.getClass().getName() + ")", cause instanceof NumberFormatException);
} finally {
expectedException.remove();
}
}
use of org.apache.geode.test.dunit.IgnoredException in project geode by apache.
the class CacheXml66DUnitTest method testAlreadyExistingPool.
@Test
public void testAlreadyExistingPool() throws Exception {
getSystem();
PoolFactoryImpl f = (PoolFactoryImpl) PoolManager.createFactory();
f.setStartDisabled(true).addLocator(ALIAS2, 12345).create("mypool");
try {
// now make sure declarative cache can't create the same pool
CacheCreation cache = new CacheCreation();
cache.createPoolFactory().addLocator(ALIAS2, 12345).create("mypool");
IgnoredException expectedException = IgnoredException.addIgnoredException(LocalizedStrings.PoolManagerImpl_POOL_NAMED_0_ALREADY_EXISTS.toLocalizedString("mypool"));
try {
testXml(cache);
fail("expected IllegalStateException");
} catch (IllegalStateException expected) {
} finally {
expectedException.remove();
}
} finally {
PoolManager.close();
}
}
Aggregations