Commit a5c01570 authored by Jay Jay Billings's avatar Jay Jay Billings
Browse files

Finished first implementation loadItem(IFile) operations and tests.



Updated the client, core, the ItemManager and associated tests to
support and test the ability to loadItems from IFiles. This has not been
tested in the product yet and there are some obvious bugs to work out.
This is just the initial cut of the code.
Signed-off-by: default avatarJay Jay Billings <billingsjj@ornl.gov>
parent f98d2f64
......@@ -19,8 +19,32 @@ import static org.junit.Assert.fail;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
import java.net.URI;
import java.util.ArrayList;
import java.util.Map;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFileState;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IPathVariableManager;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.resources.IResourceProxy;
import org.eclipse.core.resources.IResourceProxyVisitor;
import org.eclipse.core.resources.IResourceVisitor;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourceAttributes;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.QualifiedName;
import org.eclipse.core.runtime.content.IContentDescription;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.ice.client.internal.Client;
import org.eclipse.ice.datastructures.ICEObject.Identifiable;
import org.eclipse.ice.datastructures.form.Form;
......@@ -28,6 +52,7 @@ import org.eclipse.ice.datastructures.form.FormStatus;
import org.eclipse.ice.datastructures.resource.ICEResource;
import org.junit.Before;
import org.junit.Test;
import org.omg.CORBA.ORB;
/**
* ClientTester checks the behavior and functionality of Client. It checks for
......@@ -231,8 +256,8 @@ public class ClientTester {
}
// Make sure that there are no items
assertEquals(0, iCEClient.getItems().size());
System.out.println("Num ITEMS after delete = "
+ iCEClient.getItems().size());
System.out.println(
"Num ITEMS after delete = " + iCEClient.getItems().size());
return;
}
......@@ -511,4 +536,650 @@ public class ClientTester {
}
/**
* This operation tests
* {@link org.eclipse.ice.client.internal.Client.loadItem}.
*/
@Test
public void checkLoad() {
// Make sure the fake core is called on a load.
IFile itemFile = new TestIFile();
iCEClient.loadItem(itemFile);
assertTrue(fakeCore.wasLoaded());
return;
}
/**
* A dummy IFile for testing the loadItem function.
*
* @author Jay Jay Billings
*
*/
public class TestIFile implements IFile {
@Override
public boolean isConflicting(ISchedulingRule rule) {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean contains(ISchedulingRule rule) {
// TODO Auto-generated method stub
return false;
}
@Override
public <T> T getAdapter(Class<T> adapter) {
// TODO Auto-generated method stub
return null;
}
@Override
public void touch(IProgressMonitor monitor) throws CoreException {
// TODO Auto-generated method stub
}
@Override
public void setTeamPrivateMember(boolean isTeamPrivate)
throws CoreException {
// TODO Auto-generated method stub
}
@Override
public void setSessionProperty(QualifiedName key, Object value)
throws CoreException {
// TODO Auto-generated method stub
}
@Override
public void setResourceAttributes(ResourceAttributes attributes)
throws CoreException {
// TODO Auto-generated method stub
}
@Override
public void setReadOnly(boolean readOnly) {
// TODO Auto-generated method stub
}
@Override
public void setPersistentProperty(QualifiedName key, String value)
throws CoreException {
// TODO Auto-generated method stub
}
@Override
public long setLocalTimeStamp(long value) throws CoreException {
// TODO Auto-generated method stub
return 0;
}
@Override
public void setLocal(boolean flag, int depth, IProgressMonitor monitor)
throws CoreException {
// TODO Auto-generated method stub
}
@Override
public void setHidden(boolean isHidden) throws CoreException {
// TODO Auto-generated method stub
}
@Override
public void setDerived(boolean isDerived, IProgressMonitor monitor)
throws CoreException {
// TODO Auto-generated method stub
}
@Override
public void setDerived(boolean isDerived) throws CoreException {
// TODO Auto-generated method stub
}
@Override
public void revertModificationStamp(long value) throws CoreException {
// TODO Auto-generated method stub
}
@Override
public void refreshLocal(int depth, IProgressMonitor monitor)
throws CoreException {
// TODO Auto-generated method stub
}
@Override
public void move(IProjectDescription description, boolean force,
boolean keepHistory, IProgressMonitor monitor)
throws CoreException {
// TODO Auto-generated method stub
}
@Override
public void move(IProjectDescription description, int updateFlags,
IProgressMonitor monitor) throws CoreException {
// TODO Auto-generated method stub
}
@Override
public void move(IPath destination, int updateFlags,
IProgressMonitor monitor) throws CoreException {
// TODO Auto-generated method stub
}
@Override
public void move(IPath destination, boolean force,
IProgressMonitor monitor) throws CoreException {
// TODO Auto-generated method stub
}
@Override
public boolean isVirtual() {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean isTeamPrivateMember(int options) {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean isTeamPrivateMember() {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean isSynchronized(int depth) {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean isPhantom() {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean isLocal(int depth) {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean isLinked(int options) {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean isLinked() {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean isHidden(int options) {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean isHidden() {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean isDerived(int options) {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean isDerived() {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean isAccessible() {
// TODO Auto-generated method stub
return false;
}
@Override
public IWorkspace getWorkspace() {
// TODO Auto-generated method stub
return null;
}
@Override
public int getType() {
// TODO Auto-generated method stub
return 0;
}
@Override
public Object getSessionProperty(QualifiedName key)
throws CoreException {
// TODO Auto-generated method stub
return null;
}
@Override
public Map<QualifiedName, Object> getSessionProperties()
throws CoreException {
// TODO Auto-generated method stub
return null;
}
@Override
public ResourceAttributes getResourceAttributes() {
// TODO Auto-generated method stub
return null;
}
@Override
public URI getRawLocationURI() {
// TODO Auto-generated method stub
return null;
}
@Override
public IPath getRawLocation() {
// TODO Auto-generated method stub
return null;
}
@Override
public IPath getProjectRelativePath() {
// TODO Auto-generated method stub
return null;
}
@Override
public IProject getProject() {
// TODO Auto-generated method stub
return null;
}
@Override
public String getPersistentProperty(QualifiedName key)
throws CoreException {
// TODO Auto-generated method stub
return null;
}
@Override
public Map<QualifiedName, String> getPersistentProperties()
throws CoreException {
// TODO Auto-generated method stub
return null;
}
@Override
public IPathVariableManager getPathVariableManager() {
// TODO Auto-generated method stub
return null;
}
@Override
public IContainer getParent() {
// TODO Auto-generated method stub
return null;
}
@Override
public long getModificationStamp() {
// TODO Auto-generated method stub
return 0;
}
@Override
public IMarker getMarker(long id) {
// TODO Auto-generated method stub
return null;
}
@Override
public URI getLocationURI() {
// TODO Auto-generated method stub
return null;
}
@Override
public IPath getLocation() {
// TODO Auto-generated method stub
return null;
}
@Override
public long getLocalTimeStamp() {
// TODO Auto-generated method stub
return 0;
}
@Override
public String getFileExtension() {
// TODO Auto-generated method stub
return null;
}
@Override
public int findMaxProblemSeverity(String type, boolean includeSubtypes,
int depth) throws CoreException {
// TODO Auto-generated method stub
return 0;
}
@Override
public IMarker[] findMarkers(String type, boolean includeSubtypes,
int depth) throws CoreException {
// TODO Auto-generated method stub
return null;
}
@Override
public IMarker findMarker(long id) throws CoreException {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean exists() {
// TODO Auto-generated method stub
return false;
}
@Override
public void deleteMarkers(String type, boolean includeSubtypes,
int depth) throws CoreException {
// TODO Auto-generated method stub
}
@Override
public void delete(int updateFlags, IProgressMonitor monitor)
throws CoreException {
// TODO Auto-generated method stub
}
@Override
public void delete(boolean force, IProgressMonitor monitor)
throws CoreException {
// TODO Auto-generated method stub
}
@Override
public IResourceProxy createProxy() {
// TODO Auto-generated method stub
return null;
}
@Override
public IMarker createMarker(String type) throws CoreException {
// TODO Auto-generated method stub
return null;
}
@Override
public void copy(IProjectDescription description, int updateFlags,
IProgressMonitor monitor) throws CoreException {
// TODO Auto-generated method stub
}
@Override
public void copy(IProjectDescription description, boolean force,
IProgressMonitor monitor) throws CoreException {
// TODO Auto-generated method stub
}
@Override
public void copy(IPath destination, int updateFlags,
IProgressMonitor monitor) throws CoreException {
// TODO Auto-generated method stub
}
@Override
public void copy(IPath destination, boolean force,
IProgressMonitor monitor) throws CoreException {
// TODO Auto-generated method stub
}
@Override
public void clearHistory(IProgressMonitor monitor)
throws CoreException {
// TODO Auto-generated method stub
}
@Override
public void accept(IResourceVisitor visitor, int depth, int memberFlags)
throws CoreException {
// TODO Auto-generated method stub
}
@Override
public void accept(IResourceVisitor visitor, int depth,
boolean includePhantoms) throws CoreException {
// TODO Auto-generated method stub
}
@Override
public void accept(IResourceProxyVisitor visitor, int depth,
int memberFlags) throws CoreException {
// TODO Auto-generated method stub
}
@Override
public void accept(IResourceProxyVisitor visitor, int memberFlags)
throws CoreException {
// TODO Auto-generated method stub
}
@Override
public void accept(IResourceVisitor visitor) throws CoreException {
// TODO Auto-generated method stub
}
@Override
public void setContents(IFileState source, boolean force,
boolean keepHistory, IProgressMonitor monitor)
throws CoreException {
// TODO Auto-generated method stub
}
@Override
public void setContents(InputStream source, boolean force,
boolean keepHistory, IProgressMonitor monitor)
throws CoreException {
// TODO Auto-generated method stub
}
@Override
public void setContents(IFileState source, int updateFlags,
IProgressMonitor monitor) throws CoreException {
// TODO Auto-generated method stub
}
@Override
public void setContents(InputStream source, int updateFlags,
IProgressMonitor monitor) throws CoreException {
// TODO Auto-generated method stub
}
@Override
public void setCharset(String newCharset, IProgressMonitor monitor)
throws CoreException {
// TODO Auto-generated method stub
}
@Override
public void setCharset(String newCharset) throws CoreException {
// TODO Auto-generated method stub
}
@Override
public void move(IPath destination, boolean force, boolean keepHistory,
IProgressMonitor monitor) throws CoreException {
// TODO Auto-generated method stub
}
@Override
public boolean isReadOnly() {
// TODO Auto-generated method stub
return false;
}
@Override
public String getName() {
// TODO Auto-generated method stub