harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smish...@apache.org
Subject svn commit: r426458 - in /incubator/harmony/enhanced/classlib/trunk/modules/security/src/test: api/java.injected/java/security/serialization/ resources/java/security/serialization/ support/common/java/org/apache/harmony/security/tests/support/
Date Fri, 28 Jul 2006 09:48:22 GMT
Author: smishura
Date: Fri Jul 28 02:48:21 2006
New Revision: 426458

URL: http://svn.apache.org/viewvc?rev=426458&view=rev
Log:
Refactoring GuardObject serialization test - use support test class

Added:
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/support/common/java/org/apache/harmony/security/tests/support/MyGuard.java
  (with props)
Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/serialization/GuardedObjectTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/resources/java/security/serialization/GuardedObjectTest.2.dat

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/serialization/GuardedObjectTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/serialization/GuardedObjectTest.java?rev=426458&r1=426457&r2=426458&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/serialization/GuardedObjectTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/serialization/GuardedObjectTest.java
Fri Jul 28 02:48:21 2006
@@ -23,15 +23,13 @@
 
 import java.io.ByteArrayOutputStream;
 import java.io.Serializable;
-import java.security.Guard;
 import java.security.GuardedObject;
 
+import org.apache.harmony.security.tests.support.MyGuard;
 import org.apache.harmony.testframework.serialization.SerializationTest;
 
-
 /**
  * Serialization tests for <code>GuardedObject</code>
- * 
  */
 
 public class GuardedObjectTest extends SerializationTest implements
@@ -43,7 +41,7 @@
     protected Object[] getData() {
         return new Object[] { new GuardedObject(null, null),
                 new GuardedObject("dsgdfg", null),
-                new GuardedObject(new Integer(76547), new RealGuard(true)), };
+                new GuardedObject(new Integer(76547), new MyGuard(true)), };
     }
 
     public void assertDeserialized(Serializable golden, Serializable test) {
@@ -54,25 +52,10 @@
 
     public void testDisableGuard() throws Throwable {
         try {
-            putObjectToStream(new GuardedObject(null, new RealGuard(false)),
+            putObjectToStream(new GuardedObject(null, new MyGuard(false)),
                     new ByteArrayOutputStream());
             fail("Should not serialize if guard denies access");
         }
         catch (SecurityException ok) {}
     }
 }
-
-class RealGuard implements Guard, Serializable {
-
-    final boolean enabled;
-
-    public RealGuard(boolean state) {
-        enabled = state;
-    }
-
-    public void checkGuard(Object object) {
-        if (!enabled) {
-            throw new SecurityException();
-        }
-    }
-}
\ No newline at end of file

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/resources/java/security/serialization/GuardedObjectTest.2.dat
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/resources/java/security/serialization/GuardedObjectTest.2.dat?rev=426458&r1=426457&r2=426458&view=diff
==============================================================================
Binary files - no diff available.

Added: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/support/common/java/org/apache/harmony/security/tests/support/MyGuard.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/support/common/java/org/apache/harmony/security/tests/support/MyGuard.java?rev=426458&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/support/common/java/org/apache/harmony/security/tests/support/MyGuard.java
(added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/support/common/java/org/apache/harmony/security/tests/support/MyGuard.java
Fri Jul 28 02:48:21 2006
@@ -0,0 +1,35 @@
+/*
+ *  Copyright 2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed 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.harmony.security.tests.support;
+
+import java.io.Serializable;
+import java.security.Guard;
+
+public class MyGuard implements Guard, Serializable {
+
+    final boolean enabled;
+
+    public MyGuard(boolean state) {
+        enabled = state;
+    }
+
+    public void checkGuard(Object object) {
+        if (!enabled) {
+            throw new SecurityException();
+        }
+    }
+}

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/support/common/java/org/apache/harmony/security/tests/support/MyGuard.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message