Search in sources :

Example 36 with CommandResult

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

the class SetHealthCheckServiceConfigurationTest method stuckThreadsThresholdDynamicAffectsConfigAndService.

@Test
public void stuckThreadsThresholdDynamicAffectsConfigAndService() {
    ensureHealthChecksAreEnabled();
    CommandResult result = asadmin("set-healthcheck-service-configuration", "--service", "st", "--enabled", "true", "--stuck-threads-threshold", "17", "--dynamic", "true");
    assertSuccess(result);
    StuckThreadsChecker stConfig = config.getCheckerByType(stuckThreads.getCheckerType());
    assertEquals(17, Integer.parseInt(stConfig.getThreshold()));
    StuckThreadsHealthCheck activeService = (StuckThreadsHealthCheck) service.getCheck(stConfig.getName());
    assertEquals(Long.valueOf(17), 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)

Example 37 with CommandResult

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

the class SetHealthCheckServiceConfigurationTest method timeUnitDynamicAffectsConfigAndService.

@Test
public void timeUnitDynamicAffectsConfigAndService() {
    ensureHealthChecksAreEnabled();
    CommandResult result = asadmin("set-healthcheck-service-configuration", "--service", "gc", "--enabled", "true", "--time-unit", TimeUnit.HOURS.name(), "--dynamic", "true");
    assertSuccess(result);
    Checker gcConfig = config.getCheckerByType(garbageCollection.getCheckerType());
    assertEquals(TimeUnit.HOURS.name(), gcConfig.getUnit());
    assertEquals(TimeUnit.HOURS, 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 38 with CommandResult

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

the class SetHealthCheckServiceConfigurationTest method thresholdWarningDynamicAffectsConfigAndService.

@Test
public void thresholdWarningDynamicAffectsConfigAndService() {
    ensureHealthChecksAreEnabled();
    CommandResult result = asadmin("set-healthcheck-service-configuration", "--service", "gc", "--enabled", "true", "--threshold-warning", "88", "--dynamic", "true");
    assertSuccess(result);
    GarbageCollectorChecker gcConfig = config.getCheckerByType(garbageCollection.getCheckerType());
    assertEquals(88, Integer.parseInt(gcConfig.getProperty(HealthCheckConstants.THRESHOLD_WARNING).getValue()));
    GarbageCollectorHealthCheck activeService = (GarbageCollectorHealthCheck) service.getCheck(gcConfig.getName());
    assertEquals(88, 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 39 with CommandResult

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

the class SetHealthCheckNotifierConfigurationTest method enabledDynamicAffectsConfigAndService.

@Test
public void enabledDynamicAffectsConfigAndService() {
    ensureHealthChecksAreEnabled();
    CommandResult result = asadmin("set-healthcheck-configuration", "--disableNotifiers", "log-notifier", "--enabled", "true", "--dynamic", "true");
    assertSuccess(result);
    assertFalse(isLogNotifierConfigEnabled.get());
    assertFalse(isLogNotifierEnabled.get());
    result = asadmin("set-healthcheck-configuration", "--enableNotifiers", "log-notifier", "--enabled", "false", "--dynamic", "true");
    assertTrue(isLogNotifierConfigEnabled.get());
    assertTrue(isLogNotifierEnabled.get());
}
Also used : CommandResult(org.glassfish.embeddable.CommandResult) Test(org.junit.Test)

Example 40 with CommandResult

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

the class SetHealthCheckNotifierConfigurationTest method enabledAffectsConfigButNotService.

@Test
public void enabledAffectsConfigButNotService() {
    boolean logEnabled = isLogNotifierEnabled.get();
    CommandResult result = asadmin("set-healthcheck-configuration", "--disableNotifiers", "log-notifier", "--enabled", "true");
    assertSuccess(result);
    assertFalse(isLogNotifierConfigEnabled.get());
    assertUnchanged(logEnabled, isLogNotifierEnabled.get());
    result = asadmin("set-healthcheck-configuration", "--enableNotifiers", "log-notifier", "--enabled", "false");
    assertTrue(isLogNotifierConfigEnabled.get());
    assertUnchanged(logEnabled, isLogNotifierEnabled.get());
}
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