예제 #1
0
 @Test
 public void shouldThrowAnExceptionIfSCMIsNotFound() throws Exception {
   SCM updatedScm =
       new SCM(
           "non-existent-id",
           new PluginConfiguration("non-existent-plugin-id", "1"),
           new Configuration(
               new ConfigurationProperty(
                   new ConfigurationKey("key1"), new ConfigurationValue("value1"))));
   UpdateSCMConfigCommand command =
       new UpdateSCMConfigCommand(
           updatedScm,
           pluggableScmService,
           goConfigService,
           currentUser,
           result,
           "md5",
           entityHashingService);
   thrown.expect(NullPointerException.class);
   thrown.expectMessage("The pluggable scm material with id 'non-existent-id' is not found.");
   command.update(cruiseConfig);
 }
예제 #2
0
 @Test
 public void shouldUpdateAnExistingSCMWithNewValues() throws Exception {
   SCM updatedScm =
       new SCM(
           "id",
           new PluginConfiguration("plugin-id", "1"),
           new Configuration(
               new ConfigurationProperty(
                   new ConfigurationKey("key1"), new ConfigurationValue("value1"))));
   updatedScm.setName("material");
   UpdateSCMConfigCommand command =
       new UpdateSCMConfigCommand(
           updatedScm,
           pluggableScmService,
           goConfigService,
           currentUser,
           result,
           "md5",
           entityHashingService);
   assertThat(cruiseConfig.getSCMs().contains(scm), is(true));
   command.update(cruiseConfig);
   assertThat(cruiseConfig.getSCMs().contains(updatedScm), is(true));
 }