Search in sources :

Example 66 with CommandResult

use of org.glassfish.embeddable.CommandResult in project Payara by payara.

the class SetHealthCheckConfigurationTest method historicalTraceStoreSizeBelowMinimumCausesError.

@Test
public void historicalTraceStoreSizeBelowMinimumCausesError() {
    CommandResult result = asadmin("set-healthcheck-configuration", "--enabled", "true", "--historical-trace-store-size", "0");
    assertUnacceptableParameter("historicalTraceStoreSize", result);
    assertTrue(result.getOutput().contains("Store size must be greater than 0"));
}
Also used : CommandResult(org.glassfish.embeddable.CommandResult) Test(org.junit.Test)

Example 67 with CommandResult

use of org.glassfish.embeddable.CommandResult in project Payara by payara.

the class SetHealthCheckConfigurationTest method historicalTraceStoreTimeoutDynamicAffectsConfigAndService.

@Test
public void historicalTraceStoreTimeoutDynamicAffectsConfigAndService() {
    CommandResult result = asadmin("set-healthcheck-configuration", "--enabled", "true", "--historical-trace-store-timeout", "42", "--dynamic", "true");
    assertSuccess(result);
    assertEquals(42, Integer.parseInt(config.getHistoricalTraceStoreTimeout()));
    assertEquals(42, getHistoricalTraceStoreTimeout().longValue());
}
Also used : CommandResult(org.glassfish.embeddable.CommandResult) Test(org.junit.Test)

Example 68 with CommandResult

use of org.glassfish.embeddable.CommandResult in project Payara by payara.

the class SetHealthCheckConfigurationTest method enabledAffectsConfigButNotService.

@Test
public void enabledAffectsConfigButNotService() {
    boolean enabled = service.isEnabled();
    asadmin("set-healthcheck-configuration", "--enabled", "false");
    assertFalse(config.getEnabled());
    CommandResult result = asadmin("set-healthcheck-configuration", "--enabled", "true");
    assertSuccess(result);
    assertTrue(config.getEnabled());
    assertUnchanged(enabled, service.isEnabled());
    result = asadmin("set-healthcheck-configuration", "--enabled", "false");
    assertSuccess(result);
    assertFalse(config.getEnabled());
    assertUnchanged(enabled, service.isEnabled());
}
Also used : CommandResult(org.glassfish.embeddable.CommandResult) Test(org.junit.Test)

Example 69 with CommandResult

use of org.glassfish.embeddable.CommandResult in project Payara by payara.

the class SetHealthCheckServiceConfigurationTest method hogginThreadsRetryCountDynamicAffectsConfigAndService.

@Test
public void hogginThreadsRetryCountDynamicAffectsConfigAndService() {
    ensureHealthChecksAreEnabled();
    CommandResult result = asadmin("set-healthcheck-service-configuration", "--service", "ht", "--enabled", "true", "--hogging-threads-retry-count", "24", "--dynamic", "true");
    assertSuccess(result);
    HoggingThreadsChecker htConfig = config.getCheckerByType(hoggingThreads.getCheckerType());
    assertEquals(24, Integer.parseInt(htConfig.getRetryCount()));
    HoggingThreadsHealthCheck checkTask = (HoggingThreadsHealthCheck) service.getCheck(htConfig.getName());
    assertEquals(24, checkTask.getOptions().getRetryCount());
}
Also used : HoggingThreadsChecker(fish.payara.nucleus.healthcheck.configuration.HoggingThreadsChecker) HoggingThreadsHealthCheck(fish.payara.nucleus.healthcheck.preliminary.HoggingThreadsHealthCheck) CommandResult(org.glassfish.embeddable.CommandResult) Test(org.junit.Test)

Example 70 with CommandResult

use of org.glassfish.embeddable.CommandResult in project Payara by payara.

the class SetHealthCheckServiceConfigurationTest method stuckThreadsThresholdAffectsConfigButNotError.

@Test
public void stuckThreadsThresholdAffectsConfigButNotError() {
    CommandResult result = asadmin("set-healthcheck-service-configuration", "--service", "st", "--enabled", "true", "--stuck-threads-threshold", "13");
    assertSuccess(result);
    StuckThreadsChecker stConfig = config.getCheckerByType(stuckThreads.getCheckerType());
    assertEquals(13, Integer.parseInt(stConfig.getThreshold()));
    StuckThreadsHealthCheck activeService = (StuckThreadsHealthCheck) service.getCheck(stConfig.getName());
    if (activeService != null) {
        assertNotEquals(Long.valueOf(13), activeService.getOptions().getTimeStuck());
    }
}
Also used : StuckThreadsChecker(fish.payara.nucleus.healthcheck.configuration.StuckThreadsChecker) StuckThreadsHealthCheck(fish.payara.nucleus.healthcheck.stuck.StuckThreadsHealthCheck) CommandResult(org.glassfish.embeddable.CommandResult) Test(org.junit.Test)

Aggregations

CommandResult (org.glassfish.embeddable.CommandResult)85 Test (org.junit.Test)72 CommandRunner (org.glassfish.embeddable.CommandRunner)26 File (java.io.File)21 Deployer (org.glassfish.embeddable.Deployer)21 GlassFish (org.glassfish.embeddable.GlassFish)17 GlassFishProperties (org.glassfish.embeddable.GlassFishProperties)17 PrintStream (java.io.PrintStream)16 GarbageCollectorChecker (fish.payara.nucleus.healthcheck.configuration.GarbageCollectorChecker)12 HoggingThreadsChecker (fish.payara.nucleus.healthcheck.configuration.HoggingThreadsChecker)10 StuckThreadsChecker (fish.payara.nucleus.healthcheck.configuration.StuckThreadsChecker)10 JarFile (java.util.jar.JarFile)9 Checker (fish.payara.nucleus.healthcheck.configuration.Checker)6 GarbageCollectorHealthCheck (fish.payara.nucleus.healthcheck.preliminary.GarbageCollectorHealthCheck)6 HoggingThreadsHealthCheck (fish.payara.nucleus.healthcheck.preliminary.HoggingThreadsHealthCheck)4 StuckThreadsHealthCheck (fish.payara.nucleus.healthcheck.stuck.StuckThreadsHealthCheck)4 IOException (java.io.IOException)4 ArrayList (java.util.ArrayList)2 ServiceLocator (org.glassfish.hk2.api.ServiceLocator)2 ExecException (com.sun.enterprise.util.ExecException)1