From f92d28187470568be49d92869600ad3257e8062f Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Wed, 9 Nov 2011 16:20:20 +0000 Subject: [PATCH] fix formatting no functionnal changes git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1199825 13f79535-47bb-0310-9956-ffa450edef68 --- .../rest/services/CopyArtifactTest.java | 57 +++++++++---------- 1 file changed, 28 insertions(+), 29 deletions(-) diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/CopyArtifactTest.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/CopyArtifactTest.java index 7c62a5d24..04f33dae5 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/CopyArtifactTest.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/CopyArtifactTest.java @@ -20,7 +20,6 @@ package org.apache.archiva.rest.services; import org.apache.archiva.admin.model.beans.ManagedRepository; import org.apache.archiva.rest.api.model.ArtifactTransferRequest; -import org.apache.archiva.rest.api.services.ArchivaRestServiceException; import org.apache.archiva.rest.api.services.RepositoriesService; import org.apache.commons.io.FileUtils; import org.apache.commons.lang.StringUtils; @@ -39,35 +38,35 @@ public class CopyArtifactTest static final String SOURCE_REPO_ID = "test-origin-repo"; - private void initSourceTargetRepo( ) + protected void initSourceTargetRepo() throws Exception { File targetRepo = new File( "target/test-repo-copy" ); - if ( targetRepo.exists( ) ) + if ( targetRepo.exists() ) { FileUtils.deleteDirectory( targetRepo ); } - assertFalse( targetRepo.exists( ) ); - targetRepo.mkdirs( ); + assertFalse( targetRepo.exists() ); + targetRepo.mkdirs(); if ( getManagedRepositoriesService( authorizationHeader ).getManagedRepository( TARGET_REPO_ID ) != null ) { getManagedRepositoriesService( authorizationHeader ).deleteManagedRepository( TARGET_REPO_ID, true ); assertNull( getManagedRepositoriesService( authorizationHeader ).getManagedRepository( TARGET_REPO_ID ) ); } - ManagedRepository managedRepository = getTestManagedRepository( ); + ManagedRepository managedRepository = getTestManagedRepository(); managedRepository.setId( TARGET_REPO_ID ); - managedRepository.setLocation( targetRepo.getCanonicalPath( ) ); + managedRepository.setLocation( targetRepo.getCanonicalPath() ); managedRepository.setCronExpression( "* * * * * ?" ); getManagedRepositoriesService( authorizationHeader ).addManagedRepository( managedRepository ); assertNotNull( getManagedRepositoriesService( authorizationHeader ).getManagedRepository( TARGET_REPO_ID ) ); File originRepo = new File( "target/test-origin-repo" ); - if ( originRepo.exists( ) ) + if ( originRepo.exists() ) { FileUtils.deleteDirectory( originRepo ); } - assertFalse( originRepo.exists( ) ); + assertFalse( originRepo.exists() ); FileUtils.copyDirectory( new File( "src/test/repo-with-osgi" ), originRepo ); if ( getManagedRepositoriesService( authorizationHeader ).getManagedRepository( SOURCE_REPO_ID ) != null ) @@ -76,19 +75,19 @@ public class CopyArtifactTest assertNull( getManagedRepositoriesService( authorizationHeader ).getManagedRepository( SOURCE_REPO_ID ) ); } - managedRepository = getTestManagedRepository( ); + managedRepository = getTestManagedRepository(); managedRepository.setId( SOURCE_REPO_ID ); - managedRepository.setLocation( originRepo.getCanonicalPath( ) ); + managedRepository.setLocation( originRepo.getCanonicalPath() ); getManagedRepositoriesService( authorizationHeader ).addManagedRepository( managedRepository ); assertNotNull( getManagedRepositoriesService( authorizationHeader ).getManagedRepository( SOURCE_REPO_ID ) ); - getArchivaAdministrationService( ).addKnownContentConsumer( "create-missing-checksums" ); - getArchivaAdministrationService( ).addKnownContentConsumer( "metadata-updater" ); + getArchivaAdministrationService().addKnownContentConsumer( "create-missing-checksums" ); + getArchivaAdministrationService().addKnownContentConsumer( "metadata-updater" ); } - public void clean( ) + public void clean() throws Exception { @@ -106,17 +105,17 @@ public class CopyArtifactTest } @Test - public void copyToAnEmptyRepo( ) + public void copyToAnEmptyRepo() throws Exception { try { - initSourceTargetRepo( ); + initSourceTargetRepo(); // START SNIPPET: copy-artifact // configure the artifact you want to copy // if package ommited default will be jar - ArtifactTransferRequest artifactTransferRequest = new ArtifactTransferRequest( ); + ArtifactTransferRequest artifactTransferRequest = new ArtifactTransferRequest(); artifactTransferRequest.setGroupId( "org.apache.karaf.features" ); artifactTransferRequest.setArtifactId( "org.apache.karaf.features.core" ); artifactTransferRequest.setVersion( "2.2.2" ); @@ -130,32 +129,32 @@ public class CopyArtifactTest assertTrue( res ); String targetRepoPath = getManagedRepositoriesService( authorizationHeader ).getManagedRepository( - TARGET_REPO_ID ).getLocation( ); + TARGET_REPO_ID ).getLocation(); File artifact = new File( targetRepoPath, "/org/apache/karaf/features/org.apache.karaf.features.core/2.2.2/org.apache.karaf.features.core-2.2.2.jar" ); - assertTrue( artifact.exists( ) ); + assertTrue( artifact.exists() ); File pom = new File( targetRepoPath, "/org/apache/karaf/features/org.apache.karaf.features.core/2.2.2/org.apache.karaf.features.core-2.2.2.pom" ); - assertTrue( "not exists " + pom.getPath( ), pom.exists( ) ); + assertTrue( "not exists " + pom.getPath(), pom.exists() ); // TODO find a way to force metadata generation and test it !! } finally { - clean( ); + clean(); } } @Test( expected = ServerWebApplicationException.class ) - public void copyNonExistingArtifact( ) + public void copyNonExistingArtifact() throws Throwable { try { - initSourceTargetRepo( ); + initSourceTargetRepo(); - ArtifactTransferRequest artifactTransferRequest = new ArtifactTransferRequest( ); + ArtifactTransferRequest artifactTransferRequest = new ArtifactTransferRequest(); artifactTransferRequest.setGroupId( "org.apache.karaf.features" ); artifactTransferRequest.setArtifactId( "org.apache.karaf.features.core" ); artifactTransferRequest.setVersion( "3.0.6552" ); @@ -167,21 +166,21 @@ public class CopyArtifactTest } catch ( ServerWebApplicationException e ) { - assertTrue( StringUtils.contains( e.getMessage( ), "cannot find artifact" ) ); + assertTrue( StringUtils.contains( e.getMessage(), "cannot find artifact" ) ); throw e; } finally { - clean( ); + clean(); } } //@Test - public void copyToAnExistingRepo( ) + public void copyToAnExistingRepo() throws Exception { - initSourceTargetRepo( ); - clean( ); + initSourceTargetRepo(); + clean(); } } -- 2.39.5