Search in sources :

Example 6 with MingleConfig

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

the class MingleConfigServiceIntegrationTest method shouldFetchMingleConfigForAGivenPipeline.

@Test
public void shouldFetchMingleConfigForAGivenPipeline() {
    HttpLocalizedOperationResult result = new HttpLocalizedOperationResult();
    MingleConfig mingleConfig = mingleConfigService.mingleConfigForPipelineNamed("foo", new Username(new CaseInsensitiveString("authorized_user")), result);
    assertThat(mingleConfig, is(new MingleConfig("https://some-tracking-tool:8443", "project-super-secret", "hello=world")));
    assertThat(result.isSuccessful(), is(true));
    result = new HttpLocalizedOperationResult();
    mingleConfig = mingleConfigService.mingleConfigForPipelineNamed("foo", new Username(new CaseInsensitiveString("admin")), result);
    assertThat(mingleConfig, is(new MingleConfig("https://some-tracking-tool:8443", "project-super-secret", "hello=world")));
    assertThat(result.isSuccessful(), is(true));
}
Also used : HttpLocalizedOperationResult(com.thoughtworks.go.server.service.result.HttpLocalizedOperationResult) Username(com.thoughtworks.go.server.domain.Username) MingleConfig(com.thoughtworks.go.config.MingleConfig) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) Test(org.junit.Test)

Example 7 with MingleConfig

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

the class MingleCardTest method shouldBeEqualToAnotherMingleCardWithSameConfigAndCardNumber.

@Test
public void shouldBeEqualToAnotherMingleCardWithSameConfigAndCardNumber() {
    MingleCard card1 = new MingleCard(new MingleConfig("mingle-url", "project-name", null), "#1234");
    MingleCard card2 = new MingleCard(new MingleConfig("mingle-url", "project-name", null), "#1234");
    assertThat(card1.equals(card2), is(true));
}
Also used : MingleConfig(com.thoughtworks.go.config.MingleConfig) Test(org.junit.Test)

Example 8 with MingleConfig

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

the class ViewCacheKey method forPipelineModelBuildCauses.

public String forPipelineModelBuildCauses(PipelineModel model) {
    StringBuilder s = new StringBuilder();
    s.append("view_buildCausesForPipelineModel_");
    s.append(model.getName());
    for (PipelineInstanceModel pim : model.getActivePipelineInstances()) {
        TrackingTool trackingTool = pim.getTrackingTool();
        MingleConfig mingleConfig = pim.getMingleConfig();
        int trackingToolHash = trackingTool == null ? -1 : trackingTool.hashCode();
        int mingleToolHash = mingleConfig == null ? -1 : mingleConfig.hashCode();
        s.append("[").append(pim.getId()).append("|").append(trackingToolHash).append("|").append(mingleToolHash).append("]");
    }
    return s.toString();
}
Also used : PipelineInstanceModel(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel) MingleConfig(com.thoughtworks.go.config.MingleConfig) TrackingTool(com.thoughtworks.go.config.TrackingTool)

Example 9 with MingleConfig

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

the class MingleConfigServiceIntegrationTest method shouldNotConsiderNoMingleConfigAnError.

@Test
public void shouldNotConsiderNoMingleConfigAnError() {
    HttpLocalizedOperationResult result = new HttpLocalizedOperationResult();
    MingleConfig mingleConfig = mingleConfigService.mingleConfigForPipelineNamed("bar", new Username(new CaseInsensitiveString("admin")), result);
    assertThat(mingleConfig, is(nullValue()));
    assertThat(result.isSuccessful(), is(true));
}
Also used : HttpLocalizedOperationResult(com.thoughtworks.go.server.service.result.HttpLocalizedOperationResult) Username(com.thoughtworks.go.server.domain.Username) MingleConfig(com.thoughtworks.go.config.MingleConfig) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) Test(org.junit.Test)

Example 10 with MingleConfig

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

the class MingleConfigTest method shouldBuildUrlGivenPath.

@Test
public void shouldBuildUrlGivenPath() throws Exception {
    MingleConfig mingleConfig = new MingleConfig("http://foo.bar:7019/baz", "go-project");
    assertThat(mingleConfig.urlFor("/cards/123"), is("http://foo.bar:7019/baz/cards/123"));
    assertThat(mingleConfig.urlFor("cards/123"), is("http://foo.bar:7019/bazcards/123"));
    mingleConfig = new MingleConfig("http://foo.bar:7019/baz/", "go-project");
    assertThat(mingleConfig.urlFor("/cards/123"), is("http://foo.bar:7019/baz/cards/123"));
    assertThat(mingleConfig.urlFor("cards/123"), is("http://foo.bar:7019/baz/cards/123"));
    mingleConfig = new MingleConfig("http://foo.bar:7019", "go-project");
    assertThat(mingleConfig.urlFor("/cards/123"), is("http://foo.bar:7019/cards/123"));
    mingleConfig = new MingleConfig("http://foo.bar:7019/quux?hi=there", "go-project");
    assertThat(mingleConfig.urlFor("/cards/123"), is("http://foo.bar:7019/quux/cards/123?hi=there"));
}
Also used : MingleConfig(com.thoughtworks.go.config.MingleConfig) Test(org.junit.Test)

Aggregations

MingleConfig (com.thoughtworks.go.config.MingleConfig)20 Test (org.junit.Test)17 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)5 Username (com.thoughtworks.go.server.domain.Username)3 HttpLocalizedOperationResult (com.thoughtworks.go.server.service.result.HttpLocalizedOperationResult)3 ConfigSaveValidationContext (com.thoughtworks.go.config.ConfigSaveValidationContext)2 TrackingTool (com.thoughtworks.go.config.TrackingTool)2 PipelineInstanceModel (com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel)2 AdminUser (com.thoughtworks.go.config.AdminUser)1 Authorization (com.thoughtworks.go.config.Authorization)1 CruiseConfig (com.thoughtworks.go.config.CruiseConfig)1 LdapConfig (com.thoughtworks.go.config.LdapConfig)1 PasswordFileConfig (com.thoughtworks.go.config.PasswordFileConfig)1 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)1 PipelineConfigs (com.thoughtworks.go.config.PipelineConfigs)1 SecurityConfig (com.thoughtworks.go.config.SecurityConfig)1 ViewConfig (com.thoughtworks.go.config.ViewConfig)1 StageIdentifier (com.thoughtworks.go.domain.StageIdentifier)1 PipelineModel (com.thoughtworks.go.presentation.pipelinehistory.PipelineModel)1 StageInstanceModels (com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModels)1