Package rabbit.data.internal.xml.schema.events

Examples of rabbit.data.internal.xml.schema.events.TaskFileEventType


   
    TaskIdType id2 = new TaskIdType();
    id2.setHandleId(handleId);
    id2.setCreationDate(DatatypeUtil.toXmlDate(date));
   
    TaskFileEventType t1 = new TaskFileEventType();
    t1.setFilePath(fileId);
    t1.setDuration(duration1);
    t1.setTaskId(id1);
   
    TaskFileEventType t2 = new TaskFileEventType();
    t2.setFilePath(fileId);
    t2.setDuration(duration2);
    t2.setTaskId(id2);
   
    // Check that the objects created are mergeable, if this line fails, doesn't
    // mean the test has failed, just that we need to change our code to make
    // sure the two objects are mergeable, for the purpose of this test:
    assertTrue(merger.isMergeable(t1, t2));
   
    // Now the real tests:
    TaskFileEventType merged = merger.merge(t1, t2);
    assertEquals(duration1 + duration2, merged.getDuration());
    assertEquals(fileId, merged.getFilePath());
    assertNotSame(t1.getTaskId(), merged.getTaskId());
    assertNotSame(t2.getTaskId(), merged.getTaskId());
    assertEquals(handleId, merged.getTaskId().getHandleId());
    assertEquals(DatatypeUtil.toXmlDate(date), merged.getTaskId().getCreationDate());
  }
View Full Code Here


   
    TaskIdType id2 = new TaskIdType();
    id2.setHandleId(handleId);
    id2.setCreationDate(DatatypeUtil.toXmlDate(date));
   
    TaskFileEventType t1 = new TaskFileEventType();
    t1.setFilePath(fileId);
    t1.setDuration(duration1);
    t1.setTaskId(id1);
   
    TaskFileEventType t2 = new TaskFileEventType();
    t2.setFilePath(fileId);
    t2.setDuration(duration2);
    t2.setTaskId(id2);
   
    // Check that the objects created are mergeable, if this line fails, doesn't
    // mean the test has failed, just that we need to change our code to make
    // sure the two objects are mergeable, for the purpose of this test:
    assertTrue(merger.isMergeable(t1, t2));
   
    // Now the real tests, call the method first:
    TaskFileEventType merged = merger.merge(t1, t2);
    assertNotSame(t1.getTaskId(), merged.getTaskId());
    assertNotSame(t2.getTaskId(), merged.getTaskId());
   
    // Check the parameters are not altered:
    assertEquals(duration1, t1.getDuration());
    assertEquals(fileId, t1.getFilePath());
    assertSame(id1, t1.getTaskId());
View Full Code Here

    assertEquals(DatatypeUtil.toXmlDate(date), t2.getTaskId().getCreationDate());
  }
 
  @Test
  public void testMerger_clonesDate() {
    TaskFileEventType t1 = createTargetType();
    TaskFileEventType t2 = createTargetType();
    TaskFileEventType merged = merger.merge(t1, t2);
    assertNotSame(merged.getTaskId().getCreationDate(), t1.getTaskId().getCreationDate());
    assertNotSame(merged.getTaskId().getCreationDate(), t2.getTaskId().getCreationDate());
  }
View Full Code Here

  protected TaskFileEventType createTargetType() {
    TaskIdType id = new TaskIdType();
    id.setCreationDate(DatatypeUtil.toXmlDate(new LocalDate()));
    id.setHandleId("aTaskId");
   
    TaskFileEventType type = new TaskFileEventType();
    type.setDuration(129);
    type.setFilePath("helloWorld");
    type.setTaskId(id);
   
    return type;
  }
View Full Code Here

  protected TaskFileEventType createTargetTypeDiff() {
    TaskIdType id = new TaskIdType();
    id.setCreationDate(DatatypeUtil.toXmlDate(new LocalDate(1999, 1, 1)));
    id.setHandleId("1.2.3.4.5.6.7");
   
    TaskFileEventType type = new TaskFileEventType();
    type.setDuration(12119);
    type.setFilePath("0.9.8.7.6.");
    type.setTaskId(id);
   
    return type;
  }
View Full Code Here

public class TaskFileEventTypeMergerTest extends
    AbstractMergerTest<TaskFileEventType> {
 
  @Override
  public void testIsMergeable() throws Exception {
   TaskFileEventType t1 = createTargetType();
   TaskFileEventType t2 = createTargetType();
   assertTrue(merger.isMergeable(t1, t2));
  
   // Change the duration has no affect:
   t2.setDuration(t2.getDuration() + 1);
   assertTrue(merger.isMergeable(t1, t2));
  
   t2.setFilePath(t2.getFilePath() + "1");
   assertFalse(merger.isMergeable(t1, t2));
   t2.setFilePath(t1.getFilePath());
   assertTrue(merger.isMergeable(t1, t2));
  
   TaskIdType id2 = t2.getTaskId();
   id2.getCreationDate().setYear(id2.getCreationDate().getYear() + 1);
   assertFalse(merger.isMergeable(t1, t2));
   id2.getCreationDate().setYear(t1.getTaskId().getCreationDate().getYear());
   assertTrue(merger.isMergeable(t1, t2));
  
View Full Code Here

   assertFalse(merger.isMergeable(t1, t2));
  }

  @Test
  public void testIsMergeable_bothParamGetFileIdReturnsNull() {
    TaskFileEventType t1 = createTargetType();
    t1.setFilePath(null);
    TaskFileEventType t2 = createTargetType();
    t2.setFilePath(null);

    try {
      assertFalse(merger.isMergeable(t1, t2));
    } catch (Exception e) {
      fail("All null, not mergable, should return false instead of exception");
View Full Code Here

    }
  }

  @Test
  public void testIsMergeable_bothParamGetTaskIdGetCreationDateReturnsNull() {
    TaskFileEventType t1 = createTargetType();
    t1.getTaskId().setCreationDate(null);
    TaskFileEventType t2 = createTargetType();
    t2.getTaskId().setCreationDate(null);

    try {
      assertFalse(merger.isMergeable(t1, t2));
    } catch (Exception e) {
      fail("All null, not mergable, should return false instead of exception");
View Full Code Here

    }
  }
 
  @Test
  public void testIsMergeable_bothParamGetTaskIdGetHandleIdReturnsNull() {
    TaskFileEventType t1 = createTargetType();
    t1.getTaskId().setHandleId(null);
    TaskFileEventType t2 = createTargetType();
    t2.getTaskId().setHandleId(null);

    try {
      assertFalse(merger.isMergeable(t1, t2));
    } catch (Exception e) {
      fail("All null, not mergable, should return false instead of exception");
View Full Code Here

  public void testConvert() throws Exception {
    final ITask task = mock(ITask.class);
    given(task.getCreationDate()).willReturn(new Date());
    final TaskFileEvent event = new TaskFileEvent(
        new Interval(0, 1), new Path("/a/b"), task);
    final TaskFileEventType type = converter.convert(event);
   
    assertEquals(
        task.getHandleIdentifier(),
        type.getTaskId().getHandleId());
    assertEquals(
        task.getCreationDate(),
        type.getTaskId().getCreationDate().toGregorianCalendar().getTime());
    assertEquals(
        event.getInterval().toDurationMillis(),
        type.getDuration());
    assertEquals(
        event.getFilePath().toString(),
        type.getFilePath());
  }
View Full Code Here

TOP

Related Classes of rabbit.data.internal.xml.schema.events.TaskFileEventType

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.