Search in sources :

Example 21 with CommandResult

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

the class SetHealthCheckServiceConfigurationTest method enabledDynamicAffectsConfigAndService.

@Test
public void enabledDynamicAffectsConfigAndService() {
    ensureHealthChecksAreEnabled();
    CommandResult result = asadmin("set-healthcheck-service-configuration", "--service", "gc", "--enabled", "true", "--dynamic", "true");
    assertSuccess(result);
    Checker gcConfig = config.getCheckerByType(garbageCollection.getCheckerType());
    BaseHealthCheck<?, ?> check = service.getCheck(gcConfig.getName());
    assertNotNull(check);
    assertTrue(check.getOptions().isEnabled());
    result = asadmin("set-healthcheck-service-configuration", "--service", "gc", "--enabled", "false", "--dynamic", "true");
    assertFalse(check.getOptions().isEnabled());
}
Also used : HoggingThreadsChecker(fish.payara.nucleus.healthcheck.configuration.HoggingThreadsChecker) StuckThreadsChecker(fish.payara.nucleus.healthcheck.configuration.StuckThreadsChecker) Checker(fish.payara.nucleus.healthcheck.configuration.Checker) GarbageCollectorChecker(fish.payara.nucleus.healthcheck.configuration.GarbageCollectorChecker) CommandResult(org.glassfish.embeddable.CommandResult) Test(org.junit.Test)

Example 22 with CommandResult

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

the class SetHealthCheckServiceConfigurationTest method timeUnitUnknownNameCausesError.

@Test
public void timeUnitUnknownNameCausesError() {
    CommandResult result = asadmin("set-healthcheck-service-configuration", "--service", "gc", "--enabled", "true", "--time-unit", "YEARS");
    assertUnacceptableParameter("time-unit", result);
    assertContains("DAYS,HOURS,MICROSECONDS,MILLISECONDS,MINUTES,NANOSECONDS,SECONDS", result.getOutput());
}
Also used : CommandResult(org.glassfish.embeddable.CommandResult) Test(org.junit.Test)

Example 23 with CommandResult

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

the class SetHealthCheckServiceConfigurationTest method hogginThreadsRetryCountAffectsConfigButNotService.

@Test
public void hogginThreadsRetryCountAffectsConfigButNotService() {
    CommandResult result = asadmin("set-healthcheck-service-configuration", "--service", "ht", "--enabled", "true", "--hogging-threads-retry-count", "13");
    assertSuccess(result);
    HoggingThreadsChecker htConfig = config.getCheckerByType(hoggingThreads.getCheckerType());
    assertEquals(13, Integer.parseInt(htConfig.getRetryCount()));
    HoggingThreadsHealthCheck checkTask = (HoggingThreadsHealthCheck) service.getCheck(htConfig.getName());
    assertNotEquals(13, 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 24 with CommandResult

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

the class SetHealthCheckServiceConfigurationTest method timeUnitAffectsConfigButNotService.

@Test
public void timeUnitAffectsConfigButNotService() {
    CommandResult result = asadmin("set-healthcheck-service-configuration", "--service", "gc", "--enabled", "true", "--time-unit", TimeUnit.DAYS.name());
    assertSuccess(result);
    Checker gcConfig = config.getCheckerByType(garbageCollection.getCheckerType());
    assertEquals(TimeUnit.DAYS.name(), gcConfig.getUnit());
    assertNotEquals(TimeUnit.DAYS, service.getCheck(gcConfig.getName()).getOptions().getUnit());
}
Also used : HoggingThreadsChecker(fish.payara.nucleus.healthcheck.configuration.HoggingThreadsChecker) StuckThreadsChecker(fish.payara.nucleus.healthcheck.configuration.StuckThreadsChecker) Checker(fish.payara.nucleus.healthcheck.configuration.Checker) GarbageCollectorChecker(fish.payara.nucleus.healthcheck.configuration.GarbageCollectorChecker) CommandResult(org.glassfish.embeddable.CommandResult) Test(org.junit.Test)

Example 25 with CommandResult

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

the class SetHealthCheckServiceConfigurationTest method stuckThreadsThresholdUnitUnknownValueCausesError.

@Test
public void stuckThreadsThresholdUnitUnknownValueCausesError() {
    CommandResult result = asadmin("set-healthcheck-service-configuration", "--service", "st", "--enabled", "true", "--stuck-threads-threshold-unit", "YEARS");
    assertUnacceptableParameter("stuck-threads-threshold-unit", result);
}
Also used : 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