public void testSimplePullWithRegardingToPathEnding()
throws Exception
{
// pull the stuff from remote, to play with it below
StorageItem item =
getRootRouter().retrieveItem(
new ResourceStoreRequest("/repositories/repo1/activemq/activemq-core/1.2/activemq-core-1.2.jar", false));
checkForFileAndMatchContents(item);
item =
getRootRouter().retrieveItem(
new ResourceStoreRequest("/groups/test/activemq/activemq-core/1.2/activemq-core-1.2.jar", false));
checkForFileAndMatchContents(item);
// new test regarding item properties and path endings.
// All resource storage implementations should behave the same way.
item = getRootRouter().retrieveItem(new ResourceStoreRequest("/groups/test/activemq", false));
assertEquals("/groups/test/activemq", item.getPath());
assertEquals("/groups/test", item.getParentPath());
assertEquals("activemq", item.getName());
item = getRootRouter().retrieveItem(new ResourceStoreRequest("/groups/test/activemq/", false));
assertEquals("/groups/test/activemq", item.getPath());
assertEquals("/groups/test", item.getParentPath());
assertEquals("activemq", item.getName());
// against reposes
item =
getRepositoryRegistry().getRepository("repo1").retrieveItem(
new ResourceStoreRequest("/activemq", false));
assertEquals("/activemq", item.getPath());
assertEquals("/", item.getParentPath());
assertEquals("activemq", item.getName());
item =
getRepositoryRegistry().getRepository("repo1").retrieveItem(
new ResourceStoreRequest("/activemq", false));
assertEquals("/activemq", item.getPath());
assertEquals("/", item.getParentPath());
assertEquals("activemq", item.getName());
item =
getRepositoryRegistry().getRepository("repo1").retrieveItem(
new ResourceStoreRequest("/activemq/activemq-core/1.2", false));
assertEquals("/activemq/activemq-core/1.2", item.getPath());
assertEquals("/activemq/activemq-core", item.getParentPath());
assertEquals("1.2", item.getName());
assertTrue(StorageCollectionItem.class.isAssignableFrom(item.getClass()));
StorageCollectionItem coll = (StorageCollectionItem) item;
Collection<StorageItem> items = coll.list();
assertEquals(1, items.size());
StorageItem collItem = items.iterator().next();
assertEquals("/activemq/activemq-core/1.2/activemq-core-1.2.jar", collItem.getPath());
assertEquals("activemq-core-1.2.jar", collItem.getName());
assertEquals("/activemq/activemq-core/1.2", collItem.getParentPath());
}