Search in sources :

Example 11 with MingleConfig

use of com.thoughtworks.go.config.MingleConfig in project gocd by gocd.

the class MingleConfigTest method shouldRenderStringWithSpecifiedRegexAndLink.

@Test
public void shouldRenderStringWithSpecifiedRegexAndLink() throws Exception {
    MingleConfig config = new MingleConfig("http://mingle05", "cce");
    String result = config.render("#111: checkin message");
    assertThat(result, is("<a href=\"" + "http://mingle05/projects/cce/cards/111\" target=\"story_tracker\">#111</a>: checkin message"));
}
Also used : MingleConfig(com.thoughtworks.go.config.MingleConfig) Test(org.junit.Test)

Example 12 with MingleConfig

use of com.thoughtworks.go.config.MingleConfig in project gocd by gocd.

the class MingleConfigTest method shouldValidateEmptyConfig.

@Test
public void shouldValidateEmptyConfig() {
    MingleConfig config = new MingleConfig();
    config.validate(null);
    assertThat(config.errors().isEmpty(), is(true));
}
Also used : MingleConfig(com.thoughtworks.go.config.MingleConfig) Test(org.junit.Test)

Example 13 with MingleConfig

use of com.thoughtworks.go.config.MingleConfig in project gocd by gocd.

the class MingleConfigTest method shouldSetMingleConfigFromConfigAttributes.

@Test
public void shouldSetMingleConfigFromConfigAttributes() {
    MingleConfig mingleConfig = new MingleConfig();
    Map configMap = new HashMap();
    configMap.put(MingleConfig.BASE_URL, "http://mingle01.tw.com/mingle");
    configMap.put(MingleConfig.PROJECT_IDENTIFIER, "go");
    configMap.put(MingleConfig.MQL_GROUPING_CONDITIONS, new SingletonMap(MqlCriteria.MQL, "Some MQL"));
    mingleConfig.setConfigAttributes(configMap);
    assertThat(mingleConfig.getBaseUrl(), is("http://mingle01.tw.com/mingle"));
    assertThat(mingleConfig.getProjectIdentifier(), is("go"));
    assertThat(mingleConfig.getMqlCriteria().getMql(), is("Some MQL"));
}
Also used : SingletonMap(org.apache.commons.collections.map.SingletonMap) HashMap(java.util.HashMap) MingleConfig(com.thoughtworks.go.config.MingleConfig) Map(java.util.Map) HashMap(java.util.HashMap) SingletonMap(org.apache.commons.collections.map.SingletonMap) Test(org.junit.Test)

Example 14 with MingleConfig

use of com.thoughtworks.go.config.MingleConfig in project gocd by gocd.

the class MingleConfigTest method shouldReturnInvalidIfTheURLIsNotAHTTPSURL.

@Test
public void shouldReturnInvalidIfTheURLIsNotAHTTPSURL() {
    MingleConfig mingleConfig = new MingleConfig("http://some-mingle-instance", "go");
    mingleConfig.validate(new ConfigSaveValidationContext(null));
    assertThat(mingleConfig.errors().isEmpty(), is(false));
    assertThat(mingleConfig.errors().on(MingleConfig.PROJECT_IDENTIFIER), is(nullValue()));
    assertThat(mingleConfig.errors().on(MingleConfig.BASE_URL), is("Should be a URL starting with https://"));
}
Also used : ConfigSaveValidationContext(com.thoughtworks.go.config.ConfigSaveValidationContext) MingleConfig(com.thoughtworks.go.config.MingleConfig) Test(org.junit.Test)

Example 15 with MingleConfig

use of com.thoughtworks.go.config.MingleConfig in project gocd by gocd.

the class ViewCacheKeyTest method shouldGenerateKeyForBuildCause.

@Test
public void shouldGenerateKeyForBuildCause() {
    PipelineModel model = new PipelineModel("pipelineName", true, true, PipelinePauseInfo.notPaused());
    PipelineInstanceModel pipelineInstance = PipelineInstanceModel.createPipeline("pipelineName", 10, "label-10", BuildCause.createExternal(), new StageInstanceModels());
    pipelineInstance.setId(12);
    TrackingTool trackingTool = new TrackingTool("link", "regex");
    pipelineInstance.setTrackingTool(trackingTool);
    model.addPipelineInstance(pipelineInstance);
    PipelineInstanceModel pipelineInstance2 = PipelineInstanceModel.createPipeline("pipelineName", 7, "label-7", BuildCause.createExternal(), new StageInstanceModels());
    pipelineInstance2.setId(14);
    MingleConfig mingleConfig = new MingleConfig("mingle", "project", "mql");
    pipelineInstance2.setMingleConfig(mingleConfig);
    model.addPipelineInstance(pipelineInstance2);
    assertThat(viewCacheKey.forPipelineModelBuildCauses(model), is(String.format("view_buildCausesForPipelineModel_pipelineName[12|%s|%s][14|%s|%s]", trackingTool.hashCode(), -1, -1, mingleConfig.hashCode())));
}
Also used : PipelineInstanceModel(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel) StageInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModels) MingleConfig(com.thoughtworks.go.config.MingleConfig) TrackingTool(com.thoughtworks.go.config.TrackingTool) PipelineModel(com.thoughtworks.go.presentation.pipelinehistory.PipelineModel) Test(org.junit.Test)

Aggregations

MingleConfig (com.thoughtworks.go.config.MingleConfig)17 Test (org.junit.Test)15 TrackingTool (com.thoughtworks.go.config.TrackingTool)3 ConfigSaveValidationContext (com.thoughtworks.go.config.ConfigSaveValidationContext)2 PipelineInstanceModel (com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel)2 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)1 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)1 StageIdentifier (com.thoughtworks.go.domain.StageIdentifier)1 PipelineModel (com.thoughtworks.go.presentation.pipelinehistory.PipelineModel)1 StageInstanceModels (com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModels)1 MingleCard (com.thoughtworks.go.server.ui.MingleCard)1 Date (java.util.Date)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 SingletonMap (org.apache.commons.collections.map.SingletonMap)1