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);
}
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");
}
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"));
}
Aggregations