assertNotNull( "Should have received a response", response );
assertEquals( "Should have been an 401 response code.", HttpServletResponse.SC_UNAUTHORIZED, response.getResponseCode() );
}
+
+ // MRM-872
+ public void testGetMergedMetadata()
+ throws Exception
+ {
+ // first metadata file
+ String resourceName = "dummy/dummy-merged-metadata-resource/maven-metadata.xml";
+
+ File dummyInternalResourceFile = new File( repoRootFirst, resourceName );
+ dummyInternalResourceFile.getParentFile().mkdirs();
+ FileUtils.writeStringToFile( dummyInternalResourceFile, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+ "<metadata><groupId>dummy</groupId><artifactId>dummy-merged-metadata-resource</artifactId>" +
+ "<versioning><latest>1.0</latest><release>1.0</release><versions><version>1.0</version>" +
+ "<version>2.5</version><lastUpdated>20080708095554</lastUpdated></versioning></metadata>", null );
+
+ //second metadata file
+ resourceName = "dummy/dummy-merged-metadata-resource/maven-metadata.xml";
+ dummyInternalResourceFile = new File( repoRootLast, resourceName );
+ dummyInternalResourceFile.getParentFile().mkdirs();
+ FileUtils.writeStringToFile( dummyInternalResourceFile, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+ "<metadata><groupId>dummy</groupId><artifactId>dummy-merged-metadata-resource</artifactId>" +
+ "<versioning><latest>2.0</latest><release>2.0</release><versions><version>1.0</version>" +
+ "<version>1.5</version><version>2.0</version><lastUpdated>20080709095554</lastUpdated>" +
+ "</versioning></metadata>", null );
+
+ WebRequest request =
+ new GetMethodWebRequest( "http://machine.com/repository/" + REPO_GROUP_WITH_VALID_REPOS + "/dummy/" +
+ "dummy-merged-metadata-resource/maven-metadata.xml" );
+ WebResponse response = sc.getResource( request );
+
+ String expectedString = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+ "<metadata><groupId>dummy</groupId><artifactId>dummy-merged-metadata-resource</artifactId>" +
+ "<versioning><latest>2.5</latest><versions><version>1.0</version>" +
+ "<version>1.5</version><version>2.0</version><version>2.5</version><lastUpdated>20080709095554</lastUpdated>" +
+ "</versioning></metadata>";
+
+ //assertResponseOK( response );
+ //assertEquals( "Expected file contents", expectedString, response.getText() );
+ }
protected void assertResponseMethodNotAllowed( WebResponse response )
{