Esempio n. 1
0
 public void testLoginInvalidCredentials() throws Exception {
   RedmineRepository redmineRepository = new RedmineRepository();
   Project project = new Project();
   project.setName("example");
   RedmineRepositoryConfig config = new RedmineRepositoryConfig();
   config.username = "******";
   config.password = "******";
   Server server = new Server();
   server.setUrl("http://redmine.jabox.org/");
   config.setServer(server);
   boolean login = redmineRepository.login(config);
   assertFalse(login);
 }
Esempio n. 2
0
  public void testLoginValidCredentials() throws Exception {
    RedmineRepository redmineRepository = new RedmineRepository();
    Project project = new Project();
    project.setName("example");
    project.setDescription("example description");
    RedmineRepositoryConfig config = new RedmineRepositoryConfig();
    config.username = "******";
    config.password = "******";
    Server server = new Server();
    server.setUrl("http://redmine.jabox.org/");
    config.setServer(server);
    boolean login = redmineRepository.login(config);
    assertTrue(login);
    redmineRepository.addProject(project, config);
    SCMConnectorConfig scmConfig =
        new SCMConnectorConfig() {
          private static final long serialVersionUID = 6864333280150931583L;

          @Override
          public Long getId() {
            return null;
          }

          @Override
          public Server getServer() {
            return null;
          }

          @Override
          public String getPluginId() {
            return null;
          }

          @Override
          public String getUsername() {
            return null;
          }

          @Override
          public String getScmUrl() {
            return "http://www.jabox.org/";
          }

          @Override
          public String getScmMavenPrefix() {
            return null;
          }

          @Override
          public String getProjectScmUrl(String projectName) {
            return null;
          }

          @Override
          public String getPassword() {
            return null;
          }
        };
    config.setAddRepositoryConfiguration(true);
    redmineRepository.addRepository(project, config, scmConfig, config.username, config.password);
  }