Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

tree reader fix

  • Loading branch information...
commit e0501a53e24316e4459116a8be43cb8cf3518e9f 1 parent 371d571
@michaelmosmann michaelmosmann authored
View
5 .../src/main/java/org/wicketstuff/pageserializer/kryo2/inspecting/analyze/ImmutableTree.java
@@ -93,4 +93,9 @@ public String label()
{
return children;
}
+
+ @Override
+ public String toString() {
+ return "#"+id+" "+type+"("+label+") ["+children().size()+"]";
+ }
}
View
8 ...kryo2/inspecting/analyze/report/SimilarNodeTreeTransformatorTest-nodeChildSize-match.tree
@@ -0,0 +1,8 @@
+.TestTreeTransformator$Root(asSample) | 1
+ .TestTreeTransformator$A | 0
+ .TestTreeTransformator$B | 0
+ .TestTreeTransformator$A | 0
+ .TestTreeTransformator$B | 0
+ .TestTreeTransformator$B | 0
+ .TestTreeTransformator$C | 0
+
View
8 ...lizer/kryo2/inspecting/analyze/report/SimilarNodeTreeTransformatorTest-nodeChildSize.tree
@@ -0,0 +1,8 @@
+.TestTreeTransformator$Root(asSample) | 1
+ .TestTreeTransformator$A | 0
+ .TestTreeTransformator$B | 0
+ .TestTreeTransformator$A | 0
+ .TestTreeTransformator$B | 0
+ .TestTreeTransformator$B | 0
+ .TestTreeTransformator$C | 0
+
View
18 ...tuff/pageserializer/kryo2/inspecting/analyze/report/SimilarNodeTreeTransformatorTest.java
@@ -105,6 +105,19 @@ public void testCompression() throws IOException {
}
@Test
+ public void secondNodeHasMoreChilds() throws IOException {
+ ISerializedObjectTree source = Trees.fromResource(getClass(), "nodeChildSize");
+ Assert.assertEquals("asSample", source.label());
+ new TreeSizeReport().process(source);
+ ISerializedObjectTree result = SimilarNodeTreeTransformator.transformTree(source);
+ new TreeSizeReport().process(result);
+ ISerializedObjectTree match = Trees.fromResource(getClass(), "nodeChildSize-match");
+ new TreeSizeReport().process(match);
+
+ Trees.assertEqualsTree(match, result);
+ }
+
+ @Test
public void testTreeType() throws IOException {
ISerializedObjectTree sourceA = Trees.fromResource(getClass(), "treeType-A");
ISerializedObjectTree sourceB = Trees.fromResource(getClass(), "treeType-B");
@@ -162,4 +175,9 @@ public void testTreeType() throws IOException {
{
}
+
+ static class D
+ {
+
+ }
}
View
16 .../test/java/org/wicketstuff/pageserializer/kryo2/inspecting/analyze/report/TreeReader.java
@@ -80,17 +80,12 @@ public static ISerializedObjectTree fromString(String asString)
parent.children.add(sub);
parent=sub;
} else {
- if (l.indent<last.indent) {
- parent=parent.parent.parent;
- IndentedLines sub=new IndentedLines(parent,l);
- parent.children.add(sub);
- parent=sub;
- } else {
+ for (int i=0,s=last.indent-l.indent;i<=s;i++) {
parent=parent.parent;
- IndentedLines sub=new IndentedLines(parent,l);
- parent.children.add(sub);
- parent=sub;
}
+ IndentedLines sub=new IndentedLines(parent,l);
+ parent.children.add(sub);
+ parent=sub;
}
last=l;
}
@@ -161,6 +156,9 @@ public Line(String textLine)
{
try
{
+ if (typeName.startsWith(".")) {
+ typeName=TreeReader.class.getPackage().getName()+typeName;
+ }
return Class.forName(typeName);
}
catch (ClassNotFoundException e)
Please sign in to comment.
Something went wrong with that request. Please try again.