Search in sources :

Example 1 with Revision

use of org.talend.dataprofiler.ecos.model.impl.Revision in project tdq-studio-se by Talend.

the class ComponentSearcher method convertRevision.

/**
 * Convert the web service returned value to our model object.
 *
 * @param revision The message returned from web service method call.
 * @return
 * @throws ParseException
 */
private static IRevision convertRevision(RevisionInfo revision) throws ParseException {
    IRevision rev = new Revision();
    rev.setDate(formatter.parse(revision.getRevision_date()));
    rev.setName(revision.getRevision_name());
    rev.setUrl(revision.getDownload_url());
    rev.setDescription(revision.getRevision_description());
    rev.setId(revision.getRevision_id());
    rev.setFileName(revision.getFilename());
    return rev;
}
Also used : Revision(org.talend.dataprofiler.ecos.model.impl.Revision) IRevision(org.talend.dataprofiler.ecos.model.IRevision) IRevision(org.talend.dataprofiler.ecos.model.IRevision)

Example 2 with Revision

use of org.talend.dataprofiler.ecos.model.impl.Revision in project tdq-studio-se by Talend.

the class EcosystemServiceTest method testIsRevisionNewerThan.

/**
 * Test method for
 * {@link org.talend.dataprofiler.ecos.service.EcosystemService#isRevisionNewerThan(org.talend.dataprofiler.ecos.model.impl.Revision, org.talend.dataprofiler.ecos.model.impl.Revision)}
 * .
 */
@Test
public void testIsRevisionNewerThan() {
    Revision revisionBigOne = new Revision();
    // $NON-NLS-1$
    revisionBigOne.setName("6.0.1");
    Revision revisionSmallOne = new Revision();
    // $NON-NLS-1$
    revisionSmallOne.setName("3.2.1");
    Assert.assertTrue(revisionBigOne + " should more than " + revisionSmallOne, // $NON-NLS-1$
    EcosystemService.isRevisionNewerThan(revisionBigOne, revisionSmallOne));
    // $NON-NLS-1$
    revisionBigOne.setName("3.3.1");
    Assert.assertTrue(revisionBigOne + " should more than " + revisionSmallOne, // $NON-NLS-1$
    EcosystemService.isRevisionNewerThan(revisionBigOne, revisionSmallOne));
    // $NON-NLS-1$
    revisionBigOne.setName("3.2.1.modify");
    Assert.assertTrue(revisionBigOne + " should more than " + revisionSmallOne, // $NON-NLS-1$
    EcosystemService.isRevisionNewerThan(revisionBigOne, revisionSmallOne));
    // $NON-NLS-1$
    revisionBigOne.setName("123456");
    // $NON-NLS-1$
    revisionSmallOne.setName("12345");
    Assert.assertTrue(revisionBigOne + " should more than " + revisionSmallOne, // $NON-NLS-1$
    EcosystemService.isRevisionNewerThan(revisionBigOne, revisionSmallOne));
    try {
        // $NON-NLS-1$
        revisionBigOne.setName("a.b.c");
        // $NON-NLS-1$
        revisionSmallOne.setName("12345");
        Assert.assertTrue(revisionBigOne + " should more than " + revisionSmallOne, // $NON-NLS-1$
        EcosystemService.isRevisionNewerThan(revisionBigOne, revisionSmallOne));
        // $NON-NLS-1$
        fail("there should be a RuntimeException");
    } catch (NumberFormatException e) {
    // nothing need to do
    }
    try {
        // $NON-NLS-1$
        revisionBigOne.setName("12345");
        // $NON-NLS-1$
        revisionSmallOne.setName("a.b.c");
        Assert.assertTrue(revisionBigOne + " should more than " + revisionSmallOne, // $NON-NLS-1$
        EcosystemService.isRevisionNewerThan(revisionBigOne, revisionSmallOne));
        // $NON-NLS-1$
        fail("there should be a RuntimeException");
    } catch (NumberFormatException e) {
    // nothing need to do
    }
}
Also used : Revision(org.talend.dataprofiler.ecos.model.impl.Revision) Test(org.junit.Test)

Aggregations

Revision (org.talend.dataprofiler.ecos.model.impl.Revision)2 Test (org.junit.Test)1 IRevision (org.talend.dataprofiler.ecos.model.IRevision)1