blob: bad8b2fd558c644dd5329bd9293add4e4ceeb462 [file] [log] [blame]
package org.apache.sling.crankstart.launcher;
import static org.junit.Assert.assertEquals;
import java.io.IOException;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.sling.commons.testing.junit.Retry;
import org.apache.sling.commons.testing.junit.RetryRule;
import org.apache.sling.testing.tools.osgi.WebconsoleClient;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
/** Test our run modes support */
public class RunModeBIT {
private static CrankstartSetup C = new CrankstartSetup();
private static WebconsoleClient osgiConsole;
private DefaultHttpClient client;
private static final String RUN_MODES = "bala,B,laika,another";
@Rule
public final RetryRule retryRule = new RetryRule();
@BeforeClass
public static void setupClass() throws Exception {
System.setProperty(RunModeFilter.SLING_RUN_MODES, RUN_MODES);
C.setup();
osgiConsole = new WebconsoleClient(C.getBaseUrl(), U.ADMIN, U.ADMIN);
}
@Before
public void setup() throws IOException {
client = new DefaultHttpClient();
}
@AfterClass
public static void cleanupClass() {
System.clearProperty(RunModeFilter.SLING_RUN_MODES);
}
@Test
@Retry(timeoutMsec=U.LONG_TIMEOUT_MSEC, intervalMsec=U.STD_INTERVAL)
public void testSlingApiVersionA() throws Exception {
assertEquals("2.0.6", osgiConsole.getBundleVersion(U.SLING_API_BUNDLE));
}
@Test
@Retry(timeoutMsec=U.LONG_TIMEOUT_MSEC, intervalMsec=U.STD_INTERVAL)
public void testConfigA() throws Exception {
U.setAdminCredentials(client);
U.assertHttpGet(C, client,
"/test/config/runmode.test",
"runmode.test#mode=(String)That's B + another#service.pid=(String)runmode.test##EOC#");
}
}