Search in sources :

Example 1 with SCMView

use of com.thoughtworks.go.plugin.access.scm.SCMView in project gocd by gocd.

the class SCMViewModelBuilderTest method setUp.

@Before
public void setUp() {
    initMocks(this);
    builder = new SCMViewModelBuilder(manager);
    githubPR = new GoPluginDescriptor("github.pr", "version1", new GoPluginDescriptor.About("Github PR", "1.0", null, null, null, null), null, null, false);
    stashPR = new GoPluginDescriptor("stash.pr", "version1", new GoPluginDescriptor.About("Stash PR", "2.0", null, null, null, null), null, null, false);
    SCMConfigurations configurations = new SCMConfigurations();
    configurations.add(new SCMConfiguration("key1"));
    configurations.add(new SCMConfiguration("key2"));
    SCMView view = new SCMView() {

        @Override
        public String displayValue() {
            return "SCM Display Value";
        }

        @Override
        public String template() {
            return "scm view template";
        }
    };
    preference = new SCMPreference(configurations, view);
    SCMMetadataStore.getInstance().setPreferenceFor("github.pr", preference);
    SCMMetadataStore.getInstance().setPreferenceFor("stash.pr", preference);
}
Also used : SCMConfiguration(com.thoughtworks.go.plugin.access.scm.SCMConfiguration) SCMPreference(com.thoughtworks.go.plugin.access.scm.SCMPreference) GoPluginDescriptor(com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor) SCMConfigurations(com.thoughtworks.go.plugin.access.scm.SCMConfigurations) SCMView(com.thoughtworks.go.plugin.access.scm.SCMView) Before(org.junit.Before)

Example 2 with SCMView

use of com.thoughtworks.go.plugin.access.scm.SCMView in project gocd by gocd.

the class PluggableSCMMaterialTest method shouldCorrectlyGetTypeDisplay.

@Test
void shouldCorrectlyGetTypeDisplay() {
    PluggableSCMMaterial pluggableSCMMaterial = new PluggableSCMMaterial("scm-id");
    assertThat(pluggableSCMMaterial.getTypeForDisplay()).isEqualTo("SCM");
    pluggableSCMMaterial.setSCMConfig(SCMMother.create("scm-id"));
    assertThat(pluggableSCMMaterial.getTypeForDisplay()).isEqualTo("SCM");
    SCMMetadataStore.getInstance().addMetadataFor("plugin", null, null);
    assertThat(pluggableSCMMaterial.getTypeForDisplay()).isEqualTo("SCM");
    SCMView scmView = mock(SCMView.class);
    when(scmView.displayValue()).thenReturn("scm-name");
    SCMMetadataStore.getInstance().addMetadataFor("plugin", null, scmView);
    assertThat(pluggableSCMMaterial.getTypeForDisplay()).isEqualTo("scm-name");
}
Also used : PluggableSCMMaterial(com.thoughtworks.go.config.materials.PluggableSCMMaterial) SCMView(com.thoughtworks.go.plugin.access.scm.SCMView) Test(org.junit.jupiter.api.Test)

Example 3 with SCMView

use of com.thoughtworks.go.plugin.access.scm.SCMView in project gocd by gocd.

the class PluggableSCMMaterialConfigTest method shouldCorrectlyGetTypeDisplay.

@Test
public void shouldCorrectlyGetTypeDisplay() {
    assertThat(pluggableSCMMaterialConfig.getTypeForDisplay(), is("SCM"));
    pluggableSCMMaterialConfig.setSCMConfig(SCMMother.create("scm-id"));
    assertThat(pluggableSCMMaterialConfig.getTypeForDisplay(), is("SCM"));
    SCMMetadataStore.getInstance().addMetadataFor("plugin", null, null);
    assertThat(pluggableSCMMaterialConfig.getTypeForDisplay(), is("SCM"));
    SCMView scmView = mock(SCMView.class);
    when(scmView.displayValue()).thenReturn("scm-name");
    SCMMetadataStore.getInstance().addMetadataFor("plugin", null, scmView);
    assertThat(pluggableSCMMaterialConfig.getTypeForDisplay(), is("scm-name"));
}
Also used : SCMView(com.thoughtworks.go.plugin.access.scm.SCMView) Test(org.junit.jupiter.api.Test)

Aggregations

SCMView (com.thoughtworks.go.plugin.access.scm.SCMView)3 Test (org.junit.jupiter.api.Test)2 PluggableSCMMaterial (com.thoughtworks.go.config.materials.PluggableSCMMaterial)1 SCMConfiguration (com.thoughtworks.go.plugin.access.scm.SCMConfiguration)1 SCMConfigurations (com.thoughtworks.go.plugin.access.scm.SCMConfigurations)1 SCMPreference (com.thoughtworks.go.plugin.access.scm.SCMPreference)1 GoPluginDescriptor (com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor)1 Before (org.junit.Before)1