Author: tomekr
Date: Mon Sep 5 08:29:06 2016
New Revision: 1759207
URL: http://svn.apache.org/viewvc?rev=1759207&view=rev
Log:
OAK-4748: Migration tool should check if the source and destination
repositories are different
Added:
jackrabbit/oak/trunk/oak-upgrade/src/test/java/org/apache/jackrabbit/oak/upgrade/cli/parser/
jackrabbit/oak/trunk/oak-upgrade/src/test/java/org/apache/jackrabbit/oak/upgrade/cli/parser/StoreArgumentsTest.java
Modified:
jackrabbit/oak/trunk/oak-upgrade/src/main/java/org/apache/jackrabbit/oak/upgrade/cli/parser/StoreArguments.java
Modified:
jackrabbit/oak/trunk/oak-upgrade/src/main/java/org/apache/jackrabbit/oak/upgrade/cli/parser/StoreArguments.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-upgrade/src/main/java/org/apache/jackrabbit/oak/upgrade/cli/parser/StoreArguments.java?rev=1759207&r1=1759206&r2=1759207&view=diff
==============================================================================
---
jackrabbit/oak/trunk/oak-upgrade/src/main/java/org/apache/jackrabbit/oak/upgrade/cli/parser/StoreArguments.java
(original)
+++
jackrabbit/oak/trunk/oak-upgrade/src/main/java/org/apache/jackrabbit/oak/upgrade/cli/parser/StoreArguments.java
Mon Sep 5 08:29:06 2016
@@ -239,6 +239,11 @@ public class StoreArguments {
} else if (descriptors.get(1).getType() == JCR2_DIR_XML) {
throw new CliArgumentException("Can't use CRX2 as a destination",
1);
}
+ StoreDescriptor src = descriptors.get(0);
+ StoreDescriptor dst = descriptors.get(1);
+ if (src.getType() == dst.getType() &&
src.getPath().equals(dst.getPath())) {
+ throw new CliArgumentException("The source and the destination is
the same repository.", 1);
+ }
}
private static void logSegmentVersion() {
Added:
jackrabbit/oak/trunk/oak-upgrade/src/test/java/org/apache/jackrabbit/oak/upgrade/cli/parser/StoreArgumentsTest.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-upgrade/src/test/java/org/apache/jackrabbit/oak/upgrade/cli/parser/StoreArgumentsTest.java?rev=1759207&view=auto
==============================================================================
---
jackrabbit/oak/trunk/oak-upgrade/src/test/java/org/apache/jackrabbit/oak/upgrade/cli/parser/StoreArgumentsTest.java
(added)
+++
jackrabbit/oak/trunk/oak-upgrade/src/test/java/org/apache/jackrabbit/oak/upgrade/cli/parser/StoreArgumentsTest.java
Mon Sep 5 08:29:06 2016
@@ -0,0 +1,29 @@
+/*
+ * 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.jackrabbit.oak.upgrade.cli.parser;
+
+import joptsimple.OptionSet;
+import org.junit.Test;
+
+public class StoreArgumentsTest {
+
+ @Test(expected = CliArgumentException.class)
+ public void testSameRepositoryFails() throws CliArgumentException {
+ OptionSet options = OptionParserFactory.create().parse( "my/repo",
"my/repo");
+ new MigrationCliArguments(options);
+ }
+}