コード例 #1
0
  @Test
  public void shouldCreatePackageRepository() throws Exception {
    PackageRepository repository =
        new PackageRepository("id", "name", new PluginConfiguration(), new Configuration());
    CreatePackageRepositoryCommand command =
        new CreatePackageRepositoryCommand(
            goConfigService, packageRepositoryService, repository, currentUser, result);

    assertNull(cruiseConfig.getPackageRepositories().find("id"));
    command.update(cruiseConfig);
    HttpLocalizedOperationResult expectedResult = new HttpLocalizedOperationResult();
    assertThat(result, is(expectedResult));
    assertThat(cruiseConfig.getPackageRepositories().find("id"), is(repository));
  }
コード例 #2
0
 @Before
 public void setup() throws Exception {
   initMocks(this);
   currentUser = new Username(new CaseInsensitiveString("user"));
   cruiseConfig = GoConfigMother.defaultCruiseConfig();
   repoId = "npmOrg";
   packageRepository =
       new PackageRepository(
           repoId, repoId, new PluginConfiguration("npm", "1"), new Configuration());
   result = new HttpLocalizedOperationResult();
   cruiseConfig.getPackageRepositories().add(packageRepository);
 }