You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ol...@apache.org on 2011/08/30 09:54:42 UTC
svn commit: r1163126 - in
/maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test:
./ java/ java/org/ java/org/apache/ java/org/apache/maven/
java/org/apache/maven/scm/ java/org/apache/maven/scm/provider/
java/org/apache/maven/scm/pr...
Author: olamy
Date: Tue Aug 30 07:54:41 2011
New Revision: 1163126
URL: http://svn.apache.org/viewvc?rev=1163126&view=rev
Log:
[SCM-630] mks integrity scm provider
add unit tests
Added:
maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/
maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/
maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/
maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/
maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/
maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/
maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/
maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/
maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/
maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/IntegrityCommandTest.java
maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/add/
maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/add/IntegrityAddCommandTest.java
maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/branch/
maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/branch/IntegrityBranchCommandTest.java
maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/changelog/
maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/changelog/IntegrityChangeLogCommandTest.java
maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/checkin/
maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/checkin/IntegrityCheckInCommandTest.java
maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/checkout/
maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/checkout/IntegrityCheckOutCommandTest.java
maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/export/
maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/export/IntegrityExportCommandTest.java
maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/list/
maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/list/IntegrityListCommandTest.java
maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/lock/
maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/lock/IntegrityLockCommandTest.java
maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/status/
maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/status/IntegrityStatusCommandTest.java
maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/tag/
maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/tag/IntegrityTagCommandTest.java
maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/unedit/
maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/unedit/IntegrityUnEditCommandTest.java
maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/update/
maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/update/IntegrityUpdateCommandTest.java
maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/repository/
maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/repository/IntegrityScmProviderRepositoryTest.java
Added: maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/IntegrityCommandTest.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/IntegrityCommandTest.java?rev=1163126&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/IntegrityCommandTest.java (added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/IntegrityCommandTest.java Tue Aug 30 07:54:41 2011
@@ -0,0 +1,87 @@
+package org.apache.maven.scm.provider.integrity.command;
+
+/**
+ * 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.
+ */
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import org.apache.maven.scm.CommandParameter;
+import org.apache.maven.scm.CommandParameters;
+import org.apache.maven.scm.ScmFileSet;
+import org.apache.maven.scm.ScmTestCase;
+import org.apache.maven.scm.log.ScmLogger;
+import org.apache.maven.scm.manager.ScmManager;
+import org.apache.maven.scm.manager.plexus.PlexusLogger;
+import org.apache.maven.scm.provider.integrity.command.login.IntegrityLoginCommand;
+import org.apache.maven.scm.provider.integrity.command.checkout.IntegrityCheckOutCommand;
+import org.apache.maven.scm.provider.integrity.repository.IntegrityScmProviderRepository;
+import org.apache.maven.scm.repository.ScmRepository;
+import org.codehaus.plexus.logging.LoggerManager;
+
+/**
+ * Parent class IntegrityCommandTest for all Integrity Test Command executions
+ *
+ * @author <a href="mailto:cletus@mks.com">Cletus D'Souza</a>
+ * @version $Id: IntegrityCommandTest.java 1.1 2011/08/29 00:29:46EDT Cletus D'Souza (dsouza) Exp $
+ */
+public abstract class IntegrityCommandTest extends ScmTestCase
+{
+ // A simple date format to generate unique names for the test run
+ public static final SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS");
+ public static final String fileName = "NewFile_" + sdf.format(new Date()) + ".txt";
+ // A locally pre-configured repository for use with executing Integrity SCM Commands
+ protected String testScmURL = "scm:integrity|dsouza/password@xpvm:7001|#/Code_Gen";
+ protected ScmManager scmManager;
+ protected ScmLogger logger;
+ protected IntegrityScmProviderRepository iRepo;
+ protected ScmFileSet fileSet;
+ protected CommandParameters parameters;
+
+ /**
+ * Sets up all commands for unit test execution
+ */
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ // Set the Change Package ID to :bypass as we wont have a valid Change Pacakge ID for automated tests
+ System.setProperty("maven.scm.integrity.cpid", ":bypass");
+ // Initialize our scmManager
+ scmManager = getScmManager();
+ // Initialize our logger
+ LoggerManager loggerManager = (LoggerManager) getContainer().lookup(LoggerManager.ROLE);
+ logger = new PlexusLogger(loggerManager.getLoggerForComponent(ScmManager.ROLE));
+ // Construct the SCM Repository and initialize our command execution variables
+ ScmRepository repo = scmManager.makeScmRepository(testScmURL);
+ iRepo = (IntegrityScmProviderRepository) repo.getProviderRepository();
+ fileSet = new ScmFileSet(getTestFile("target/test-execution"));
+ parameters = new CommandParameters();
+ // Set the tag name for our tag and branch commands
+ parameters.setString(CommandParameter.TAG_NAME, "Maven-${new java.text.SimpleDateFormat(\"yyyyMMddHHmmssSSS\").format(new Date())}");
+ // Connect to the MKS Integrity Server
+ IntegrityLoginCommand login = new IntegrityLoginCommand();
+ login.setLogger(logger);
+ assertResultIsSuccess(login.execute(iRepo, fileSet, parameters));
+ // Then make sure we've got a sandbox to work with
+ IntegrityCheckOutCommand checkout = new IntegrityCheckOutCommand();
+ checkout.setLogger(logger);
+ assertResultIsSuccess(checkout.execute(iRepo, fileSet, parameters));
+ }
+}
+
Added: maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/add/IntegrityAddCommandTest.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/add/IntegrityAddCommandTest.java?rev=1163126&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/add/IntegrityAddCommandTest.java (added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/add/IntegrityAddCommandTest.java Tue Aug 30 07:54:41 2011
@@ -0,0 +1,59 @@
+package org.apache.maven.scm.provider.integrity.command.add;
+
+/**
+ * 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.
+ */
+
+import org.apache.maven.scm.CommandParameter;
+import org.apache.maven.scm.provider.integrity.command.IntegrityCommandTest;
+import org.apache.maven.scm.provider.integrity.command.add.IntegrityAddCommand;
+
+/**
+ * IntegrityAddCommandTest unit test class
+ *
+ * @author <a href="mailto:cletus@mks.com">Cletus D'Souza</a>
+ * @version $Id: IntegrityAddCommandTest.java 1.1 2011/08/29 00:29:48EDT Cletus D'Souza (dsouza) Exp $
+ */
+public class IntegrityAddCommandTest extends IntegrityCommandTest
+{
+ /**
+ * Sets up this unit test for execution
+ */
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ }
+
+ /**
+ * Executes the IntegrityAddCommand and validates the result
+ * @throws Exception
+ */
+ public void testAddCommandTest() throws Exception
+ {
+ // Create a test file in the sandbox dir
+ makeFile(fileSet.getBasedir(), fileName, "A new file add test");
+ // Set a couple parameters required for the add command to work
+ parameters.setString(CommandParameter.MESSAGE, "A new file test");
+ parameters.setString(CommandParameter.BINARY, "false");
+ // Finally, execute the add command
+ IntegrityAddCommand command = new IntegrityAddCommand();
+ command.setLogger(logger);
+ assertResultIsSuccess(command.execute(iRepo, fileSet, parameters));
+ }
+}
+
Added: maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/branch/IntegrityBranchCommandTest.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/branch/IntegrityBranchCommandTest.java?rev=1163126&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/branch/IntegrityBranchCommandTest.java (added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/branch/IntegrityBranchCommandTest.java Tue Aug 30 07:54:41 2011
@@ -0,0 +1,58 @@
+package org.apache.maven.scm.provider.integrity.command.branch;
+
+/**
+ * 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.
+ */
+
+import java.util.Date;
+
+import org.apache.maven.scm.CommandParameter;
+import org.apache.maven.scm.provider.integrity.command.IntegrityCommandTest;
+import org.apache.maven.scm.provider.integrity.command.branch.IntegrityBranchCommand;
+
+/**
+ * IntegrityBranchCommandTest unit test class
+ *
+ * @author <a href="mailto:cletus@mks.com">Cletus D'Souza</a>
+ * @version $Id: IntegrityBranchCommandTest.java 1.1 2011/08/29 00:29:50EDT Cletus D'Souza (dsouza) Exp $
+ */
+public class IntegrityBranchCommandTest extends IntegrityCommandTest
+{
+ /**
+ * Sets up this unit test for execution
+ */
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ }
+
+ /**
+ * Executes the IntegrityBranchCommand and validates the result
+ * @throws Exception
+ */
+ public void testBranchCommandTest() throws Exception
+ {
+ // Set the branch name parameter which will be needed for the Development Path name
+ parameters.setString(CommandParameter.BRANCH_NAME, "Test_ " + sdf.format(new Date()));
+ // Now we can then execute the branch command
+ IntegrityBranchCommand command = new IntegrityBranchCommand();
+ command.setLogger(logger);
+ assertResultIsSuccess(command.execute(iRepo, fileSet, parameters));
+ }
+}
+
Added: maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/changelog/IntegrityChangeLogCommandTest.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/changelog/IntegrityChangeLogCommandTest.java?rev=1163126&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/changelog/IntegrityChangeLogCommandTest.java (added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/changelog/IntegrityChangeLogCommandTest.java Tue Aug 30 07:54:41 2011
@@ -0,0 +1,62 @@
+package org.apache.maven.scm.provider.integrity.command.changelog;
+
+/**
+ * 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.
+ */
+
+import java.util.Calendar;
+import java.util.Date;
+
+import org.apache.maven.scm.CommandParameter;
+import org.apache.maven.scm.provider.integrity.command.IntegrityCommandTest;
+import org.apache.maven.scm.provider.integrity.command.changelog.IntegrityChangeLogCommand;
+
+/**
+ * IntegrityChangeLogCommandTest unit test class
+ *
+ * @author <a href="mailto:cletus@mks.com">Cletus D'Souza</a>
+ * @version $Id: IntegrityChangeLogCommandTest.java 1.1 2011/08/29 00:29:52EDT Cletus D'Souza (dsouza) Exp $
+ */
+public class IntegrityChangeLogCommandTest extends IntegrityCommandTest
+{
+ /**
+ * Sets up this unit test for execution
+ */
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ }
+
+ /**
+ * Executes the IntegrityChangeLogCommand and validates the result
+ * @throws Exception
+ */
+ public void testChangeLogCommandTest() throws Exception
+ {
+ // Set the start and end date parameters
+ Calendar startDate = Calendar.getInstance();
+ startDate.add(Calendar.DATE, -1);
+ parameters.setDate(CommandParameter.START_DATE, startDate.getTime());
+ parameters.setDate(CommandParameter.END_DATE, new Date());
+ // Now we can then execute the change log command
+ IntegrityChangeLogCommand command = new IntegrityChangeLogCommand();
+ command.setLogger(logger);
+ assertResultIsSuccess(command.execute(iRepo, fileSet, parameters));
+ }
+}
+
Added: maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/checkin/IntegrityCheckInCommandTest.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/checkin/IntegrityCheckInCommandTest.java?rev=1163126&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/checkin/IntegrityCheckInCommandTest.java (added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/checkin/IntegrityCheckInCommandTest.java Tue Aug 30 07:54:41 2011
@@ -0,0 +1,71 @@
+package org.apache.maven.scm.provider.integrity.command.checkin;
+
+/**
+ * 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.
+ */
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+
+import org.apache.maven.scm.CommandParameter;
+import org.apache.maven.scm.provider.integrity.command.IntegrityCommandTest;
+import org.apache.maven.scm.provider.integrity.command.checkin.IntegrityCheckInCommand;
+import org.apache.maven.scm.provider.integrity.command.edit.IntegrityEditCommand;
+
+/**
+ * IntegrityCheckInCommandTest unit test class
+ *
+ * @author <a href="mailto:cletus@mks.com">Cletus D'Souza</a>
+ * @version $Id: IntegrityCheckInCommandTest.java 1.1 2011/08/29 00:29:54EDT Cletus D'Souza (dsouza) Exp $
+ */
+public class IntegrityCheckInCommandTest extends IntegrityCommandTest
+{
+ /**
+ * Sets up this unit test for execution
+ */
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ }
+
+ /**
+ * Executes the IntegrityCheckInCommand and validates the result
+ * @throws Exception
+ */
+ public void testCheckInCommandTest() throws Exception
+ {
+ // First we need to make the workspace writable
+ IntegrityEditCommand edit = new IntegrityEditCommand();
+ edit.setLogger(logger);
+ assertResultIsSuccess(edit.execute(iRepo, fileSet, parameters));
+ // Now lets add something to the file we added in the add test
+ String nl = System.getProperty("line.separator");
+ BufferedWriter bw = new BufferedWriter(new FileWriter(fileSet.getBasedir() + File.separator + fileName, true));
+ bw.write(nl + nl + "A new change appended to file by the check-in command test" + nl);
+ bw.flush();
+ bw.close();
+ // Set the message parameter required for the check-in command to work
+ parameters.setString(CommandParameter.MESSAGE, "Attempting change to an existing file " + fileName);
+ // Now execute the check-in command and validate the results
+ IntegrityCheckInCommand checkin = new IntegrityCheckInCommand();
+ checkin.setLogger(logger);
+ assertResultIsSuccess(checkin.execute(iRepo, fileSet, parameters));
+ }
+}
+
Added: maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/checkout/IntegrityCheckOutCommandTest.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/checkout/IntegrityCheckOutCommandTest.java?rev=1163126&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/checkout/IntegrityCheckOutCommandTest.java (added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/checkout/IntegrityCheckOutCommandTest.java Tue Aug 30 07:54:41 2011
@@ -0,0 +1,52 @@
+package org.apache.maven.scm.provider.integrity.command.checkout;
+
+/**
+ * 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.
+ */
+
+import org.apache.maven.scm.provider.integrity.command.IntegrityCommandTest;
+import org.apache.maven.scm.provider.integrity.command.checkout.IntegrityCheckOutCommand;
+
+/**
+ * IntegrityCheckOutCommandTest unit test class
+ *
+ * @author <a href="mailto:cletus@mks.com">Cletus D'Souza</a>
+ * @version $Id: IntegrityCheckOutCommandTest.java 1.1 2011/08/29 00:29:55EDT Cletus D'Souza (dsouza) Exp $
+ */
+public class IntegrityCheckOutCommandTest extends IntegrityCommandTest
+{
+ /**
+ * Sets up this unit test for execution
+ */
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ }
+
+ /**
+ * Executes the IntegrityCheckOutCommand and validates the result
+ * @throws Exception
+ */
+ public void testCheckOutCommandTest() throws Exception
+ {
+ IntegrityCheckOutCommand command = new IntegrityCheckOutCommand();
+ command.setLogger(logger);
+ assertResultIsSuccess(command.execute(iRepo, fileSet, parameters));
+ }
+}
+
Added: maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/export/IntegrityExportCommandTest.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/export/IntegrityExportCommandTest.java?rev=1163126&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/export/IntegrityExportCommandTest.java (added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/export/IntegrityExportCommandTest.java Tue Aug 30 07:54:41 2011
@@ -0,0 +1,54 @@
+package org.apache.maven.scm.provider.integrity.command.export;
+
+/**
+ * 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.
+ */
+
+import org.apache.maven.scm.ScmFileSet;
+import org.apache.maven.scm.provider.integrity.command.IntegrityCommandTest;
+import org.apache.maven.scm.provider.integrity.command.export.IntegrityExportCommand;
+
+/**
+ * IntegrityExportCommandTest unit test class
+ *
+ * @author <a href="mailto:cletus@mks.com">Cletus D'Souza</a>
+ * @version $Id: IntegrityExportCommandTest.java 1.1 2011/08/29 00:29:58EDT Cletus D'Souza (dsouza) Exp $
+ */
+public class IntegrityExportCommandTest extends IntegrityCommandTest
+{
+ /**
+ * Sets up this unit test for execution
+ */
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ }
+
+ /**
+ * Executes the IntegrityExportCommand and validates the result
+ * @throws Exception
+ */
+ public void testExportCommandTest() throws Exception
+ {
+ // Then we can then execute the export command
+ IntegrityExportCommand command = new IntegrityExportCommand();
+ command.setLogger(logger);
+ assertResultIsSuccess(command.execute(iRepo, new ScmFileSet(getTestFile("target/test-execution/export")), parameters));
+ }
+}
+
Added: maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/list/IntegrityListCommandTest.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/list/IntegrityListCommandTest.java?rev=1163126&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/list/IntegrityListCommandTest.java (added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/list/IntegrityListCommandTest.java Tue Aug 30 07:54:41 2011
@@ -0,0 +1,60 @@
+package org.apache.maven.scm.provider.integrity.command.list;
+
+/**
+ * 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.
+ */
+
+import java.io.File;
+
+import org.apache.maven.scm.CommandParameter;
+import org.apache.maven.scm.ScmFileSet;
+import org.apache.maven.scm.provider.integrity.command.IntegrityCommandTest;
+import org.apache.maven.scm.provider.integrity.command.list.IntegrityListCommand;
+
+/**
+ * IntegrityListCommandTest unit test class
+ *
+ * @author <a href="mailto:cletus@mks.com">Cletus D'Souza</a>
+ * @version $Id: IntegrityListCommandTest.java 1.1 2011/08/29 00:29:59EDT Cletus D'Souza (dsouza) Exp $
+ */
+public class IntegrityListCommandTest extends IntegrityCommandTest
+{
+ /**
+ * Sets up this unit test for execution
+ */
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ }
+
+ /**
+ * Executes the IntegrityListCommand and validates the result
+ * @throws Exception
+ */
+ public void testListCommandTest() throws Exception
+ {
+ // Add the recursive parameter to the command's parameters
+ parameters.setString(CommandParameter.RECURSIVE, "true");
+ // Now, we can execute the list command
+ IntegrityListCommand command = new IntegrityListCommand();
+ command.setLogger(logger);
+ assertResultIsSuccess(command.execute(iRepo, new ScmFileSet(fileSet.getBasedir(),
+ new File("target/test-execution/" + fileName)) , parameters));
+ }
+}
+
Added: maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/lock/IntegrityLockCommandTest.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/lock/IntegrityLockCommandTest.java?rev=1163126&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/lock/IntegrityLockCommandTest.java (added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/lock/IntegrityLockCommandTest.java Tue Aug 30 07:54:41 2011
@@ -0,0 +1,56 @@
+package org.apache.maven.scm.provider.integrity.command.lock;
+
+/**
+ * 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.
+ */
+
+import org.apache.maven.scm.CommandParameter;
+import org.apache.maven.scm.provider.integrity.command.IntegrityCommandTest;
+import org.apache.maven.scm.provider.integrity.command.lock.IntegrityLockCommand;
+
+/**
+ * IntegrityLockCommandTest unit test class
+ *
+ * @author <a href="mailto:cletus@mks.com">Cletus D'Souza</a>
+ * @version $Id: IntegrityLockCommandTest.java 1.1 2011/08/29 00:30:01EDT Cletus D'Souza (dsouza) Exp $
+ */
+public class IntegrityLockCommandTest extends IntegrityCommandTest
+{
+ /**
+ * Sets up this unit test for execution
+ */
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ }
+
+ /**
+ * Executes the IntegrityCheckOutCommand and validates the result
+ * @throws Exception
+ */
+ public void testLockCommandTest() throws Exception
+ {
+ // Add the parameter that specifies which file we want to blame
+ parameters.setString(CommandParameter.FILE, fileName);
+ // Now we can then execute the lock command
+ IntegrityLockCommand command = new IntegrityLockCommand();
+ command.setLogger(logger);
+ assertResultIsSuccess(command.execute(iRepo, fileSet, parameters));
+ }
+}
+
Added: maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/status/IntegrityStatusCommandTest.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/status/IntegrityStatusCommandTest.java?rev=1163126&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/status/IntegrityStatusCommandTest.java (added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/status/IntegrityStatusCommandTest.java Tue Aug 30 07:54:41 2011
@@ -0,0 +1,53 @@
+package org.apache.maven.scm.provider.integrity.command.status;
+
+/**
+ * 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.
+ */
+
+import org.apache.maven.scm.provider.integrity.command.IntegrityCommandTest;
+import org.apache.maven.scm.provider.integrity.command.status.IntegrityStatusCommand;
+
+/**
+ * IntegrityStatusCommandTest unit test class
+ *
+ * @author <a href="mailto:cletus@mks.com">Cletus D'Souza</a>
+ * @version $Id: IntegrityStatusCommandTest.java 1.1 2011/08/29 00:30:03EDT Cletus D'Souza (dsouza) Exp $
+ */
+public class IntegrityStatusCommandTest extends IntegrityCommandTest
+{
+ /**
+ * Sets up this unit test for execution
+ */
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ }
+
+ /**
+ * Executes the IntegrityStatusCommand and validates the result
+ * @throws Exception
+ */
+ public void testStatusCommandTest() throws Exception
+ {
+ // Execute the status command
+ IntegrityStatusCommand command = new IntegrityStatusCommand();
+ command.setLogger(logger);
+ assertResultIsSuccess(command.execute(iRepo, fileSet, parameters));
+ }
+}
+
Added: maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/tag/IntegrityTagCommandTest.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/tag/IntegrityTagCommandTest.java?rev=1163126&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/tag/IntegrityTagCommandTest.java (added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/tag/IntegrityTagCommandTest.java Tue Aug 30 07:54:41 2011
@@ -0,0 +1,57 @@
+package org.apache.maven.scm.provider.integrity.command.tag;
+
+/**
+ * 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.
+ */
+
+import org.apache.maven.scm.CommandParameter;
+import org.apache.maven.scm.provider.integrity.command.IntegrityCommandTest;
+import org.apache.maven.scm.provider.integrity.command.tag.IntegrityTagCommand;
+
+/**
+ * IntegrityTagCommandTest unit test class
+ *
+ * @author <a href="mailto:cletus@mks.com">Cletus D'Souza</a>
+ * @version $Id: IntegrityTagCommandTest.java 1.1 2011/08/29 00:30:06EDT Cletus D'Souza (dsouza) Exp $
+ */
+public class IntegrityTagCommandTest extends IntegrityCommandTest
+{
+ /**
+ * Sets up this unit test for execution
+ */
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ }
+
+ /**
+ * Executes the IntegrityTagCommand and validates the result
+ * @throws Exception
+ */
+ public void testTagCommandTest() throws Exception
+ {
+ // Set the message parameter which is optional for the tag command
+ parameters.setString(CommandParameter.MESSAGE, "Checkpointing project whith changes to file " + fileName);
+
+ // Now we can then execute the tag command
+ IntegrityTagCommand command = new IntegrityTagCommand();
+ command.setLogger(logger);
+ assertResultIsSuccess(command.execute(iRepo, fileSet, parameters));
+ }
+}
+
Added: maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/unedit/IntegrityUnEditCommandTest.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/unedit/IntegrityUnEditCommandTest.java?rev=1163126&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/unedit/IntegrityUnEditCommandTest.java (added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/unedit/IntegrityUnEditCommandTest.java Tue Aug 30 07:54:41 2011
@@ -0,0 +1,53 @@
+package org.apache.maven.scm.provider.integrity.command.unedit;
+
+/**
+ * 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.
+ */
+
+import org.apache.maven.scm.provider.integrity.command.IntegrityCommandTest;
+import org.apache.maven.scm.provider.integrity.command.unedit.IntegrityUnEditCommand;
+
+/**
+ * IntegrityUnEditCommandTest unit test class
+ *
+ * @author <a href="mailto:cletus@mks.com">Cletus D'Souza</a>
+ * @version $Id: IntegrityUnEditCommandTest.java 1.1 2011/08/29 00:30:08EDT Cletus D'Souza (dsouza) Exp $
+ */
+public class IntegrityUnEditCommandTest extends IntegrityCommandTest
+{
+ /**
+ * Sets up this unit test for execution
+ */
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ }
+
+ /**
+ * Executes the IntegrityUnEditCommand and validates the result
+ * @throws Exception
+ */
+ public void testUnEditCommandTest() throws Exception
+ {
+ // Execute the un-edit command
+ IntegrityUnEditCommand command = new IntegrityUnEditCommand();
+ command.setLogger(logger);
+ assertResultIsSuccess(command.execute(iRepo, fileSet, parameters));
+ }
+}
+
Added: maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/update/IntegrityUpdateCommandTest.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/update/IntegrityUpdateCommandTest.java?rev=1163126&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/update/IntegrityUpdateCommandTest.java (added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/command/update/IntegrityUpdateCommandTest.java Tue Aug 30 07:54:41 2011
@@ -0,0 +1,62 @@
+package org.apache.maven.scm.provider.integrity.command.update;
+
+/**
+ * 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.
+ */
+
+import java.util.Calendar;
+import java.util.Date;
+
+import org.apache.maven.scm.CommandParameter;
+import org.apache.maven.scm.provider.integrity.command.IntegrityCommandTest;
+import org.apache.maven.scm.provider.integrity.command.update.IntegrityUpdateCommand;
+
+/**
+ * IntegrityUpdateCommandTest unit test class
+ *
+ * @author <a href="mailto:cletus@mks.com">Cletus D'Souza</a>
+ * @version $Id: IntegrityUpdateCommandTest.java 1.1 2011/08/29 00:30:10EDT Cletus D'Souza (dsouza) Exp $
+ */
+public class IntegrityUpdateCommandTest extends IntegrityCommandTest
+{
+ /**
+ * Sets up this unit test for execution
+ */
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ }
+
+ /**
+ * Executes the IntegrityUpdateCommand and validates the result
+ * @throws Exception
+ */
+ public void testChangeLogCommandTest() throws Exception
+ {
+ // Set the start and end date parameters
+ Calendar startDate = Calendar.getInstance();
+ startDate.add(Calendar.DATE, -1);
+ parameters.setDate(CommandParameter.START_DATE, startDate.getTime());
+ parameters.setDate(CommandParameter.END_DATE, new Date());
+ // Now we can then execute the update command
+ IntegrityUpdateCommand command = new IntegrityUpdateCommand();
+ command.setLogger(logger);
+ assertResultIsSuccess(command.execute(iRepo, fileSet, parameters));
+ }
+}
+
Added: maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/repository/IntegrityScmProviderRepositoryTest.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/repository/IntegrityScmProviderRepositoryTest.java?rev=1163126&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/repository/IntegrityScmProviderRepositoryTest.java (added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-integrity/src/test/java/org/apache/maven/scm/provider/integrity/repository/IntegrityScmProviderRepositoryTest.java Tue Aug 30 07:54:41 2011
@@ -0,0 +1,161 @@
+package org.apache.maven.scm.provider.integrity.repository;
+
+/**
+ * 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.
+ */
+
+import org.apache.maven.scm.ScmTestCase;
+import org.apache.maven.scm.manager.ScmManager;
+import org.apache.maven.scm.repository.ScmRepository;
+
+/**
+ * IntegrityScmProviderRepositoryTest
+ *
+ * @author <a href="mailto:cletus@mks.com">Cletus D'Souza</a>
+ * @version $Id: IntegrityScmProviderRepositoryTest.java 1.1 2011/08/29 00:30:11EDT Cletus D'Souza (dsouza) Exp $
+ */
+public class IntegrityScmProviderRepositoryTest extends ScmTestCase
+{
+ private ScmManager scmManager;
+
+ /**
+ * Initialize our ScmManager object
+ */
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ scmManager = getScmManager();
+ }
+
+ /**
+ * Executes a test with the bare minimum required for the Integrity Scm URL String
+ * @throws Exception
+ */
+ public void testMinimumUrlString() throws Exception
+ {
+ // Minimum url string
+ testValidUrl("scm:integrity|#/repo/project", "#/repo/project", "", 0, "", "");
+ }
+
+ /**
+ * Executes a test with only the hostname specified
+ * @throws Exception
+ */
+ public void testWithHostname() throws Exception
+ {
+ // Test with host
+ testValidUrl("scm:integrity|@localhost|#/repo/project", "#/repo/project", "localhost", 0, "", "");
+ }
+
+ /**
+ * Executes a test with only the hostname and port specified
+ * @throws Exception
+ */
+ public void testWithHostAndPort() throws Exception
+ {
+ // Test host and port
+ testValidUrl("scm:integrity|@localhost:7001|#/repo/project", "#/repo/project", "localhost", 7001, "", "");
+ }
+
+ /**
+ * Executes a test with only the username specified
+ * @throws Exception
+ */
+ public void testWithUser() throws Exception
+ {
+ // Test with user
+ testValidUrl("scm:integrity|dsouza@|#/repo/project", "#/repo/project", "", 0, "dsouza", "");
+ }
+
+ /**
+ * Executes a test with the username and password specified
+ * @throws Exception
+ */
+ public void testWithUserAndPassword() throws Exception
+ {
+ // Test with user and password
+ testValidUrl("scm:integrity|dsouza/password@|#/repo/project", "#/repo/project", "", 0, "dsouza", "password");
+ }
+
+ /**
+ * Executes a test with the username and hostname specified
+ * @throws Exception
+ */
+ public void testWithUserAndHost() throws Exception
+ {
+ // Test with user and host
+ testValidUrl("scm:integrity|dsouza@localhost|#/repo/project", "#/repo/project", "localhost", 0, "dsouza", "");
+ }
+
+ /**
+ * Executes a test with the username and hostname plus port specified
+ * @throws Exception
+ */
+ public void testWithUserAndHostPort() throws Exception
+ {
+ // Test with user and host:port
+ testValidUrl("scm:integrity|dsouza@localhost:7001|#/repo/project", "#/repo/project", "localhost", 7001, "dsouza", "");
+ }
+
+ /**
+ * Executes a test with the username and password plus hostname specified
+ * @throws Exception
+ */
+ public void testWithUserPasswordAndHost() throws Exception
+ {
+ // Test with user/password and host
+ testValidUrl("scm:integrity|dsouza/password@localhost|#/repo/project", "#/repo/project", "localhost", 0, "dsouza", "password");
+ }
+
+ /**
+ * Executes a test with all the components of the SCM URL string specified
+ * @throws Exception
+ */
+ public void testWithWholeURL() throws Exception
+ {
+ // Test with the complete url
+ testValidUrl("scm:integrity|dsouza/password@localhost:7001|#/repo/project", "#/repo/project", "localhost", 7001, "dsouza", "password");
+ }
+
+ /**
+ * Tests the various components of the Integrity SCM URL
+ * @param scmUrl Integrity SCM URL
+ * @param expectedConfigPath Expected Configuration Path
+ * @param expectedHost Expected Hostname
+ * @param expectedPort Expected Port
+ * @param expectedUser Expected Username
+ * @param expectedPassword Expected Password
+ * @throws Exception
+ */
+ private void testValidUrl(String scmUrl, String expectedConfigPath,
+ String expectedHost, int expectedPort,
+ String expectedUser, String expectedPassword) throws Exception
+ {
+ ScmRepository repo = scmManager.makeScmRepository(scmUrl);
+ assertNotNull( "ScmManager.makeScmRepository() returned null", repo );
+ assertNotNull( "The provider repository was null.", repo.getProviderRepository() );
+ assertTrue( "The SCM Repository isn't a " + IntegrityScmProviderRepository.class.getName() + ".",
+ repo.getProviderRepository() instanceof IntegrityScmProviderRepository );
+ IntegrityScmProviderRepository iRepo = (IntegrityScmProviderRepository) repo.getProviderRepository();
+ assertEquals("Configration Path is incorrect", expectedConfigPath, iRepo.getConfigruationPath());
+ assertEquals("Hostname is incorrect", expectedHost, iRepo.getHost());
+ assertEquals("Port is incorrect", expectedPort, iRepo.getPort());
+ assertEquals("Username is incorrect", expectedUser, iRepo.getUser());
+ assertEquals("Password is incorrect", expectedPassword, iRepo.getPassword());
+ }
+}