Exemplo n.º 1
0
 @Override
 public boolean equals(Object obj) {
   if (obj == null) {
     return false;
   }
   if (obj instanceof ModificationRecordImpl) {
     ModificationRecordImpl that = (ModificationRecordImpl) obj;
     return Utils.equals(this.lastModified, that.lastModified)
         && Utils.equals(this.lastModifiedBy, that.lastModifiedBy);
   }
   return false;
 }
  /** Uint test for createParameter(properties). */
  @Test
  public void testCreateParameter() {
    Properties p = sample();
    String field1 = "field1"; // $NON-NLS-1$
    String field2 = "field2"; // $NON-NLS-1$
    String v1 = "value1"; // $NON-NLS-1$
    Integer v2 = 2;
    p.setProperty(field1, v1);
    p.setProperty(field2, v2.toString());

    BatchProcessParmFactoryImpl impl = new BatchProcessParmFactoryImpl();
    BatchProcessParm<Object> in = Utils.cast(impl.createParameter(p));
    assertNotNull(in);
    assertEquals(name, in.getName());
    assertEquals(threads, in.getInitialThreads());
    assertTrue(qc.isAssignableFrom(in.getQuery().getClass()));
    assertEquals(oc, in.getOperationClass());
    assertTrue(pre.isAssignableFrom(in.getPreProcessing().getClass()));
    assertTrue(post.isAssignableFrom(in.getPostProcessing().getClass()));
    assertEquals(ObjectFormatter.INSTANCE, in.getFormatter());

    Modification<Object> mod1 = in.getOperationParametersSetter();
    assertNotNull(mod1);
    Modification<Object> mod2 = in.getQueryParametersSetter();
    assertNotNull(mod2);
    Modification<Object> mod3 = in.getPreOperationParametersSetter();
    assertNotNull(mod3);
    Modification<Object> mod4 = in.getPostOperationParametersSetter();
    assertNotNull(mod4);

    assertNotEquals(mod1, mod2);
    assertNotEquals(mod1, mod3);
    assertNotEquals(mod1, mod4);
    assertNotEquals(mod2, mod3);
    assertNotEquals(mod2, mod4);
    assertNotEquals(mod3, mod4);

    assertEquals(interval, in.getMonitoringMailInterval());
    assertEquals(recipients, in.getMonitoringMailRecipients());
    assertEquals(canAddThreads, in.getUiCanAddThreads());
  }
Exemplo n.º 3
0
 @Override
 public int hashCode() {
   Object[] values = {lastModified, lastModifiedBy};
   return Utils.generateHashCode(values);
 }