Author: dpfister
Date: Tue Mar 29 06:31:24 2005
New Revision: 159377
URL: http://svn.apache.org/viewcvs?view=rev&rev=159377
Log:
eol-style missing
Added:
incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/core/state/ChangeLogTest.java
(with props)
incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/core/state/TestAll.java (with
props)
Added: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/core/state/ChangeLogTest.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/core/state/ChangeLogTest.java?view=auto&rev=159377
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/core/state/ChangeLogTest.java
(added)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/core/state/ChangeLogTest.java
Tue Mar 29 06:31:24 2005
@@ -0,0 +1,94 @@
+/*
+ * Copyright 2004-2005 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.jackrabbit.core.state;
+
+import org.apache.jackrabbit.test.AbstractJCRTest;
+import org.apache.jackrabbit.core.QName;
+
+import java.util.Iterator;
+
+/**
+ * <code>ChangeLogTest</code> contains the test cases for the methods
+ * inside {@link org.apache.jackrabbit.core.state.ChangeLog}.
+ */
+public class ChangeLogTest extends AbstractJCRTest {
+
+ /**
+ * Add an item state and then delete it. Make sure there is no
+ * entry in either the added nor the removed states
+ */
+ public void testAddDelete() throws Exception {
+ ItemState state = new PropertyState(new QName("", "a"), "",
+ ItemState.STATUS_NEW, false);
+
+ ChangeLog log = new ChangeLog();
+
+ log.added(state);
+ log.deleted(state);
+
+ Iterator iter = log.addedStates();
+ assertFalse("State not in added collection", iter.hasNext());
+ iter = log.deletedStates();
+ assertFalse("State not in deleted collection", iter.hasNext());
+ }
+
+ /**
+ * Add an item state and then modify it. Make sure the entry is still
+ * in the added states.
+ */
+ public void testAddModify() throws Exception {
+ ItemState state = new PropertyState(new QName("", "a"), "",
+ ItemState.STATUS_NEW, false);
+
+ ChangeLog log = new ChangeLog();
+
+ log.added(state);
+ log.modified(state);
+
+ Iterator iter = log.addedStates();
+ assertTrue("State still in added collection", iter.hasNext());
+ iter = log.modifiedStates();
+ assertFalse("State not in modified collection", iter.hasNext());
+ }
+
+ /**
+ * Add some item states. Retrieve them again and make sure the order is
+ * preserved.
+ */
+ public void testPreserveOrder() throws Exception {
+ ItemState[] states = new ItemState[10];
+ for (int i = 0; i < states.length; i++) {
+ states[i] = new PropertyState(new QName("", "a" + i), "",
+ ItemState.STATUS_NEW, false);
+ }
+
+ ChangeLog log = new ChangeLog();
+
+ for (int i = 0; i < states.length; i++) {
+ log.added(states[i]);
+ }
+
+ Iterator iter = log.addedStates();
+ int i = 0;
+
+ while (iter.hasNext()) {
+ ItemState state = (ItemState) iter.next();
+ assertTrue("Added states preserve order.",
+ state.equals(states[i++]));
+ }
+ }
+}
Propchange: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/core/state/ChangeLogTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/core/state/TestAll.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/core/state/TestAll.java?view=auto&rev=159377
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/core/state/TestAll.java (added)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/core/state/TestAll.java Tue
Mar 29 06:31:24 2005
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2004-2005 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.jackrabbit.core.state;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/**
+ * Test suite that includes all testcases for the State module.
+ */
+public class TestAll extends TestCase {
+
+ /**
+ * Returns a <code>Test</code> suite that executes all tests inside this
+ * package.
+ *
+ * @return a <code>Test</code> suite that executes all tests inside this
+ * package.
+ */
+ public static Test suite() {
+ TestSuite suite = new TestSuite("State tests");
+
+ suite.addTestSuite(ChangeLogTest.class);
+
+ return suite;
+ }
+}
Propchange: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/core/state/TestAll.java
------------------------------------------------------------------------------
svn:eol-style = native
|