public void testGetSetResourcePath() throws Exception { String path = getResourcePath("/path/to/resource"); CDOSession session = openSession(); CDOTransaction transaction = session.openTransaction(); CDOResource resource = transaction.createResource(path); assertEquals(path, resource.eGet(PATH_ATTRIBUTE)); String newPath = getResourcePath("/new/folder/resource"); resource.eSet(PATH_ATTRIBUTE, newPath); assertEquals(newPath, resource.getPath()); assertEquals(transaction.getResourceFolder(getParent(newPath)), resource.getFolder()); transaction.commit(); assertEquals(newPath, resource.getPath()); assertEquals(transaction.getResourceFolder(getParent(newPath)), resource.getFolder()); resource.eSet(PATH_ATTRIBUTE, path); assertEquals(path, resource.getPath()); assertEquals(transaction.getResourceFolder(getParent(path)), resource.getFolder()); assertEquals(path, resource.eGet(PATH_ATTRIBUTE)); }
public void testGetSetFolderPath() throws Exception { String path = getResourcePath("/path/to/folder"); CDOSession session = openSession(); CDOTransaction transaction = session.openTransaction(); CDOResourceFolder folder = transaction.createResourceFolder(path); assertEquals(path, folder.eGet(PATH_ATTRIBUTE)); String newPath = getResourcePath("/atRoot"); // At root of test case folder namespace! folder.eSet(PATH_ATTRIBUTE, newPath); assertEquals(newPath, folder.getPath()); assertEquals(newPath, folder.eGet(PATH_ATTRIBUTE)); assertEquals(transaction.getResourceFolder(getParent(newPath)), folder.getFolder()); transaction.commit(); assertEquals(newPath, folder.getPath()); assertEquals(newPath, folder.eGet(PATH_ATTRIBUTE)); assertEquals(transaction.getResourceFolder(getParent(newPath)), folder.getFolder()); folder.eSet(PATH_ATTRIBUTE, path); assertEquals(path, folder.getPath()); assertEquals(path, folder.eGet(PATH_ATTRIBUTE)); assertEquals(transaction.getResourceFolder(getParent(path)), folder.getFolder()); }