Search in sources :

Example 26 with CommandResult

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

the class SetHealthCheckServiceConfigurationTest method stuckThreadsThresholdUnitAffectsConfigButNotService.

@Test
public void stuckThreadsThresholdUnitAffectsConfigButNotService() {
    CommandResult result = asadmin("set-healthcheck-service-configuration", "--service", "st", "--enabled", "true", "--stuck-threads-threshold-unit", TimeUnit.DAYS.name());
    assertSuccess(result);
    StuckThreadsChecker stConfig = config.getCheckerByType(stuckThreads.getCheckerType());
    assertEquals(TimeUnit.DAYS.name(), stConfig.getThresholdTimeUnit());
    StuckThreadsHealthCheck activeService = (StuckThreadsHealthCheck) service.getCheck(stConfig.getName());
    if (activeService != null) {
        assertNotEquals(TimeUnit.DAYS, activeService.getOptions().getUnitStuck());
    }
}
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)

Example 27 with CommandResult

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

the class SetHealthCheckServiceConfigurationTest method stuckThreadsThresholdUnitDynamicAffectsConfigButNotService.

@Test
public void stuckThreadsThresholdUnitDynamicAffectsConfigButNotService() {
    ensureHealthChecksAreEnabled();
    CommandResult result = asadmin("set-healthcheck-service-configuration", "--service", "st", "--enabled", "true", "--stuck-threads-threshold-unit", TimeUnit.HOURS.name(), "--dynamic", "true");
    assertSuccess(result);
    StuckThreadsChecker stConfig = config.getCheckerByType(stuckThreads.getCheckerType());
    assertEquals(TimeUnit.HOURS.name(), stConfig.getThresholdTimeUnit());
    StuckThreadsHealthCheck activeService = (StuckThreadsHealthCheck) service.getCheck(stConfig.getName());
    assertEquals(TimeUnit.HOURS, activeService.getOptions().getUnitStuck());
}
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)

Example 28 with CommandResult

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

the class SetHealthCheckServiceConfigurationTest method enabledAffectsConfigButNotService.

@Test
public void enabledAffectsConfigButNotService() {
    CommandResult result = asadmin("set-healthcheck-service-configuration", "--service", "gc", "--enabled", "true");
    assertSuccess(result);
    Checker gcConfig = config.getCheckerByType(garbageCollection.getCheckerType());
    assertTrue(gcConfig.getEnabled());
    result = asadmin("set-healthcheck-service-configuration", "--service", "gc", "--enabled", "false");
    assertFalse(gcConfig.getEnabled());
}
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 29 with CommandResult

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

the class SetHealthCheckServiceConfigurationTest method thresholdWarningAffectsConfigButNotService.

@Test
public void thresholdWarningAffectsConfigButNotService() {
    CommandResult result = asadmin("set-healthcheck-service-configuration", "--service", "gc", "--enabled", "true", "--threshold-warning", "99");
    assertSuccess(result);
    GarbageCollectorChecker gcConfig = config.getCheckerByType(garbageCollection.getCheckerType());
    assertEquals(99, Integer.parseInt(gcConfig.getProperty(HealthCheckConstants.THRESHOLD_WARNING).getValue()));
    GarbageCollectorHealthCheck activeService = (GarbageCollectorHealthCheck) service.getCheck(gcConfig.getName());
    assertNotEquals(99, activeService.getOptions().getThresholdWarning());
}
Also used : GarbageCollectorHealthCheck(fish.payara.nucleus.healthcheck.preliminary.GarbageCollectorHealthCheck) GarbageCollectorChecker(fish.payara.nucleus.healthcheck.configuration.GarbageCollectorChecker) CommandResult(org.glassfish.embeddable.CommandResult) Test(org.junit.Test)

Example 30 with CommandResult

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

the class SetHealthCheckServiceConfigurationTest method thresholdWarningAboveMaximumCausesError.

@Test
public void thresholdWarningAboveMaximumCausesError() {
    CommandResult result = asadmin("set-healthcheck-service-configuration", "--service", "gc", "--enabled", "true", "--threshold-warning", "101");
    assertUnacceptableParameter("thresholdWarning", result);
    assertContains("Wanring threshold is a percentage so must be less than 100", result.getOutput());
}
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