Search in sources :

Example 1 with GfManagerAgentConfig

use of org.apache.geode.internal.admin.GfManagerAgentConfig in project geode by apache.

the class ConsoleDistributionManagerDUnitTest method postSetUp.

@Override
public final void postSetUp() throws Exception {
    boolean finishedSetup = false;
    IgnoredException.addIgnoredException("Error occurred while reading system log");
    try {
        if (firstTime) {
            // make sure there's no ldm lying around
            disconnectFromDS();
            try {
                Thread.sleep(5 * 1000);
            } catch (InterruptedException ie) {
                fail("interrupted");
            }
            firstTime = false;
        }
        DistributionManager.isDedicatedAdminVM = true;
        populateCache();
        RemoteTransportConfig transport = null;
        {
            boolean created = !isConnectedToDS();
            InternalDistributedSystem ds = getSystem();
            transport = new RemoteTransportConfig(ds.getConfig(), DistributionManager.ADMIN_ONLY_DM_TYPE);
            if (created) {
                disconnectFromDS();
            }
        }
        // create a GfManagerAgent in the master vm.
        this.agent = GfManagerAgentFactory.getManagerAgent(new GfManagerAgentConfig(null, transport, LogWriterUtils.getLogWriter(), Alert.SEVERE, this, null));
        if (!agent.isConnected()) {
            WaitCriterion ev = new WaitCriterion() {

                public boolean done() {
                    return agent.isConnected();
                }

                public String description() {
                    return null;
                }
            };
            Wait.waitForCriterion(ev, 60 * 1000, 200, true);
        }
        finishedSetup = true;
    } finally {
        if (!finishedSetup) {
            try {
                this.agent.disconnect();
            } catch (VirtualMachineError e) {
                SystemFailure.initiateFailure(e);
                throw e;
            } catch (Throwable ignore) {
            }
            try {
                super.preTearDown();
            } catch (VirtualMachineError e) {
                SystemFailure.initiateFailure(e);
                throw e;
            } catch (Throwable ignore) {
            }
            try {
                disconnectFromDS();
            } catch (VirtualMachineError e) {
                SystemFailure.initiateFailure(e);
                throw e;
            } catch (Throwable ignore) {
            }
            DistributionManager.isDedicatedAdminVM = false;
        }
    }
}
Also used : WaitCriterion(org.apache.geode.test.dunit.WaitCriterion) GfManagerAgentConfig(org.apache.geode.internal.admin.GfManagerAgentConfig) RemoteTransportConfig(org.apache.geode.internal.admin.remote.RemoteTransportConfig)

Aggregations

GfManagerAgentConfig (org.apache.geode.internal.admin.GfManagerAgentConfig)1 RemoteTransportConfig (org.apache.geode.internal.admin.remote.RemoteTransportConfig)1 WaitCriterion (org.apache.geode.test.dunit.WaitCriterion)1