package at.kugel.tool.buildtray.action;
import org.junit.Test;
import at.kugel.tool.buildtray.config.Config;
import at.kugel.tool.buildtray.config.IntegrationTestConfig;
import at.kugel.tool.buildtray.status.IntegrationStatusResult;
import at.kugel.tool.buildtray.status.Status;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
public class MixedMultiTest extends AbstractHtmlRegularExpressionActionsTestCase {
private IntegrationTestConfig createFirstConfig() {
return createConfig("./config/Jenkins-1.4.properties");
}
private IntegrationTestConfig createSecondConfig() {
return createConfig("./config/Hudson-1.2-no_busy.properties");
}
@Test
public void shouldFailOnFaulureInFirstResponse() {
IntegrationTestConfig mockConf1 = createFirstConfig();
mockConf1.setServerlUrl4Test(getTestDataUrl("Jenkins-1.4_failed.xml"));
IntegrationTestConfig mockConf2 = createSecondConfig();
mockConf2.setServerlUrl4Test(getTestDataUrl("hudson-1.2_success.xml"));
IntegrationStatusResult res = refreshWith(new Config[] { mockConf1, mockConf2 });
assertNull(res.error);
assertEquals("commons-solr-copy #2", res.projectName);
assertEquals(Status.FAILED, res.status);
}
@Test
public void shouldFailOnFaulureInSecondResponse() {
IntegrationTestConfig mockConf1 = createFirstConfig();
mockConf1.setServerlUrl4Test(getTestDataUrl("Jenkins-1.4_success.xml"));
IntegrationTestConfig mockConf2 = createSecondConfig();
mockConf2.setServerlUrl4Test(getTestDataUrl("hudson-1.2_failed.xml"));
IntegrationStatusResult res = refreshWith(new Config[] { mockConf1, mockConf2 });
assertNull(res.error);
assertEquals("Krimi Trunk ANT-M2 for Bea 10 #9", res.projectName);
assertEquals(Status.FAILED, res.status);
assertEquals("2009-03-03T06:18:53Z", res.date);
}
@Test
public void shouldSucceedOnBothSuccessResponses() {
IntegrationTestConfig mockConf1 = createFirstConfig();
mockConf1.setServerlUrl4Test(getTestDataUrl("Jenkins-1.4_success.xml"));
IntegrationTestConfig mockConf2 = createSecondConfig();
mockConf2.setServerlUrl4Test(getTestDataUrl("hudson-1.2_success.xml"));
IntegrationStatusResult res = refreshWith(new Config[] { mockConf1, mockConf2 });
assertNull(res.error);
assertEquals("clients-bbc-iplayer #4", res.projectName);
assertEquals(Status.OK, res.status);
assertEquals("2011-05-01T18:11:17Z", res.date);
}
}