Search in sources :

Example 1 with MingleConfig

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

the class MingleConfigTest method shouldReturnOriginalStringIfRegexDoesNotMatch.

@Test
public void shouldReturnOriginalStringIfRegexDoesNotMatch() throws Exception {
    String toRender = "evo-abc: checkin message";
    MingleConfig config = new MingleConfig("http://mingle05", "cce");
    assertThat(config.render(toRender), is(toRender));
}
Also used : MingleConfig(com.thoughtworks.go.config.MingleConfig) Test(org.junit.Test)

Example 2 with MingleConfig

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

the class StageFeedEntryTest method shouldNotAddDuplicateMingleCardsToMingleCardsList.

@Test
public void shouldNotAddDuplicateMingleCardsToMingleCardsList() {
    StageFeedEntry entry = new StageFeedEntry(1, 1, new StageIdentifier(), 1, new Date(), StageResult.Passed);
    entry.addCard(new MingleCard(new MingleConfig("mingle-url", "project-name", null), "#1234"));
    entry.addCard(new MingleCard(new MingleConfig("mingle-url", "project-name", null), "#1234"));
    entry.addCard(new MingleCard(new MingleConfig("mingle-url", "project-name-2", null), "#5678"));
    assertThat(entry.getMingleCards().size(), is(2));
}
Also used : StageIdentifier(com.thoughtworks.go.domain.StageIdentifier) MingleCard(com.thoughtworks.go.server.ui.MingleCard) MingleConfig(com.thoughtworks.go.config.MingleConfig) Date(java.util.Date) Test(org.junit.Test)

Example 3 with MingleConfig

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

the class MingleConfigService method mingleConfigForPipelineNamed.

public MingleConfig mingleConfigForPipelineNamed(String pipelineName, Username user, HttpLocalizedOperationResult result) {
    if (!securityService.hasViewPermissionForPipeline(user, pipelineName)) {
        result.unauthorized(LocalizedMessage.cannotViewPipeline(pipelineName), HealthStateType.unauthorisedForPipeline(pipelineName));
        return null;
    }
    PipelineConfig pipelineConfig = goConfigService.pipelineConfigNamed(new CaseInsensitiveString(pipelineName));
    MingleConfig mingleConfig = pipelineConfig.getMingleConfig();
    return mingleConfig.equals(new MingleConfig()) ? null : mingleConfig;
}
Also used : PipelineConfig(com.thoughtworks.go.config.PipelineConfig) MingleConfig(com.thoughtworks.go.config.MingleConfig) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString)

Example 4 with MingleConfig

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

the class MingleConfigServiceIntegrationTest method shouldNotAllowUnauthorizedUserToGetMingleConfig.

@Test
public void shouldNotAllowUnauthorizedUserToGetMingleConfig() {
    HttpLocalizedOperationResult result = new HttpLocalizedOperationResult();
    MingleConfig mingleConfig = mingleConfigService.mingleConfigForPipelineNamed("foo", new Username(new CaseInsensitiveString("some_loser")), result);
    assertThat(mingleConfig, is(nullValue()));
    assertThat(result.isSuccessful(), is(false));
    assertThat(result.message(localizer), is("You do not have view permissions for pipeline 'foo'."));
    assertThat(result.httpCode(), is(401));
}
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 5 with MingleConfig

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

the class MingleConfigServiceIntegrationTest method setUp.

@Before
public void setUp() throws Exception {
    dbHelper.onSetUp();
    configHelper = new GoConfigFileHelper(goConfigDao);
    configHelper.onSetUp();
    configHelper.addPipeline("bar", "stage", MaterialConfigsMother.defaultMaterialConfigs(), "build");
    pipelineConfig = configHelper.addPipeline("foo", "stage", MaterialConfigsMother.defaultMaterialConfigs(), "build");
    configHelper.addMingleConfigToPipeline("foo", new MingleConfig("https://some-tracking-tool:8443", "project-super-secret", "hello=world"));
    CruiseConfig cruiseConfig = configHelper.load();
    PipelineConfigs group = cruiseConfig.findGroup("defaultGroup");
    group.setAuthorization(new Authorization(new ViewConfig(new AdminUser(new CaseInsensitiveString("authorized_user")))));
    configHelper.writeConfigFile(cruiseConfig);
    SecurityConfig securityConfig = new SecurityConfig(new LdapConfig(new GoCipher()), new PasswordFileConfig("/tmp/foo.passwd"), true);
    securityConfig.adminsConfig().add(new AdminUser(new CaseInsensitiveString("admin")));
    configHelper.addSecurity(securityConfig);
}
Also used : Authorization(com.thoughtworks.go.config.Authorization) LdapConfig(com.thoughtworks.go.config.LdapConfig) GoCipher(com.thoughtworks.go.security.GoCipher) SecurityConfig(com.thoughtworks.go.config.SecurityConfig) ViewConfig(com.thoughtworks.go.config.ViewConfig) AdminUser(com.thoughtworks.go.config.AdminUser) PipelineConfigs(com.thoughtworks.go.config.PipelineConfigs) GoConfigFileHelper(com.thoughtworks.go.util.GoConfigFileHelper) MingleConfig(com.thoughtworks.go.config.MingleConfig) PasswordFileConfig(com.thoughtworks.go.config.PasswordFileConfig) CruiseConfig(com.thoughtworks.go.config.CruiseConfig) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) Before(org.junit.Before)

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