Search in sources :

Example 56 with IgnoredException

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();
    });
}
Also used : IgnoredException(org.apache.geode.test.dunit.IgnoredException)

Example 57 with IgnoredException

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();
    }
}
Also used : Random(java.util.Random) QueryInvalidException(org.apache.geode.cache.query.QueryInvalidException) IgnoredException(org.apache.geode.test.dunit.IgnoredException) CommandResult(org.apache.geode.management.internal.cli.result.CommandResult)

Example 58 with IgnoredException

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();
    }
}
Also used : IgnoredException(org.apache.geode.test.dunit.IgnoredException) CacheCreation(org.apache.geode.internal.cache.xmlcache.CacheCreation) ClientCacheCreation(org.apache.geode.internal.cache.xmlcache.ClientCacheCreation) SerializerCreation(org.apache.geode.internal.cache.xmlcache.SerializerCreation) IOException(java.io.IOException) UnknownHostException(java.net.UnknownHostException) CacheException(org.apache.geode.cache.CacheException) RegionExistsException(org.apache.geode.cache.RegionExistsException) CacheXmlException(org.apache.geode.cache.CacheXmlException) SAXException(org.xml.sax.SAXException) IgnoredException(org.apache.geode.test.dunit.IgnoredException) CacheLoaderException(org.apache.geode.cache.CacheLoaderException) Test(org.junit.Test)

Example 59 with IgnoredException

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();
    }
}
Also used : CacheXmlException(org.apache.geode.cache.CacheXmlException) IgnoredException(org.apache.geode.test.dunit.IgnoredException) Test(org.junit.Test)

Example 60 with IgnoredException

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();
    }
}
Also used : IgnoredException(org.apache.geode.test.dunit.IgnoredException) CacheCreation(org.apache.geode.internal.cache.xmlcache.CacheCreation) ClientCacheCreation(org.apache.geode.internal.cache.xmlcache.ClientCacheCreation) PoolFactoryImpl(org.apache.geode.internal.cache.PoolFactoryImpl) Test(org.junit.Test)

Aggregations

IgnoredException (org.apache.geode.test.dunit.IgnoredException)142 Test (org.junit.Test)89 DistributedTest (org.apache.geode.test.junit.categories.DistributedTest)71 Region (org.apache.geode.cache.Region)46 FlakyTest (org.apache.geode.test.junit.categories.FlakyTest)46 VM (org.apache.geode.test.dunit.VM)43 Host (org.apache.geode.test.dunit.Host)38 PartitionedRegion (org.apache.geode.internal.cache.PartitionedRegion)34 AttributesFactory (org.apache.geode.cache.AttributesFactory)30 ForceReattemptException (org.apache.geode.internal.cache.ForceReattemptException)28 PartitionAttributesFactory (org.apache.geode.cache.PartitionAttributesFactory)23 IOException (java.io.IOException)21 CacheClosedException (org.apache.geode.cache.CacheClosedException)21 LocalRegion (org.apache.geode.internal.cache.LocalRegion)20 PartitionOfflineException (org.apache.geode.cache.persistence.PartitionOfflineException)16 RMIException (org.apache.geode.test.dunit.RMIException)15 GatewaySender (org.apache.geode.cache.wan.GatewaySender)14 BucketRegion (org.apache.geode.internal.cache.BucketRegion)14 SerializableRunnable (org.apache.geode.test.dunit.SerializableRunnable)14 CacheXmlException (org.apache.geode.cache.CacheXmlException)12