Permalink
Browse files

[NEXUS-4949] Force reindexing on repos that should contain the artifa…

…ct (at least we gain saome time till we make the request for artifact info)

Signed-off-by: Alin Dreghiciu <adreghiciu@gmail.com>
  • Loading branch information...
1 parent eebf37f commit a29273ec8d4ffbbab8c8bd86e7c28f30819e0647 @adreghiciu adreghiciu committed Nov 22, 2012
View
12 ...t/java/org/sonatype/nexus/integrationtests/nexus3615/Nexus3615ArtifactInfoSecurityIT.java
@@ -20,6 +20,7 @@
import java.io.IOException;
+import org.apache.maven.index.artifact.Gav;
import org.restlet.data.MediaType;
import org.sonatype.nexus.integrationtests.TestContainer;
import org.sonatype.nexus.rest.model.ArtifactInfoResource;
@@ -109,15 +110,22 @@ protected void giveUserPrivilege( String userId, String priv )
public void checkViewAccess()
throws Exception
{
+ // force re-indexing to ensure that our artifact will be found by artifact info
+ final Gav gav = new Gav( "nexus3615", "artifact", "1.0" );
+ getSearchMessageUtil().reindexGAV( REPO_TEST_HARNESS_RELEASE_REPO, gav );
+ getSearchMessageUtil().reindexGAV( REPO_TEST_HARNESS_REPO2, gav );
+ getSearchMessageUtil().reindexGAV( REPO_TEST_HARNESS_REPO, gav );
+
this.giveUserRole( TEST_USER_NAME, "ui-search", true );
this.giveUserPrivilege( TEST_USER_NAME, "T1" ); // all m2 repo, read
this.giveUserPrivilege( TEST_USER_NAME, "repository-" + REPO_TEST_HARNESS_REPO );
TestContainer.getInstance().getTestContext().setUsername( TEST_USER_NAME );
TestContainer.getInstance().getTestContext().setPassword( TEST_USER_PASSWORD );
- ArtifactInfoResource info =
- getSearchMessageUtil().getInfo( REPO_TEST_HARNESS_REPO, "nexus3615/artifact/1.0/artifact-1.0.jar" );
+ final ArtifactInfoResource info = getSearchMessageUtil().getInfo(
+ REPO_TEST_HARNESS_REPO, "nexus3615/artifact/1.0/artifact-1.0.jar"
+ );
assertThat( info.getRepositoryId(), is( REPO_TEST_HARNESS_REPO ) );
assertThat( info.getRepositoryPath(), is( "/nexus3615/artifact/1.0/artifact-1.0.jar" ) );

0 comments on commit a29273e

Please sign in to comment.