Package org.wicketstuff.pageserializer.common.analyze

Examples of org.wicketstuff.pageserializer.common.analyze.ISerializedObjectTree


public class TreeTypeMapTest {

  @Test
  public void joinLabels() throws IOException {
    ISerializedObjectTree source = Trees.fromResource(getClass(), "labels");
    Assert.assertEquals("a|b|c", TreeTypeMap.allLables(source.children()));
  }
View Full Code Here


    Assert.assertEquals(null, TreeTypeMap.allLables(new ArrayList<ISerializedObjectTree>()));
  }
 
  @Test
  public void compressNothing() throws IOException {
    ISerializedObjectTree source = Trees.fromResource(getClass(), "compress");
    ISerializedObjectTree match= Trees.fromResource(getClass(), "compressed");
//    ISerializedObjectTree compressed = TreeTypeMap.compress(source.children());
    ISerializedObjectTree compressed = SimilarNodeTreeTransformator.transformTree(source);
    Trees.assertEqualsTree(match, compressed);
  }
View Full Code Here

{

  @Test
  public void compactWithNoChange() throws IOException
  {
    ISerializedObjectTree tree = Trees.fromResource(getClass(), "treeOf3");
    ISerializedObjectTree filtered = TreeTransformations.compact(tree, new AcceptAll());

    Trees.assertEqualsTree(tree, filtered);
    Assert.assertTrue(tree == filtered);
  }
View Full Code Here

  }

  @Test
  public void removeAllNodesDeeperThan2() throws IOException
  {
    ISerializedObjectTree tree = Trees.fromResource(getClass(), "treeOf3");

    ISerializedObjectTree filtered = TreeTransformations.compact(tree, new MaxDepth(2));

    ISerializedObjectTree expected = Trees.fromResource(getClass(), "treeOf3-maxDepth1");
   
    Trees.assertEqualsTree(expected, filtered);
  }
View Full Code Here

  }

  @Test
  public void removeAllBNodes() throws IOException
  {
    ISerializedObjectTree tree = Trees.fromResource(getClass(), "treeOf3");

    ISerializedObjectTree filtered = TreeTransformations.strip(tree, new NotDepth(2));

    ISerializedObjectTree expected = Trees.fromResource(getClass(), "treeOf3-noDepth2");
   
    Trees.assertEqualsTree(expected, filtered);
  }
View Full Code Here

  }

  @Test
  public void removeAllCNodes() throws IOException
  {
    ISerializedObjectTree tree = Trees.fromResource(getClass(), "treeOf3");

    ISerializedObjectTree filtered = TreeTransformations.strip(tree, new NotDepth(3));

    ISerializedObjectTree expected = Trees.fromResource(getClass(), "treeOf3-noDepth3");
   
    Trees.assertEqualsTree(expected, filtered);
  }
View Full Code Here

  }
 
  @Test(expected=IllegalArgumentException.class)
  public void canNotRemoveANodes() throws IOException
  {
    ISerializedObjectTree tree = Trees.fromResource(getClass(), "treeOf3");

    ISerializedObjectTree filtered = TreeTransformations.strip(tree, new NotDepth(0));
  }
View Full Code Here

public class TreeTypeTest {

  @Test
  public void notEqual() throws IOException {
    ISerializedObjectTree source = Trees.fromResource(getClass(), "notEqual");
    ISerializedObjectTree match= Trees.fromResource(getClass(), "notEqual-match");
    TreeType sourceType=new TreeType(source);
    TreeType matchType=new TreeType(match);
    Assert.assertFalse(matchType.equals(sourceType));
    Assert.assertFalse(matchType.compareTo(sourceType)==0);
  }
View Full Code Here

    Assert.assertFalse(matchType.compareTo(sourceType)==0);
  }

  @Test
  public void equal() throws IOException {
    ISerializedObjectTree source = Trees.fromResource(getClass(), "equal");
    ISerializedObjectTree match= Trees.fromResource(getClass(), "equal-match");
    TreeType sourceType=new TreeType(source);
    TreeType matchType=new TreeType(match);
    Assert.assertEquals(matchType,sourceType);
    Assert.assertTrue(matchType.compareTo(sourceType)==0);
  }
View Full Code Here

      + "          java.lang.String                                         |     4\n"
      + "          java.lang.String                                         |     4\n"
      + "      java.lang.Integer                                            |     1\n"
      + "  org.apache.wicket.request.mapper.parameter.PageParameters        |     3";

    ISerializedObjectTree sample = TreeReader.fromString(lines);

    Assert.assertEquals("0", sample.label());
    Assert.assertEquals(141, sample.size());
    Assert.assertEquals(146, sample.childSize());

    Assert.assertEquals(ListModel.class, sample.children()
      .get(1)
      .children()
      .get(0)
      .children()
      .get(0)
View Full Code Here

TOP

Related Classes of org.wicketstuff.pageserializer.common.analyze.ISerializedObjectTree

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.