Package org.springsource.loaded

Examples of org.springsource.loaded.TypeDelta


    type.loadNewVersion("2", retrieveRename(t, t + "2"));
    result = runConstructor(type.getClazz(), "");
    assertEquals("Hello", result.stdout);

    // should be no changes
    TypeDelta td = type.getLiveVersion().getTypeDelta();
    assertNotNull(td);
    assertFalse(td.hasAnythingChanged());
    assertNull(td.getChangedMethods());

    // this version changes the constructor
    type.loadNewVersion("3", retrieveRename(t, t + "3"));
    result = runConstructor(type.getClazz(), "");
    assertEquals("Goodbye", result.stdout);
    td = type.getLiveVersion().getTypeDelta();
    assertNotNull(td);
    assertTrue(td.hasAnythingChanged());
    Map<String, MethodDelta> changedMethods = td.getChangedMethods();
    assertNotNull(changedMethods);
    assertEquals(1, changedMethods.size());
    assertEquals("MethodDelta[method:<init>()V]", changedMethods.get("<init>()V").toString());
    MethodDelta md = changedMethods.get("<init>()V");
    assertTrue(md.hasAnyChanges());
View Full Code Here


public class TypeDeltaTests extends SpringLoadedTests {

  @Test
  public void typesAreTheSame() {
    byte[] bytes = loadBytesForClass("differs.DiffOne");
    TypeDelta td = TypeDiffComputer.computeDifferences(bytes, bytes);
    assertFalse(td.hasAnythingChanged());
  }
View Full Code Here

  @Test
  public void basicTypeLevelChanges() {
    byte[] bytes = loadBytesForClass("differs.DiffOne");
    byte[] bytes2 = retrieveRename("differs.DiffOne", "differs.DiffOneX");
    TypeDelta td = TypeDiffComputer.computeDifferences(bytes, bytes2);
    assertTrue(td.hasAnythingChanged());
    assertTrue(td.hasTypeDeclarationChanged());
    assertTrue(td.hasTypeAccessChanged());
    assertTrue(Modifier.isPublic(td.oAccess));
    assertTrue(!Modifier.isPublic(td.nAccess));
  }
View Full Code Here

  @Test
  public void basicTypeLevelChanges2() {
    byte[] bytes = loadBytesForClass("differs.DiffOne");
    byte[] bytes2 = retrieveRename("differs.DiffOne", "differs.DiffOneY");
    TypeDelta td = TypeDiffComputer.computeDifferences(bytes, bytes2);
    assertTrue(td.hasAnythingChanged());
    assertTrue(td.hasTypeDeclarationChanged());
    assertTrue(td.hasTypeInterfacesChanged());
    assertEquals(0, td.oInterfaces.size());
    assertEquals("java/io/Serializable", td.nInterfaces.get(0));
  }
View Full Code Here

  @Test
  public void basicTypeLevelChanges3() {
    byte[] bytes = loadBytesForClass("differs.DiffThree");
    byte[] bytes2 = retrieveRename("differs.DiffThreeZ", "differs.DiffThreeX");
    TypeDelta td = TypeDiffComputer.computeDifferences(bytes, bytes2);
    assertTrue(td.hasAnythingChanged());
    assertTrue(td.hasTypeNameChanged());
    assertTrue(td.hasTypeSupertypeChanged());
    assertTrue(td.hasTypeInterfacesChanged());
    assertEquals(1, td.nInterfaces.size());
    assertFalse(td.hasTypeAccessChanged());
    assertFalse(td.haveFieldsChanged());
    assertFalse(td.haveFieldsChangedOrBeenAddedOrRemoved());
    assertFalse(td.hasTypeSignatureChanged());
    // As of May-2011 generic signature change is not a change
    //    byte[] bytes3 = retrieveRename("differs.DiffThreeYY", "differs.DiffThreeY");
    //    td = TypeDiffComputer.computeDifferences(bytes, bytes3);
    //    assertTrue(td.hasTypeSignatureChanged());
  }
View Full Code Here

