Author: sergiykarpenko
Date: 2009-12-10 05:30:50 -0500 (Thu, 10 Dec 2009)
New Revision: 981
Added:
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/usecases/TestValueReplication.java
Modified:
jcr/branches/1.12.0-JBC/component/core/known-issues.txt
jcr/branches/1.12.0-JBC/component/core/pom.xml
Log:
EXOJCR-264: TestValueReplication added
Modified: jcr/branches/1.12.0-JBC/component/core/known-issues.txt
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/known-issues.txt 2009-12-10 10:23:17 UTC (rev
980)
+++ jcr/branches/1.12.0-JBC/component/core/known-issues.txt 2009-12-10 10:30:50 UTC (rev
981)
@@ -2,5 +2,5 @@
//
https://jira.jboss.org/jira/browse/EXOJCR-193
org.exoplatform.services.jcr.impl.core.query.TestSimilarity.java
-//https://jira.jboss.org/jira/browse/EXOJCR-192
-org.exoplatform.services.jcr.api.core.query.lucene.spell.SpellCheckerTest.java
\ No newline at end of file
+//
https://jira.jboss.org/jira/browse/EXOJCR-264 - there is IOException under Windows
+org/exoplatform/services/jcr/usecases/TestValueReplication.java
\ No newline at end of file
Modified: jcr/branches/1.12.0-JBC/component/core/pom.xml
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/pom.xml 2009-12-10 10:23:17 UTC (rev 980)
+++ jcr/branches/1.12.0-JBC/component/core/pom.xml 2009-12-10 10:30:50 UTC (rev 981)
@@ -346,6 +346,7 @@
<include>org/exoplatform/services/jcr/impl/**/Test*.java</include>
</includes>
<excludes>
+
<exclude>org/exoplatform/services/jcr/usecases/TestValueReplication.java</exclude>
<exclude>org/exoplatform/services/jcr/**/TestQueryUsecases.java</exclude>
<exclude>org/exoplatform/services/jcr/**/TestImport.java</exclude>
<exclude>org/exoplatform/services/jcr/**/TestRollbackBigFiles.java</exclude>
@@ -368,9 +369,9 @@
<exclude>org/exoplatform/services/jcr/**/usecases/**/TestQueryWithNumberAndSpace.java</exclude>
<exclude>org/exoplatform/services/jcr/**/usecases/BaseUsecasesTest.java</exclude>
<exclude>org/exoplatform/services/jcr/**/api/**/TestSameNameItems.java</exclude>
-
<exclude>org/exoplatform/services/jcr/**/api/**/TestVersionRestore.java</exclude>
+
<exclude>org/exoplatform/services/jcr/**/api/**/TestVersionRestore.java</exclude>
<exclude>org/exoplatform/services/jcr/**/impl/**/TestLinkedWorkspaceStorageCache.java</exclude>
-
<exclude>org/exoplatform/services/jcr/**/impl/**/TestLinkedWorkspaceStorageCacheMetrics.java</exclude>
+
<exclude>org/exoplatform/services/jcr/**/impl/**/TestLinkedWorkspaceStorageCacheMetrics.java</exclude>
<exclude>org/exoplatform/services/jcr/**/impl/**/TestSessionDataManager.java</exclude>
</excludes>
</configuration>
Added:
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/usecases/TestValueReplication.java
===================================================================
---
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/usecases/TestValueReplication.java
(rev 0)
+++
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/usecases/TestValueReplication.java 2009-12-10
10:30:50 UTC (rev 981)
@@ -0,0 +1,172 @@
+/*
+ * Copyright (C) 2003-2009 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not,
see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.services.jcr.usecases;
+
+import java.io.File;
+import java.io.FileInputStream;
+
+import javax.jcr.Node;
+
+/**
+ * Created by The eXo Platform SAS.
+ *
+ * <br/>Date:
+ *
+ * @author <a href="karpenko.sergiy(a)gmail.com">Karpenko Sergiy</a>
+ * @version $Id: TestValueReplication.java 111 2008-11-11 11:11:11Z serg $
+ */
+public class TestValueReplication extends BaseUsecasesTest
+{
+ private final int NODE_COUNT = 1;
+
+ private final String NODE_NAME = "repTestNode";
+
+ private final String PROP_NAME = "repTestNode";
+
+ public void setUp() throws Exception
+ {
+
+ // Fqn fqn = new Fqn("/");
+ // String rep = fqn.getLastElementAsString();
+ //
+ // boolean eq = fqn.getLastElementAsString().equals("/");
+ //
+ // fqn = Fqn.ROOT;
+ //
+ // rep = fqn.getLastElementAsString();
+ // eq = fqn.getLastElementAsString().equals("/");
+
+ // System.out.println("Enter 'x' to start ...");
+ // boolean shutdown = false;
+ // Object obj = new Object();
+ // while (!shutdown)
+ // {
+ // int ch = System.in.read();
+ // if (ch == 'x' || ch == 'X')
+ // {
+ // shutdown = true;
+ // }
+ //
+ // synchronized (obj)
+ // {
+ // obj.wait(20);
+ // }
+ // }
+
+ super.setUp();
+ }
+
+ public void testAdd() throws Exception
+ {
+ // System.out.println("Enter 'x' to add nodes...");
+ // boolean shutdown = false;
+ // Object obj = new Object();
+ // while (!shutdown)
+ // {
+ // int ch = System.in.read();
+ // if (ch == 'x' || ch == 'X')
+ // {
+ // shutdown = true;
+ // }
+ //
+ // synchronized (obj)
+ // {
+ // obj.wait(20);
+ // }
+ // }
+
+ File src = this.createBLOBTempFile(1024 * 1024);
+ //File src = new File("f:\\test.avi");
+
+ // add all
+ for (int i = 0; i < NODE_COUNT; i++)
+ {
+ Node n = root.addNode(NODE_NAME + i, "nt:unstructured");
+ n.setProperty(PROP_NAME, new FileInputStream(src));
+ root.save();
+ System.out.println("Node " + NODE_NAME + i + " added.");
+ }
+ }
+
+ /* public void testRead() throws Exception
+ {
+ System.out.println("Enter 'x' to read nodes...");
+ boolean shutdown = false;
+ Object obj = new Object();
+ while (!shutdown)
+ {
+ int ch = System.in.read();
+ if (ch == 'x' || ch == 'X')
+ {
+ shutdown = true;
+ }
+
+ synchronized (obj)
+ {
+ obj.wait(20);
+ }
+ }
+
+ File src = this.createBLOBTempFile(15 * 1024);
+
+ // add all
+ for (int i = 0; i < NODE_COUNT; i++)
+ {
+
+ if (root.hasNode(NODE_NAME + i))
+ {
+ Node n = root.getNode(NODE_NAME + i);
+ Property prop = n.getProperty(PROP_NAME);
+ InputStream in = prop.getValue().getStream();
+
+ byte[] testbuf = new byte[1024];
+ if (in.read(testbuf) != 1024)
+ {
+ System.out.println("FAIL. Node " + NODE_NAME + i + "
unexpected content.");
+ }
+
+ System.out.println("Node " + NODE_NAME + i + "
readeded.");
+ }
+ else
+ {
+ System.out.println("FAIL. Node " + NODE_NAME + i + " not
found.");
+ }
+ }
+ }
+ */
+ public void tearDown() throws Exception
+ {
+ // System.out.println("Enter 'x' to stop JCR ...");
+ // boolean shutdown = false;
+ // Object obj = new Object();
+ // while (!shutdown)
+ // {
+ // int ch = System.in.read();
+ // if (ch == 'x' || ch == 'X')
+ // {
+ // shutdown = true;
+ // }
+ //
+ // synchronized (obj)
+ // {
+ // obj.wait(20);
+ // }
+ // }
+ super.tearDown();
+ }
+
+}