@Test public void testExceptionOnCopingFile() throws Exception { prepareRepositoriesForMovingAndCoping(); ItemHandle itemHandle = artifactory.repository(NEW_LOCAL_FROM).file("a/a"); try { itemHandle.copy(NEW_LOCAL_TO, PATH); } catch (CopyMoveException e) { assertTrue(curl("api/copy/" + NEW_LOCAL_FROM + "/a/a?to=" + NEW_LOCAL_TO + "/" + PATH, "POST").contains(e.getCopyMoveResultReport().getMessages().get(0).getMessage())); } finally { deleteAllRelatedRepos(); } }
@Test public void testExceptionOnMovingFile() throws Exception { prepareRepositoriesForMovingAndCoping(); ItemHandle itemHandle = artifactory.repository(NEW_LOCAL_FROM).file("a/a"); try { itemHandle.move(NEW_LOCAL_TO, PATH); } catch (CopyMoveException e) { assertTrue(curl("api/move/" + NEW_LOCAL_FROM + "/a/a?to=" + NEW_LOCAL_TO + "/" + PATH, "POST").contains(e.getCopyMoveResultReport().getMessages().get(0).getMessage())); } finally { deleteAllRelatedRepos(); } }
@Test public void testMoveFile() throws Exception { try { prepareRepositoriesForMovingAndCoping(); ItemHandle itemHandle = artifactory.repository(NEW_LOCAL_FROM).file(PATH); ItemHandle newItemHandle = itemHandle.move(NEW_LOCAL_TO, PATH); checkTheEqualityOfFiles(newItemHandle, NEW_LOCAL_TO, PATH); } finally { deleteAllRelatedRepos(); } }
@Test public void testMoveDirectory() throws Exception { try { prepareRepositoriesForMovingAndCoping(); ItemHandle itemHandle = artifactory.repository(NEW_LOCAL_FROM).folder("m"); String path = "abc"; checkTheEqualityOfFolders(itemHandle.move(NEW_LOCAL_TO, path), NEW_LOCAL_TO, path); } finally { deleteAllRelatedRepos(); } }
@Test public void testCopyFile() throws Exception { try { prepareRepositoriesForMovingAndCoping(); ItemHandle itemHandle = artifactory.repository(NEW_LOCAL_FROM).file(PATH); ItemHandle newItemHandle = itemHandle.copy(NEW_LOCAL_TO, PATH); checkTheEqualityOfFiles(newItemHandle, NEW_LOCAL_TO, PATH); } finally { deleteAllRelatedRepos(); } }
@Test public void testCopyDirectory() throws Exception { try { prepareRepositoriesForMovingAndCoping(); ItemHandle itemHandle = artifactory.repository(NEW_LOCAL_FROM).folder("m"); String path = "abc"; checkTheEqualityOfFolders(itemHandle.copy(NEW_LOCAL_TO, path), NEW_LOCAL_TO, path); } finally { deleteAllRelatedRepos(); } }