Updated Branches:
  refs/heads/sandbox/wicket-4812-serialize-object-check 8245be7a0 -> c75daba75


WICKET-4812 Make SerializationChecker easier for extending so custom checks can 
be added to it

Add unit test for OrphanComponentChecker and Apache licence headers


Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/c75daba7
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/c75daba7
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/c75daba7

Branch: refs/heads/sandbox/wicket-4812-serialize-object-check
Commit: c75daba75ebfab3184a52bf7229bb0c60260a66d
Parents: 8245be7
Author: Martin Tzvetanov Grigorov <mgrigo...@apache.org>
Authored: Mon Oct 15 11:24:00 2012 +0200
Committer: Martin Tzvetanov Grigorov <mgrigo...@apache.org>
Committed: Mon Oct 15 11:24:00 2012 +0200

----------------------------------------------------------------------
 .../objects/checker/AbstractObjectChecker.java     |   16 +++++
 .../core/util/objects/checker/IObjectChecker.java  |    9 +++
 .../objects/checker/OrphanComponentChecker.java    |   16 +++++
 .../objects/checker/AbstractObjectCheckerTest.java |   16 +++++
 .../checker/OrphanComponentCheckerTest.java        |   44 +++++++++++++++
 5 files changed, 101 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/c75daba7/wicket-core/src/main/java/org/apache/wicket/core/util/objects/checker/AbstractObjectChecker.java
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/main/java/org/apache/wicket/core/util/objects/checker/AbstractObjectChecker.java
 
b/wicket-core/src/main/java/org/apache/wicket/core/util/objects/checker/AbstractObjectChecker.java
index 2684d0d..eb2f8ec 100644
--- 
a/wicket-core/src/main/java/org/apache/wicket/core/util/objects/checker/AbstractObjectChecker.java
+++ 
b/wicket-core/src/main/java/org/apache/wicket/core/util/objects/checker/AbstractObjectChecker.java
@@ -1,3 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package org.apache.wicket.core.util.objects.checker;
 
 import java.util.List;

http://git-wip-us.apache.org/repos/asf/wicket/blob/c75daba7/wicket-core/src/main/java/org/apache/wicket/core/util/objects/checker/IObjectChecker.java
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/main/java/org/apache/wicket/core/util/objects/checker/IObjectChecker.java
 
b/wicket-core/src/main/java/org/apache/wicket/core/util/objects/checker/IObjectChecker.java
index b1a2d67..49685eb 100644
--- 
a/wicket-core/src/main/java/org/apache/wicket/core/util/objects/checker/IObjectChecker.java
+++ 
b/wicket-core/src/main/java/org/apache/wicket/core/util/objects/checker/IObjectChecker.java
@@ -99,6 +99,15 @@ public interface IObjectChecker
                        this.reason = reason;
                        this.cause = cause;
                }
+
+               @Override
+               public String toString()
+               {
+                       return "Result{" +
+                                       "reason='" + reason + '\'' +
+                                       ", status=" + status +
+                                       '}';
+               }
        }
 
        /**

http://git-wip-us.apache.org/repos/asf/wicket/blob/c75daba7/wicket-core/src/main/java/org/apache/wicket/core/util/objects/checker/OrphanComponentChecker.java
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/main/java/org/apache/wicket/core/util/objects/checker/OrphanComponentChecker.java
 
b/wicket-core/src/main/java/org/apache/wicket/core/util/objects/checker/OrphanComponentChecker.java
index a2acbe8..e3f694b 100644
--- 
a/wicket-core/src/main/java/org/apache/wicket/core/util/objects/checker/OrphanComponentChecker.java
+++ 
b/wicket-core/src/main/java/org/apache/wicket/core/util/objects/checker/OrphanComponentChecker.java
@@ -1,3 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package org.apache.wicket.core.util.objects.checker;
 
 import java.util.List;

http://git-wip-us.apache.org/repos/asf/wicket/blob/c75daba7/wicket-core/src/test/java/org/apache/wicket/core/util/objects/checker/AbstractObjectCheckerTest.java
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/test/java/org/apache/wicket/core/util/objects/checker/AbstractObjectCheckerTest.java
 
b/wicket-core/src/test/java/org/apache/wicket/core/util/objects/checker/AbstractObjectCheckerTest.java
index 0c8d7eb..6f8182c 100644
--- 
a/wicket-core/src/test/java/org/apache/wicket/core/util/objects/checker/AbstractObjectCheckerTest.java
+++ 
b/wicket-core/src/test/java/org/apache/wicket/core/util/objects/checker/AbstractObjectCheckerTest.java
@@ -1,3 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package org.apache.wicket.core.util.objects.checker;
 
 import java.util.Arrays;

http://git-wip-us.apache.org/repos/asf/wicket/blob/c75daba7/wicket-core/src/test/java/org/apache/wicket/core/util/objects/checker/OrphanComponentCheckerTest.java
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/test/java/org/apache/wicket/core/util/objects/checker/OrphanComponentCheckerTest.java
 
b/wicket-core/src/test/java/org/apache/wicket/core/util/objects/checker/OrphanComponentCheckerTest.java
new file mode 100644
index 0000000..cad9387
--- /dev/null
+++ 
b/wicket-core/src/test/java/org/apache/wicket/core/util/objects/checker/OrphanComponentCheckerTest.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.core.util.objects.checker;
+
+import org.apache.wicket.TestPage_1;
+import org.apache.wicket.WicketTestCase;
+import org.apache.wicket.markup.html.WebComponent;
+import org.apache.wicket.markup.html.WebPage;
+import org.junit.Test;
+
+/**
+ * Tests for OrphanComponentChecker
+ */
+public class OrphanComponentCheckerTest extends WicketTestCase
+{
+       @Test
+       public void checkOrphanComponent()
+       {
+               WebComponent component = new WebComponent("a");
+               IObjectChecker checker = new OrphanComponentChecker();
+               IObjectChecker.Result result = checker.check(component);
+               assertEquals(IObjectChecker.Result.Status.FAILURE, 
result.status);
+               assertEquals("A component without a parent is detected.", 
result.reason);
+
+               WebPage parent = new TestPage_1();
+               parent.add(component);
+               IObjectChecker.Result result2 = checker.check(component);
+               assertEquals(IObjectChecker.Result.SUCCESS, result2);
+       }
+}

Reply via email to