Package com.taskadapter.redmineapi.bean

Examples of com.taskadapter.redmineapi.bean.Version


        USER_PARSER));
    return result;
  }

  public static Version parseVersion(JSONObject content) throws JSONException {
    final Version result = VersionFactory.create(JsonInput.getIntOrNull(content, "id"));
    result.setProject(JsonInput.getObjectOrNull(content, "project",
        MINIMAL_PROJECT_PARSER));
    result.setName(JsonInput.getStringOrNull(content, "name"));
    result.setDescription(JsonInput.getStringOrNull(content, "description"));
    result.setSharing(JsonInput.getStringOrNull(content, "sharing"));
    result.setStatus(JsonInput.getStringOrNull(content, "status"));
    result.setDueDate(getShortDateOrNull(content, "due_date"));
    result.setCreatedOn(getDateOrNull(content, "created_on"));
    result.setUpdatedOn(getDateOrNull(content, "updated_on"));
    result.addCustomFields(JsonInput.getListOrEmpty(content,
        "custom_fields", RedmineJSONParser.CUSTOM_FIELD_PARSER));
    return result;
  }
View Full Code Here


    }
  }

  @Test
  public void testVersionDefaults() throws RedmineException {
    final Version template = VersionFactory.create();
    template.setProject(projectManager.getProjectByKey(projectKey));
    template.setName("2.3.4.5");
    final Version version = projectManager.createVersion(template);
    try {
      Assert.assertNotNull(version.getId());
      Assert.assertNotNull(version.getProject());
      Assert.assertEquals("2.3.4.5", version.getName());
      Assert.assertEquals("", version.getDescription());
      Assert.assertNotNull(version.getStatus());
      Assert.assertNull(version.getDueDate());
      Assert.assertNotNull(version.getCreatedOn());
      Assert.assertNotNull(version.getUpdatedOn());
    } finally {
      projectManager.deleteVersion(version);
    }
  }
View Full Code Here

    @Test
    public void testDeleteVersion() throws RedmineException {
        Project project = createProject();
        try {
            String name = "Test version " + UUID.randomUUID().toString();
            Version version = VersionFactory.create(project, name);
            version.setDescription("A test version created by " + this.getClass());
            version.setStatus("open");
            Version newVersion = projectManager.createVersion(version);
            assertEquals("checking version name", name, newVersion.getName());

            projectManager.deleteVersion(newVersion);
            List<Version> versions = projectManager.getVersions(project.getId());
            assertTrue("List of versions of test project must be empty now but is "
                    + versions, versions.isEmpty());
View Full Code Here

     * @throws NotFoundException              thrown in case the objects requested for could not be found
     */
    @Test
    public void testGetVersions() throws RedmineException {
        Project project = createProject();
        Version testVersion1 = null;
        Version testVersion2 = null;
        try {
            testVersion1 = projectManager.createVersion(VersionFactory.create(project, "Version" + UUID.randomUUID()));
            testVersion2 = projectManager.createVersion(VersionFactory.create(project, "Version" + UUID.randomUUID()));
            List<Version> versions = projectManager.getVersions(project.getId());
            assertEquals("Wrong number of versions for project "
View Full Code Here

    }

    @Test
    public void versionIsRetrievedById() throws RedmineException {
        Project project = projectManager.getProjectByKey(projectKey);
        Version createdVersion = projectManager.createVersion(VersionFactory.create(project,
                "Version_1_" + UUID.randomUUID()));
        Version versionById = projectManager.getVersionById(createdVersion.getId());
        assertEquals(createdVersion, versionById);
    }
View Full Code Here

    }

    @Test
    public void versionIsUpdated() throws RedmineException {
        Project project = projectManager.getProjectByKey(projectKey);
        Version createdVersion = projectManager.createVersion(VersionFactory.create(project,
                "Version_1_" + UUID.randomUUID()));
        String description = "new description";
        createdVersion.setDescription(description);
        projectManager.update(createdVersion);
        Version versionById = projectManager.getVersionById(createdVersion.getId());
        assertEquals(description, versionById.getDescription());
    }
View Full Code Here

    }

    @Test
    public void versionIsUpdatedIncludingDueDate() throws RedmineException {
        Project project = projectManager.getProjectByKey(projectKey);
        Version createdVersion = projectManager.createVersion(VersionFactory.create(project,
                "Version_1_" + UUID.randomUUID()));
        String description = "new description";
        createdVersion.setDescription(description);
        createdVersion.setDueDate(new Date());
        projectManager.update(createdVersion);
        Version versionById = projectManager.getVersionById(createdVersion.getId());
        assertEquals(description, versionById.getDescription());
    }
View Full Code Here

    }

    @Test
    public void versionSharingParameterIsSaved() throws RedmineException {
        Project project = projectManager.getProjectByKey(projectKey);
        Version version = VersionFactory.create(project, "Version_1_" + UUID.randomUUID());
        version.setSharing(Version.SHARING_NONE);
        Version createdVersion = projectManager.createVersion(version);
        Version versionById = projectManager.getVersionById(createdVersion.getId());
        assertEquals(Version.SHARING_NONE, versionById.getSharing());

        Version versionShared = VersionFactory.create(project, "Version_2_" + UUID.randomUUID());
        versionShared.setSharing(Version.SHARING_HIERARCHY);
        Version createdVersion2 = projectManager.createVersion(versionShared);
        Version version2ById = projectManager.getVersionById(createdVersion2.getId());
        assertEquals(Version.SHARING_HIERARCHY, version2ById.getSharing());
    }
View Full Code Here

     * @throws RedmineAuthenticationException thrown in case something went wrong while trying to login
     * @throws NotFoundException              thrown in case the objects requested for could not be found
     */
    @Test(expected = IllegalArgumentException.class)
    public void testCreateInvalidVersion() throws RedmineException {
        Version version = VersionFactory.create(null, "Invalid version " + UUID.randomUUID().toString());
        projectManager.createVersion(version);
    }
View Full Code Here

     * @throws NotFoundException              thrown in case the objects requested for could not be found
     */
    @Test(expected = NotFoundException.class)
    public void testDeleteInvalidVersion() throws RedmineException {
        // create new test version with invalid id: -1.
        Version version = VersionFactory.create(-1);
        version.setName("name invalid version " + UUID.randomUUID().toString());
        version.setDescription("An invalid test version created by " + this.getClass());
        // now try to delete version
        projectManager.deleteVersion(version);
    }
View Full Code Here

TOP

Related Classes of com.taskadapter.redmineapi.bean.Version

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.