public void testFindByPrimaryKeyExisting() throws Exception { IGFolder newIGFolder = addIGFolder(); IGFolder existingIGFolder = _persistence.findByPrimaryKey(newIGFolder.getPrimaryKey()); assertEquals(existingIGFolder, newIGFolder); }
public void testUpdateExisting() throws Exception { long pk = nextLong(); IGFolder newIGFolder = _persistence.create(pk); newIGFolder.setUuid(randomString()); newIGFolder.setGroupId(nextLong()); newIGFolder.setCompanyId(nextLong()); newIGFolder.setUserId(nextLong()); newIGFolder.setCreateDate(nextDate()); newIGFolder.setModifiedDate(nextDate()); newIGFolder.setParentFolderId(nextLong()); newIGFolder.setName(randomString()); newIGFolder.setDescription(randomString()); _persistence.update(newIGFolder, false); IGFolder existingIGFolder = _persistence.findByPrimaryKey(newIGFolder.getPrimaryKey()); assertEquals(existingIGFolder.getUuid(), newIGFolder.getUuid()); assertEquals(existingIGFolder.getFolderId(), newIGFolder.getFolderId()); assertEquals(existingIGFolder.getGroupId(), newIGFolder.getGroupId()); assertEquals(existingIGFolder.getCompanyId(), newIGFolder.getCompanyId()); assertEquals(existingIGFolder.getUserId(), newIGFolder.getUserId()); assertEquals( Time.getShortTimestamp(existingIGFolder.getCreateDate()), Time.getShortTimestamp(newIGFolder.getCreateDate())); assertEquals( Time.getShortTimestamp(existingIGFolder.getModifiedDate()), Time.getShortTimestamp(newIGFolder.getModifiedDate())); assertEquals(existingIGFolder.getParentFolderId(), newIGFolder.getParentFolderId()); assertEquals(existingIGFolder.getName(), newIGFolder.getName()); assertEquals(existingIGFolder.getDescription(), newIGFolder.getDescription()); }
public void testRemove() throws Exception { IGFolder newIGFolder = addIGFolder(); _persistence.remove(newIGFolder); IGFolder existingIGFolder = _persistence.fetchByPrimaryKey(newIGFolder.getPrimaryKey()); assertNull(existingIGFolder); }
public void testCreate() throws Exception { long pk = nextLong(); IGFolder igFolder = _persistence.create(pk); assertNotNull(igFolder); assertEquals(igFolder.getPrimaryKey(), pk); }
protected Resource toResource(WebDAVRequest webDavRequest, IGFolder folder, boolean appendPath) { String parentPath = getRootPath() + webDavRequest.getPath(); String name = StringPool.BLANK; if (appendPath) { name = folder.getName(); } Resource resource = new BaseResourceImpl( parentPath, name, folder.getName(), folder.getCreateDate(), folder.getModifiedDate()); resource.setModel(folder); resource.setClassName(IGFolder.class.getName()); resource.setPrimaryKey(folder.getPrimaryKey()); return resource; }