  @Test
  public void addedAField() {
    byte[] bytes = loadBytesForClass("differs.DiffOne");
    byte[] bytes2 = retrieveRename("differs.DiffOne", "differs.DiffOneZ");
    TypeDelta td = TypeDiffComputer.computeDifferences(bytes, bytes2);
    assertTrue(td.hasAnythingChanged());
    assertFalse(td.hasTypeNameChanged());
    assertFalse(td.hasTypeSupertypeChanged());
    assertFalse(td.hasTypeInterfacesChanged());
    assertFalse(td.hasTypeDeclarationChanged());
    assertTrue(td.haveFieldsChangedOrBeenAddedOrRemoved());
    assertTrue(td.hasNewFields());
    assertEquals(1, td.getNewFields().size());
    assertEquals("public I newIntField", Utils.fieldNodeFormat(td.getNewFields().get("newIntField")));
  }
View Full Code Here

  @Test
  public void removedAField() {
    byte[] bytes = loadBytesForClass("differs.DiffTwo");
    byte[] bytes2 = retrieveRename("differs.DiffTwo", "differs.DiffTwoX");
    TypeDelta td = TypeDiffComputer.computeDifferences(bytes, bytes2);
    assertTrue(td.hasAnythingChanged());
    assertFalse(td.hasTypeDeclarationChanged());
    assertTrue(td.haveFieldsChangedOrBeenAddedOrRemoved());
    assertTrue(td.hasLostFields());
    assertEquals(1, td.getLostFields().size());
    assertEquals("public I anIntField", Utils.fieldNodeFormat(td.getLostFields().get("anIntField")));
  }
View Full Code Here

  @Test
  public void changedAFieldType() {
    byte[] bytes = loadBytesForClass("differs.DiffTwo");
    byte[] bytes2 = retrieveRename("differs.DiffTwo", "differs.DiffTwoY");
    TypeDelta td = TypeDiffComputer.computeDifferences(bytes, bytes2);
    assertTrue(td.hasAnythingChanged());
    assertFalse(td.hasTypeDeclarationChanged());
    assertTrue(td.haveFieldsChangedOrBeenAddedOrRemoved());
    assertFalse(td.hasLostFields());
    assertFalse(td.hasNewFields());
    assertTrue(td.haveFieldsChanged());
    assertEquals(1, td.getChangedFields().size());
    assertEquals("FieldDelta[field:anIntField type:I>Ljava/lang/String;]", td.getChangedFields().get("anIntField").toString());
  }
View Full Code Here

  @Test
  public void changedAFieldAccess() {
    byte[] bytes = loadBytesForClass("differs.DiffTwo");
    byte[] bytes2 = retrieveRename("differs.DiffTwo", "differs.DiffTwoZ");
    TypeDelta td = TypeDiffComputer.computeDifferences(bytes, bytes2);
    assertTrue(td.hasAnythingChanged());
    assertFalse(td.hasTypeDeclarationChanged());
    assertTrue(td.haveFieldsChangedOrBeenAddedOrRemoved());
    assertFalse(td.hasLostFields());
    assertFalse(td.hasNewFields());
    assertTrue(td.haveFieldsChanged());
    assertEquals(1, td.getChangedFields().size());
    assertEquals("FieldDelta[field:anIntField access:1>2]", td.getChangedFields().get("anIntField").toString());
  }
View Full Code Here

  @Test
  public void changedFieldAnnotations() {
    byte[] bytes = loadBytesForClass("differs.AnnotFields");
    byte[] bytes2 = retrieveRename("differs.AnnotFields", "differs.AnnotFields2");
    TypeDelta td = TypeDiffComputer.computeDifferences(bytes, bytes2);
    assertTrue(td.hasAnythingChanged());
    assertFalse(td.hasTypeDeclarationChanged());
    assertTrue(td.haveFieldsChangedOrBeenAddedOrRemoved());
    assertFalse(td.hasLostFields());
    assertFalse(td.hasNewFields());
    assertTrue(td.haveFieldsChanged());
    assertEquals(1, td.getChangedFields().size());
    assertEquals("FieldDelta[field:i annotations:-differs/Annot]", td.getChangedFields().get("i").toString());
  }
View Full Code Here

TOP

Related Classes of org.springsource.loaded.TypeDelta

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.