Return-Path: Delivered-To: apmail-maven-scm-cvs-archive@www.apache.org Received: (qmail 85111 invoked from network); 9 Nov 2004 15:55:38 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 9 Nov 2004 15:55:38 -0000 Received: (qmail 62221 invoked by uid 500); 9 Nov 2004 15:54:45 -0000 Delivered-To: apmail-maven-scm-cvs-archive@maven.apache.org Received: (qmail 62105 invoked by uid 500); 9 Nov 2004 15:54:44 -0000 Mailing-List: contact scm-cvs-help@maven.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: scm-cvs@maven.apache.org Delivered-To: mailing list scm-cvs@maven.apache.org Received: (qmail 61964 invoked by uid 99); 9 Nov 2004 15:54:41 -0000 X-ASF-Spam-Status: No, hits=-10.0 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Tue, 09 Nov 2004 07:54:38 -0800 Received: (qmail 84224 invoked by uid 1849); 9 Nov 2004 15:54:35 -0000 Date: 9 Nov 2004 15:54:35 -0000 Message-ID: <20041109155435.84223.qmail@minotaur.apache.org> From: trygvis@apache.org To: maven-scm-cvs@apache.org Subject: cvs commit: maven-scm/maven-scm-providers/maven-scm-provider-local/src/test/java/org/apache/maven/scm/provider/local/command/update LocalUpdateCommandTckTest.java X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N trygvis 2004/11/09 07:54:35 Added: maven-scm-providers/maven-scm-provider-local/src/test/java/org/apache/maven/scm/provider/local LocalScmProviderTest.java maven-scm-providers/maven-scm-provider-local/src/test/java/org/apache/maven/scm/provider/local/command/checkout LocalCheckOutCommandTckTest.java maven-scm-providers/maven-scm-provider-local/src/test/java/org/apache/maven/scm/provider/local/command/update LocalUpdateCommandTckTest.java Log: o Implementing the tests from maven-scm-test. Revision Changes Path 1.1 maven-scm/maven-scm-providers/maven-scm-provider-local/src/test/java/org/apache/maven/scm/provider/local/LocalScmProviderTest.java Index: LocalScmProviderTest.java =================================================================== package org.apache.maven.scm.provider.local; /* * Copyright 2001-2004 The Apache Software Foundation. * * 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. */ import org.apache.maven.scm.ScmTestCase; /** * @author Trygve Laugstøl * @version $Id: LocalScmProviderTest.java,v 1.1 2004/11/09 15:54:35 trygvis Exp $ */ public class LocalScmProviderTest extends ScmTestCase { public void testFixModuleName() { assertEquals( "my-module", LocalScmProvider.fixModuleName( "my-module" ) ); assertEquals( "my-module", LocalScmProvider.fixModuleName( "/my-module" ) ); assertEquals( "my-module", LocalScmProvider.fixModuleName( "my-module/" ) ); assertEquals( "my-module", LocalScmProvider.fixModuleName( "/my-module/" ) ); } } 1.1 maven-scm/maven-scm-providers/maven-scm-provider-local/src/test/java/org/apache/maven/scm/provider/local/command/checkout/LocalCheckOutCommandTckTest.java Index: LocalCheckOutCommandTckTest.java =================================================================== package org.apache.maven.scm.provider.local.command.checkout; /* * Copyright 2003-2004 The Apache Software Foundation. * * 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. */ import org.apache.maven.scm.tck.command.checkout.CheckOutCommandTckTest; /** * @author Emmanuel Venisse * @version $Id: LocalCheckOutCommandTckTest.java,v 1.1 2004/11/09 15:54:35 trygvis Exp $ */ public class LocalCheckOutCommandTckTest extends CheckOutCommandTckTest { public String getScmUrl() throws Exception { return "scm:local:" + getRepositoryRoot().getAbsolutePath() + ":test-repo"; } public void initRepo() throws Exception { makeFile( getRepositoryRoot(), "/pom.xml" ); makeFile( getRepositoryRoot(), "/readme.txt" ); makeFile( getRepositoryRoot(), "/src/main/java/Application.java" ); makeFile( getRepositoryRoot(), "/src/test/java/Test.java" ); makeDirectory( getRepositoryRoot(), "/src/test/resources" ); } } 1.1 maven-scm/maven-scm-providers/maven-scm-provider-local/src/test/java/org/apache/maven/scm/provider/local/command/update/LocalUpdateCommandTckTest.java Index: LocalUpdateCommandTckTest.java =================================================================== package org.apache.maven.scm.provider.local.command.update; /* * Copyright 2001-2004 The Apache Software Foundation. * * 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. */ import java.io.File; import java.util.Iterator; import org.apache.maven.scm.provider.local.repository.LocalScmProviderRepository; import org.apache.maven.scm.repository.ScmRepository; import org.apache.maven.scm.tck.command.update.UpdateCommandTckTest; import org.codehaus.plexus.util.FileUtils; /** * @author Trygve Laugstøl * @version $Id: LocalUpdateCommandTckTest.java,v 1.1 2004/11/09 15:54:35 trygvis Exp $ */ public class LocalUpdateCommandTckTest extends UpdateCommandTckTest { private final static String moduleName = "test-repo"; public String getScmUrl() throws Exception { return "scm:local|" + getWorkingCopy() + "|" + moduleName; } public void initRepo() throws Exception { makeRepo( getRepositoryRoot(), true ); } private void makeRepo( File workingDirectory, boolean includeModuleName ) throws Exception { String module = ""; if ( includeModuleName ) { module = moduleName; } makeFile( workingDirectory, module + "/pom.xml" ); makeFile( workingDirectory, module + "/readme.txt" ); makeFile( workingDirectory, module + "/src/main/java/Application.java" ); makeFile( workingDirectory, module + "/src/test/java/Test.java" ); makeDirectory( workingDirectory, module + "/src/test/resources" ); } public void checkOut( File workingDirectory ) throws Exception { makeRepo( workingDirectory, false ); } public void addFileToRepository( File workingDirectory, String file ) throws Exception { // empty } public void addDirectoryToRepository( File workingDirectory, String directory ) throws Exception { // empty } public void commit( File workingDirectory, ScmRepository repository ) throws Exception { LocalScmProviderRepository localRepository = (LocalScmProviderRepository) repository.getProviderRepository(); // Only copy files newer than in the repo File repo = new File( localRepository.getRoot(), localRepository.getModule() ); Iterator it = FileUtils.getFiles( workingDirectory, "**", null ).iterator(); while ( it.hasNext() ) { File file = (File) it.next(); File repoFile = new File( repo, file.getAbsolutePath().substring( workingDirectory.getAbsolutePath().length()) ); if ( repoFile.exists() ) { String repoFileContents = FileUtils.fileRead( repoFile ); String fileContents = FileUtils.fileRead( file ); if ( fileContents.equals( repoFileContents ) ) { continue; } } FileUtils.copyFile( file, repoFile ); } } }