Search in sources :

Example 76 with CommandResult

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

the class SetHealthCheckServiceConfigurationTest method thresholdWarningBelowMinimumCausesError.

@Test
public void thresholdWarningBelowMinimumCausesError() {
    CommandResult result = asadmin("set-healthcheck-service-configuration", "--service", "gc", "--enabled", "true", "--threshold-warning", "-1");
    assertUnacceptableParameter("thresholdWarning", result);
    assertContains("Warning threshold is a percentage so must be greater than zero", result.getOutput());
}
Also used : CommandResult(org.glassfish.embeddable.CommandResult) Test(org.junit.Test)

Example 77 with CommandResult

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

the class SetHealthCheckServiceConfigurationTest method timeDynamicAffectsConfigAndService.

@Test
public void timeDynamicAffectsConfigAndService() {
    ensureHealthChecksAreEnabled();
    CommandResult result = asadmin("set-healthcheck-service-configuration", "--service", "gc", "--enabled", "true", "--time", "42", "--dynamic", "true");
    assertSuccess(result);
    Checker gcConfig = config.getCheckerByType(garbageCollection.getCheckerType());
    assertEquals(42L, Long.parseLong(gcConfig.getTime()));
    assertEquals(42L, service.getCheck(gcConfig.getName()).getOptions().getTime());
}
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 78 with CommandResult

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

the class SetHealthCheckServiceConfigurationTest method stuckThreadsThresholdBelowMinumumCausesError.

@Test
public void stuckThreadsThresholdBelowMinumumCausesError() {
    CommandResult result = asadmin("set-healthcheck-service-configuration", "--service", "st", "--enabled", "true", "--stuck-threads-threshold", "0");
    assertUnacceptableParameter("stuckThreadsThreshold", result);
}
Also used : CommandResult(org.glassfish.embeddable.CommandResult) Test(org.junit.Test)

Example 79 with CommandResult

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

the class SetHealthCheckServiceConfigurationTest method thresholdCriticalBelowMinimumCausesError.

@Test
public void thresholdCriticalBelowMinimumCausesError() {
    CommandResult result = asadmin("set-healthcheck-service-configuration", "--service", "gc", "--enabled", "true", "--threshold-critical", "-1");
    assertUnacceptableParameter("thresholdCritical", result);
    assertContains("Critical threshold is a percentage so must be greater than zero", result.getOutput());
}
Also used : CommandResult(org.glassfish.embeddable.CommandResult) Test(org.junit.Test)

Example 80 with CommandResult

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

the class SetHealthCheckServiceConfigurationTest method thresholdGoodDynamicAffectsConfigAndService.

@Test
public void thresholdGoodDynamicAffectsConfigAndService() {
    ensureHealthChecksAreEnabled();
    CommandResult result = asadmin("set-healthcheck-service-configuration", "--service", "gc", "--enabled", "true", "--threshold-good", "22", "--dynamic", "true");
    assertSuccess(result);
    GarbageCollectorChecker gcConfig = config.getCheckerByType(garbageCollection.getCheckerType());
    assertEquals(22, Integer.parseInt(gcConfig.getProperty(HealthCheckConstants.THRESHOLD_GOOD).getValue()));
    GarbageCollectorHealthCheck activeService = (GarbageCollectorHealthCheck) service.getCheck(gcConfig.getName());
    assertEquals(22, activeService.getOptions().getThresholdGood());
}
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)

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