Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'tests/org.eclipse.jem.tests/javatests')
-rw-r--r--tests/org.eclipse.jem.tests/javatests/InitParserTest46376.java31
-rw-r--r--tests/org.eclipse.jem.tests/javatests/initParserTest46376/SameNameTestClass.java38
-rw-r--r--tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/.classpath6
-rw-r--r--tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/AllSuites.java79
-rw-r--r--tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/JavaProjectUtil.java260
-rw-r--r--tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/JavaTestsPlugin.java38
-rw-r--r--tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/beaninfo/AbstractBeanInfoTestCase.java99
-rw-r--r--tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/beaninfo/BeanInfoSuite.java101
-rw-r--r--tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/beaninfo/TestAWTSwingUI.java536
-rw-r--r--tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/beaninfo/TestReflection.java184
-rw-r--r--tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/beaninfo/TestStandard.java630
-rw-r--r--tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/instantiation/InstantiationSuite.java98
-rw-r--r--tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/instantiation/TestStandard.java200
-rw-r--r--tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/modelListeners/IListenerTester.java30
-rw-r--r--tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/modelListeners/ListenersSuite.java93
-rw-r--r--tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/modelListeners/TestBeanInfo.java173
-rw-r--r--tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/modelListeners/TestBeaninfoAdapterFactory.java124
-rw-r--r--tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/modelListeners/TestJEM.java135
-rw-r--r--tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/modelListeners/TestJavaJDOMAdapterFactory.java234
-rw-r--r--tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/modelListeners/TestListeners.java350
-rw-r--r--tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/AbstractTestProxy.java110
-rw-r--r--tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/ExpressionTest.java1158
-rw-r--r--tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/ProxySuite.java86
-rw-r--r--tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/TestAWTProxy.java119
-rw-r--r--tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/TestCallback.java128
-rw-r--r--tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/TestCallbackStream.java112
-rw-r--r--tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/TestStandard.java639
-rw-r--r--tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/ide/IDEProxySuite.java93
-rw-r--r--tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/AbstractInitParserTestCase.java70
-rw-r--r--tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/AbstractInitStringParserTestHelper.java66
-rw-r--r--tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/ArrayConstructorTest.java130
-rw-r--r--tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/BlockTest.java108
-rw-r--r--tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/BorderTest.java114
-rw-r--r--tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/CastTest.java79
-rw-r--r--tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/CharTest.java51
-rw-r--r--tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/ExceptionTest.java45
-rw-r--r--tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/InitParserSuite.java85
-rw-r--r--tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/InitStringParserTestHelper.java134
-rw-r--r--tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/JFCTest.java136
-rw-r--r--tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/LiteralTest.java48
-rw-r--r--tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/MultiArgConstructorTest.java62
-rw-r--r--tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/MultiArgInstanceTest.java54
-rw-r--r--tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/MultiArgStaticMethodTest.java54
-rw-r--r--tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/NavigationParameters.java238
-rw-r--r--tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/NeedsCodingTest.java54
-rw-r--r--tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/NumberTest.java69
-rw-r--r--tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/OverloadingTest.java40
-rw-r--r--tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/SameName46376Test.java41
-rw-r--r--tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/StringTest.java54
-rw-r--r--tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/tree/ASTArraysTest.java64
-rw-r--r--tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/tree/ASTFieldAccessTest.java71
-rw-r--r--tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/tree/ASTInnerClassAccessTest.java71
-rw-r--r--tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/tree/ASTMiscTest.java70
-rw-r--r--tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/tree/ASTNestFieldAccessTestData.java29
-rw-r--r--tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/tree/ASTOperationsTest.java84
-rw-r--r--tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/tree/ASTParserSuite.java131
-rw-r--r--tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/tree/ASTTreeInitStringParserTestHelper.java238
-rw-r--r--tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/tree/InnerClassTestData.java76
-rw-r--r--tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/remote/RemoteProxySuite.java123
-rw-r--r--tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/remote/TestProjectAccess.java62
60 files changed, 0 insertions, 8635 deletions
diff --git a/tests/org.eclipse.jem.tests/javatests/InitParserTest46376.java b/tests/org.eclipse.jem.tests/javatests/InitParserTest46376.java
deleted file mode 100644
index 8a51e0cb..00000000
--- a/tests/org.eclipse.jem.tests/javatests/InitParserTest46376.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * $RCSfile: InitParserTest46376.java,v $
- * $Revision: 1.2 $ $Date: 2005/02/15 23:00:16 $
- */
-
-/**
- * This is to test for defect [46376].
- *
- * SameName test. This is test where you have this:
- * initParserTest46376.SameNameTestClass.java
- * InitParserTest46376.java
- *
- * Before [46376] the Static parser would find throw NoClassDefFoundError on initParserTest46376 when looking for
- * SameNameTestClass and never find the class.
- *
- * To compile in Eclipse we need to have one of the classes be in the default package. Eclipse complains if we didn't.
- * But there is nothing to stop this from happening with packages too if they are spread across compile groups.
- */
-public class InitParserTest46376 {
-
-}
diff --git a/tests/org.eclipse.jem.tests/javatests/initParserTest46376/SameNameTestClass.java b/tests/org.eclipse.jem.tests/javatests/initParserTest46376/SameNameTestClass.java
deleted file mode 100644
index 223ab567..00000000
--- a/tests/org.eclipse.jem.tests/javatests/initParserTest46376/SameNameTestClass.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package initParserTest46376;
-/*******************************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * $RCSfile: SameNameTestClass.java,v $
- * $Revision: 1.2 $ $Date: 2005/02/15 23:00:16 $
- */
-/**
- * This is to test for defect [46376].
- *
- * SameName test. This is test where you have this:
- * InitParserTest46376.SameNameTestClass.java
- * InitParserTest46376.java
- *
- * and
- *
- * new org.eclipse.jem.tests.proxy.initParser.SameNameTestClass.RealClass()
- *
- * Before [46376] the Static parser would find SameNameTestClass.java instead of the RealClass and would of failed.
- * To compile in Eclipse we need to have one of the classes be in the default package. Eclipse complains if we didn't.
- * But there is nothing to stop this from happening with packages too if they are spread across compile groups.
- */
-public class SameNameTestClass {
-
- public boolean equals(Object other) {
- // To make test easier, we simply looking if both of same type.
- return other != null && other.getClass() == SameNameTestClass.class;
- }
-
-}
diff --git a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/.classpath b/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/.classpath
deleted file mode 100644
index fb501163..00000000
--- a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/.classpath
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/AllSuites.java b/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/AllSuites.java
deleted file mode 100644
index 0092c676..00000000
--- a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/AllSuites.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jem.tests;
-/*
- * $RCSfile: AllSuites.java,v $
- * $Revision: 1.6 $ $Date: 2005/02/15 23:00:16 $
- */
-import org.eclipse.jem.tests.beaninfo.BeanInfoSuite;
-import org.eclipse.jem.tests.instantiation.InstantiationSuite;
-import org.eclipse.jem.tests.modelListeners.ListenersSuite;
-import org.eclipse.jem.tests.proxy.ide.IDEProxySuite;
-import org.eclipse.jem.tests.proxy.initParser.InitParserSuite;
-import org.eclipse.jem.tests.proxy.initParser.tree.ASTParserSuite;
-import org.eclipse.jem.tests.proxy.remote.RemoteProxySuite;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-public class AllSuites extends TestSuite {
- // Testa cases to be include in the suite
- private static Class suitesList[] = {
- InitParserSuite.class,
- ASTParserSuite.class,
- RemoteProxySuite.class,
- IDEProxySuite.class,
- BeanInfoSuite.class,
- InstantiationSuite.class,
- ListenersSuite.class,
- } ;
- public static String pkgName = "Java EMF Model jUnit Test Suite" ;
-
- /**
- * Constructor for PackageSuite.
- */
- public AllSuites() {
- super();
- populateSuite() ;
- }
-
- /**
- * Constructor for PackageSuite.
- * @param theClass
- */
- public AllSuites(Class theClass) {
- super(theClass);
- populateSuite() ;
- }
-
- /**
- * Constructor for PackageSuite.
- * @param name
- */
- public AllSuites(String name) {
- super(name);
- populateSuite() ;
- }
-
- private void populateSuite () {
- for (int i=0; i<suitesList.length; i++)
- try {
- Test ts = (Test) suitesList[i].newInstance() ;
- addTest(ts) ;
- }
- catch (Exception e) {}
- }
-
- public static Test suite() {
- return new AllSuites(pkgName);
- }
-
-}
diff --git a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/JavaProjectUtil.java b/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/JavaProjectUtil.java
deleted file mode 100644
index 35a1882e..00000000
--- a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/JavaProjectUtil.java
+++ /dev/null
@@ -1,260 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jem.tests;
-/*
- * $RCSfile: JavaProjectUtil.java,v $
- * $Revision: 1.11 $ $Date: 2005/02/15 23:00:16 $
- */
-
-
-import java.io.File;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import org.eclipse.ant.core.AntRunner;
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.jobs.IJobManager;
-import org.eclipse.jdt.core.*;
-import org.osgi.framework.Bundle;
-
-import org.eclipse.jem.internal.proxy.core.ProxyPlugin;
-
-/**
- * The purpose of this class is to be a utility for manipulating/populating java projects.
- * 1) Get a java project as one of the resources.
- * 2) Create a project from a directory. The directory needs to be all set up to be a project already. Typically
- * from an unzip.
- */
-
-public class JavaProjectUtil {
- public static IProject getProject(String projectName) throws CoreException {
- IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
- return (project.exists()) ? project: null;
- }
-
-
- /**
- * Create a project from the path. The path will be a complete project, including a .project file.
- *
- * @param workspace
- * @param projectPath Needs to be a complete path to a directory within the file system. The directory must be a complete project including .project file.
- * @param pm
- * @return The new IProject.
- * @throws CoreException
- */
- public static IProject createProject(IWorkspace workspace, IPath projectPath, final IProgressMonitor pm) throws CoreException {
- IProjectDescription newDescription = null;
-
- File projectFile = new File(projectPath.toFile(), IProjectDescription.DESCRIPTION_FILE_NAME);
- if (!projectFile.exists())
- throw new CoreException(new Status(IStatus.ERROR, JavaTestsPlugin.getPlugin().getBundle().getSymbolicName(), 0, "Project file not in project directory. Couldn't create project \""+projectPath.toString()+"\"", null));
-
-
- IPath projectFilePath = new Path(projectFile.getPath());
- newDescription = workspace.loadProjectDescription(projectFilePath);
-
- // create the new project operation
- final IProject project = workspace.getRoot().getProject(newDescription.getName());
- final IProjectDescription description = newDescription;
- ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- project.create(description, new SubProgressMonitor(monitor, 1000));
- project.open(new SubProgressMonitor(monitor, 1000));
- }
- }, project, 0, pm);
-
- return project;
- }
-
- /**
- * Create an empty project in the workspace root. If there is a .project file already there, then use it.
- * @param workspace The workspace to create projec in.
- * @param projectPath The name of the project. It should only be one segment long, and that will be the name of the project.
- * @param pm
- * @return The project.
- * @throws CoreException
- *
- * @since 1.0.0
- */
- public static IProject createEmptyJavaProject(IWorkspace workspace, IPath projectPath, final IProgressMonitor pm) throws CoreException {
- projectPath = workspace.getRoot().getFullPath().append(projectPath); // Put it into the workspace relative.
- File projectFile = new File(projectPath.toFile(), IProjectDescription.DESCRIPTION_FILE_NAME);
- if (projectFile.exists())
- return createProject(workspace, projectPath, pm); // Let it be created normally.
-
- // create the new project operation
- final IProject project = workspace.getRoot().getProject(projectPath.lastSegment());
- ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- project.create(new SubProgressMonitor(monitor, 1000));
- project.open(new SubProgressMonitor(monitor, 1000));
- IProjectDescription description = project.getDescription();
- String[] natureids = description.getNatureIds();
- for (int i = 0; i < natureids.length; i++) {
- if (natureids[i].equals("org.eclipse.jdt.core.javanature"))
- return; // Already has nature.
- }
- String[] newNatureids = new String[natureids.length+1];
- newNatureids[0] = "org.eclipse.jdt.core.javanature";
- System.arraycopy(natureids, 0, newNatureids, 1, natureids.length);
- description.setNatureIds(newNatureids);
- project.setDescription(description, new SubProgressMonitor(monitor, 1000));
- // Need to put out a classfile too. We need a src and a bin directory for the classpath.
- IFolder sf = project.getFolder("src");
- sf.create(true, true, new SubProgressMonitor(monitor, 1000));
- IFolder bf = project.getFolder("bin");
- bf.create(true, true, new SubProgressMonitor(monitor, 1000));
- IFile cp = project.getFile(".classpath");
- try {
- cp.create(getClass().getResource(".classpath").openStream(), true, new SubProgressMonitor(monitor, 1000));
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- }, workspace.getRoot(), 0, pm);
-
- return project;
- }
-
- /**
- * Delete a project and all files from the project.
- * @param project
- * @throws CoreException
- */
- public static void deleteProject(IProject project) throws CoreException {
- if (project != null) {
- project.delete(true, false, null); // Get rid of the project and the files themselves.
- }
- }
-
-
- /**
- * This sets the workspace autobuild to the specified state. It returns what
- * the state was previously so that it can be later restored.
- * @param autoBuild
- * @return Previous autoBuild state.
- * @throws CoreException
- */
- public static boolean setAutoBuild(boolean autoBuild) throws CoreException {
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- if (autoBuild != workspace.isAutoBuilding()) {
- IWorkspaceDescription description = workspace.getDescription();
- description.setAutoBuilding(true);
- workspace.setDescription(description);
- return !autoBuild; // It wasn't this state.
- } else
- return autoBuild; // It already is this state.
- }
-
- /**
- * Import the given projects from the given zipfiles into the current workspace root.
- * @param projectNames The array of project names to create
- * @param zipFiles The zipfiles containing each project. It must be a complete project.
- * The first directory in the zip must be the project directory.
- * It must be the same name as from projectNames. Also it must include a .project file
- * in that directory.
- * @return The array of IProjects that were created.
- * @throws CoreException
- */
- public static IProject[] importProjects(final String[] projectNames, final String[] zipFiles) throws CoreException {
- // Delete/create/populate within a runnable so that the build is done only after all changes have been made.
- // Make sure autobuild is on.
- final IWorkspace workspace = ResourcesPlugin.getWorkspace();
- final IProject[] result = new IProject[projectNames.length];
- workspace.run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- // First import all, then after that, create the projects.
- IPath rootLocation = workspace.getRoot().getLocation();
- URL installLoc = JavaTestsPlugin.getPlugin().getBundle().getEntry("/");
- try {
- String antFile = Platform.asLocalURL(new URL(installLoc, "testdata/unzip.xml")).getFile();
- for (int i = 0; i < zipFiles.length; i++) {
- // First create/recreate the project.
- IProject p = getProject(projectNames[i]);
- if (p != null)
- p.delete(true, true, new SubProgressMonitor(monitor, 50)); // Get rid of it, we want a clean one for testing.
-
- // Now import the requested files.
- AntRunner ant = new AntRunner();
- ant.setBuildFileLocation(antFile);
- ant.setArguments(new String[] { "-Dzipfrom=" + zipFiles[i], "-Dzipto=" + rootLocation.toString()});
- ant.run(new SubProgressMonitor(monitor, 50));
- }
- for (int i = 0; i < zipFiles.length; i++) {
- result[i] = createProject(workspace, rootLocation.append(projectNames[i]), new SubProgressMonitor(monitor, 50));
- }
- } catch (MalformedURLException e) {
- } catch (IOException e) {
- }
- }
- }, workspace.getRoot(), 0, null);
-
- return result;
- }
-
- static int cfSuffix = 0;
- /**
- * Add a path to plugin jar to the java project's class path.
- * @param bundle The plugin where the jar is located.
- * @param pathToJar Path to the jar within the above plugin
- * @param project java project to add to.
- *
- * @since 1.0.0
- */
- public static void addBundleJarToPath(Bundle bundle, String pathToJar, final IJavaProject project, IProgressMonitor pm) throws CoreException {
- final IPath actualPath = new Path(ProxyPlugin.getPlugin().localizeFromBundleAndFragments(bundle, pathToJar));
- if (actualPath.isEmpty())
- return; // Didn't exist.
-
- final IWorkspace workspace = ResourcesPlugin.getWorkspace();
- workspace.run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- if (actualPath.toFile().isFile()) {
- // It is a jar, this will be during runtime
- // Create an external jar entry.
- IClasspathEntry[] raw = project.getRawClasspath();
- IClasspathEntry[] newRaw = new IClasspathEntry[raw.length+1];
- newRaw[raw.length] = JavaCore.newLibraryEntry(actualPath, null, null);
- System.arraycopy(raw, 0, newRaw, 0, raw.length);
- project.setRawClasspath(newRaw, new SubProgressMonitor(monitor, 100));
- } else {
- // It is a path to class folder, this will be during development time.
- // But classfolders MUST exist in the workspace. JDT doesn't understand them outside workspace,
- // so we will link it into the project.
- IFolder cf = project.getProject().getFolder("linkbin"+(++cfSuffix));
- cf.createLink(actualPath, 0, new SubProgressMonitor(monitor, 100));
- // Create class folder entry.
- IClasspathEntry[] raw = project.getRawClasspath();
- IClasspathEntry[] newRaw = new IClasspathEntry[raw.length+1];
- newRaw[raw.length] = JavaCore.newLibraryEntry(cf.getFullPath(), null, null);
- System.arraycopy(raw, 0, newRaw, 0, raw.length);
- project.setRawClasspath(newRaw, new SubProgressMonitor(monitor, 100));
- }
- }
- }, workspace.getRoot(), 0, pm);
- }
-
- public static void waitForAutoBuild() throws CoreException {
- IJobManager jobManager = Platform.getJobManager();
- if (jobManager.find(ResourcesPlugin.FAMILY_AUTO_BUILD).length > 0) {
- while (true) {
- try {
- jobManager.join(ResourcesPlugin.FAMILY_AUTO_BUILD, new NullProgressMonitor());
- break;
- } catch (InterruptedException e) {
- }
- }
- }
-
- }
-}
diff --git a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/JavaTestsPlugin.java b/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/JavaTestsPlugin.java
deleted file mode 100644
index f1d50833..00000000
--- a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/JavaTestsPlugin.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jem.tests;
-/*
- * $RCSfile: JavaTestsPlugin.java,v $
- * $Revision: 1.5 $ $Date: 2005/02/15 23:00:16 $
- */
-import org.eclipse.core.runtime.Plugin;
-
-/**
- * @author richkulp
- *
- * To change the template for this generated type comment go to
- * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
- */
-public class JavaTestsPlugin extends Plugin {
-
- private static JavaTestsPlugin PLUGIN;
- /**
- * @param descriptor
- */
- public JavaTestsPlugin() {
- PLUGIN = this;
- }
-
- public static JavaTestsPlugin getPlugin() {
- return PLUGIN;
- }
-
-}
diff --git a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/beaninfo/AbstractBeanInfoTestCase.java b/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/beaninfo/AbstractBeanInfoTestCase.java
deleted file mode 100644
index 8a3676b7..00000000
--- a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/beaninfo/AbstractBeanInfoTestCase.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jem.tests.beaninfo;
-/*
- * $RCSfile: AbstractBeanInfoTestCase.java,v $
- * $Revision: 1.9 $ $Date: 2005/02/15 23:00:16 $
- */
-import java.util.*;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-
-import org.eclipse.jem.internal.beaninfo.ImplicitItem;
-import org.eclipse.jem.internal.beaninfo.PropertyDecorator;
-import org.eclipse.jem.internal.beaninfo.adapters.BeaninfoNature;
-import org.eclipse.jem.internal.beaninfo.core.Utilities;
-import org.eclipse.jem.internal.proxy.core.*;
-import org.eclipse.jem.java.JavaClass;
-import org.eclipse.jem.tests.JavaProjectUtil;
-
-/**
- * @author richkulp
- *
- */
-public abstract class AbstractBeanInfoTestCase extends TestCase {
-
- public AbstractBeanInfoTestCase() {
- super();
- }
-
- public AbstractBeanInfoTestCase(String name) {
- super(name);
- }
-
- protected BeaninfoNature nature;
- protected ResourceSet rset;
-
- public static final String
- TEST_BEANINFO_PROJECT = "Test BeanInfo", //$NON-NLS-1$
- TEST_BEANINFO_BEANINFOS_PROJECT = "Test BeanInfo BeanInfos", //$NON-NLS-1$
- TEST_BEANINFO_PREREQ_PROJECT = "Test BeanInfo Prereq"; //$NON-NLS-1$
-
- /* (non-Javadoc)
- * @see junit.framework.TestCase#setUp()
- */
- protected void setUp() throws Exception {
- super.setUp();
- IProject biProject = JavaProjectUtil.getProject(TEST_BEANINFO_PROJECT);
- assertNotNull(biProject);
- nature = BeaninfoNature.getRuntime(biProject);
- assertNotNull(nature);
- rset = nature.getResourceSet();
- assertNotNull(rset);
- // We also want to remove any beaninfos from the search path that aren't from testing so that we don't get any weird side-effects.
- ProxyFactoryRegistry registry = nature.getRegistry();
- IArrayBeanProxy sp = Utilities.getBeanInfoSearchPath(registry);
- // remove any that don't start with org.eclipse.jem.tests.
- int len = sp.getLength();
- for (int i = 0; i < len; i++) {
- String path = ((IStringBeanProxy) sp.get(i)).stringValue();
- if (!path.startsWith("org.eclipse.jem.tests"))
- Utilities.removeBeanInfoPath(registry, path);
- }
- }
-
- protected int objFeatures, objNonProperties; // Object features count and Object non-properties count. This is only initialized as needed.
- protected Set objFeaturesSet;
- /**
- * To initialize the objFeatures and objNonProperties counts when necessary. Not needed for all tests.
- */
- protected void objFeaturesSetup() {
- // Get the number of features that java.lang.Object has:
- JavaClass objClass = (JavaClass) rset.getEObject(URI.createURI("java:/java.lang#Object"), true); //$NON-NLS-1$
- objFeaturesSet = new HashSet();
- objFeatures = objClass.getProperties().size();
- // Find the number of always inherited properties.
- objNonProperties = 0;
- for (Iterator itr0 = objClass.getProperties().iterator(); itr0.hasNext();) {
- EStructuralFeature p = (EStructuralFeature) itr0.next();
- objFeaturesSet.add(p);
- PropertyDecorator pd = Utilities.getPropertyDecorator(p);
- if ( pd == null || (pd.getImplicitDecoratorFlag() == ImplicitItem.NOT_IMPLICIT_LITERAL && !pd.isMergeIntrospection()))
- objNonProperties++;
- }
- }
-
-}
diff --git a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/beaninfo/BeanInfoSuite.java b/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/beaninfo/BeanInfoSuite.java
deleted file mode 100644
index 2fcc94a0..00000000
--- a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/beaninfo/BeanInfoSuite.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jem.tests.beaninfo;
-/*
- * $RCSfile: BeanInfoSuite.java,v $
- * $Revision: 1.9 $ $Date: 2005/02/15 23:00:16 $
- */
-import java.net.URL;
-
-import junit.extensions.TestSetup;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-
-import org.eclipse.jem.internal.beaninfo.adapters.BeaninfoNature;
-import org.eclipse.jem.tests.JavaProjectUtil;
-import org.eclipse.jem.tests.JavaTestsPlugin;
-
-/**
- * @author richkulp
- *
- * This is the true test suite for Beaninfo Testing.
- */
-public class BeanInfoSuite extends TestSetup {
-
- // Test cases to be include in the suite
- private static final Class testsList[] =
- { TestReflection.class, // NOTE: This one must always be first because it does some tests that depend on this.
- TestStandard.class, TestAWTSwingUI.class };
-
- /**
- * Constructor for BeanInfoSuite.
- */
- public BeanInfoSuite(String name) {
- super(new TestSuite(name) {
- {
- for (int i = 0; i < testsList.length; i++) {
- addTestSuite(testsList[i]);
- }
- }
-
- });
- }
-
- public BeanInfoSuite() {
- this("Test BeanInfo Suite");
- }
-
- public static Test suite() {
- return new BeanInfoSuite();
- }
-
- private boolean oldAutoBuildingState; // autoBuilding state before we started.
- protected void setUp() throws Exception {
- System.out.println("-- Initializing the BeanInfo test data --"); //$NON-NLS-1$
- oldAutoBuildingState = JavaProjectUtil.setAutoBuild(true);
- URL installURL = JavaTestsPlugin.getPlugin().getBundle().getEntry("/");
- String[] zipPaths = new String[3];
- zipPaths[0] = Platform.asLocalURL(new URL(installURL, "testdata/testbeaninfo.zip")).getFile();
- zipPaths[1] = Platform.asLocalURL(new URL(installURL, "testdata/testbeaninfobeaninfos.zip")).getFile();
- zipPaths[2] = Platform.asLocalURL(new URL(installURL, "testdata/testbeaninfopreq.zip")).getFile();
- IProject[] projects =
- JavaProjectUtil.importProjects(
- new String[] {
- AbstractBeanInfoTestCase.TEST_BEANINFO_PROJECT,
- AbstractBeanInfoTestCase.TEST_BEANINFO_BEANINFOS_PROJECT,
- AbstractBeanInfoTestCase.TEST_BEANINFO_PREREQ_PROJECT },
- zipPaths);
- assertNotNull(projects[0]);
- assertNotNull(projects[1]);
- assertNotNull(projects[2]);
- JavaProjectUtil.waitForAutoBuild();
- System.out.println("-- Data initialized --"); //$NON-NLS-1$
-
- BeaninfoNature nature = BeaninfoNature.getRuntime(projects[0]);
- assertNotNull(nature);
- }
-
- protected void tearDown() throws Exception {
- ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- JavaProjectUtil.deleteProject(JavaProjectUtil.getProject(AbstractBeanInfoTestCase.TEST_BEANINFO_PROJECT));
- JavaProjectUtil.deleteProject(JavaProjectUtil.getProject(AbstractBeanInfoTestCase.TEST_BEANINFO_BEANINFOS_PROJECT));
- JavaProjectUtil.deleteProject(JavaProjectUtil.getProject(AbstractBeanInfoTestCase.TEST_BEANINFO_PREREQ_PROJECT));
- }
- }, ResourcesPlugin.getWorkspace().getRoot(), 0, null);
-
- JavaProjectUtil.setAutoBuild(oldAutoBuildingState);
- }
-
-}
diff --git a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/beaninfo/TestAWTSwingUI.java b/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/beaninfo/TestAWTSwingUI.java
deleted file mode 100644
index 741b96a4..00000000
--- a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/beaninfo/TestAWTSwingUI.java
+++ /dev/null
@@ -1,536 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jem.tests.beaninfo;
-/*
- * $RCSfile: TestAWTSwingUI.java,v $
- * $Revision: 1.7 $ $Date: 2005/02/15 23:00:16 $
- */
-import java.io.BufferedReader;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.PrintWriter;
-import java.net.URL;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.ENamedElement;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.jem.internal.beaninfo.MethodProxy;
-import org.eclipse.jem.internal.beaninfo.PropertyDecorator;
-import org.eclipse.jem.internal.beaninfo.core.Utilities;
-import org.eclipse.jem.java.JavaClass;
-import org.eclipse.jem.tests.JavaTestsPlugin;
-
-/**
- * @author richkulp
- *
- * AWT/Swing tests
- */
-public class TestAWTSwingUI extends AbstractBeanInfoTestCase {
-
- /**
- *
- */
- public TestAWTSwingUI() {
- super();
- }
-
- /**
- * @param name
- */
- public TestAWTSwingUI(String name) {
- super(name);
- }
-
- /*
- * The number of properties keep increasing by version,
- * but there is a minimal set. This minimal set will be
- * stored in a file and can be loaded by this method.
- * This set can be used to make sure that at least the
- * required properties are there.
- *
- * The filename has to be relative to the tests plugin.
- */
- protected Set getNames(String filename) throws IOException {
- Set names = new HashSet(50);
- URL url = JavaTestsPlugin.getPlugin().getBundle().getEntry(filename);
- assertNotNull(url);
- BufferedReader rdr = new BufferedReader(new InputStreamReader(url.openStream()));
- try {
- String line = null;
- while ((line = rdr.readLine()) != null)
- names.add(line);
- } finally {
- rdr.close();
- }
- return names;
- }
-
- /*
- * Test the names against the set. Print those not found in the set,
- * or those in the againstSet that weren't found. Throw assert error if
- * any from against set not found.
- *
- */
- protected void testIncludesAllNames(String id, List testNames, Set againstSet, Set exclude) {
- Set workingAgainst = new HashSet(againstSet.size());
- workingAgainst.addAll(againstSet); // There may be dup testNames (like for operations), so in that case we leave againstSet alone.
- boolean wroteAny = false;
- for (Iterator itr = testNames.iterator(); itr.hasNext();) {
- ENamedElement testName = (ENamedElement) itr.next();
- if (exclude.contains(testName))
- continue; // This is one we want to ignore
- if (againstSet.contains(testName.getName()))
- workingAgainst.remove(testName.getName()); // Get rid of it since found.
- else {
- if (!wroteAny) {
- wroteAny = true;
- System.out.println("Names in list that are new for " + id + ':');
- }
- System.out.print(" ");
- System.out.println(testName.getName());
- }
- }
- if (wroteAny)
- System.out.println("End of new names.");
-
- if (!workingAgainst.isEmpty()) {
- System.out.println("Names that should of been found, but weren't for " + id + ':');
- for (Iterator itr = workingAgainst.iterator(); itr.hasNext();) {
- String name = (String) itr.next();
- System.out.print(" ");
- System.out.println(name);
- }
- System.out.println("End of missing names");
- fail("Missing some required names for "+id+'.');
- }
- }
-
- /*
- * Write the names out. Call only when want to update list. Filename must
- * be a local file.
- */
- protected void writeNames(String filename, List props, Set excluding) throws FileNotFoundException {
- PrintWriter pr = new PrintWriter(new FileOutputStream(filename));
- try {
- for (Iterator itr = props.iterator(); itr.hasNext();) {
- ENamedElement element = (ENamedElement) itr.next();
- if (excluding != null && excluding.contains(element))
- continue;
- pr.println(element.getName());
- }
- } finally {
- pr.close();
- }
- }
-
- /**
- * Reflect the entire super type hierarchy of the class passed in, including the class itself.
- * @param jclass
- */
- protected void reflectHierachy(JavaClass jclass) {
- JavaClass loopClass = jclass;
- while (loopClass != null) {
- System.out.println("Reflecting for " + loopClass.getQualifiedName()); //$NON-NLS-1$
- loopClass.isFinal(); // This causes reflection.
- loopClass = loopClass.getSupertype();
- }
- }
-
- /**
- * Use when the compares don't match to get a sorted list of operations so that
- * manually verify the count.
- * @param jclass
- */
- protected void showSortedOperations(JavaClass jclass) {
- List allB = jclass.getEAllOperations();
- String[] names = new String[allB.size()];
- for (int i = 0; i < names.length; i++) {
- names[i] = ((MethodProxy) allB.get(i)).getMethod().getMethodElementSignature();
- }
- Arrays.sort(names);
- System.out.println("--- List of Operations for " + jclass.toString());
- for (int i = 0; i < names.length; i++) {
- System.out.println(names[i]);
- }
- }
-
- /**
- * Use when the compares don't match to get a sorted list of properties so that
- * manually verify the count.
- * @param jclass
- */
- protected void showSortedProperties(JavaClass jclass) {
- List allP = jclass.getAllProperties();
- String[] names = new String[allP.size()];
- for (int i = 0; i < names.length; i++) {
- names[i] = ((EStructuralFeature) allP.get(i)).getName();
- }
- Arrays.sort(names);
- System.out.println("--- List of properties for " + jclass.toString());
- for (int i = 0; i < names.length; i++) {
- System.out.println(names[i]);
- }
- }
-
- protected JavaClass getButton() {
- return (JavaClass) rset.getEObject(URI.createURI("java:/java.awt#Button"), true); //$NON-NLS-1$
- }
-
- protected JavaClass getJLabel() {
- return (JavaClass) rset.getEObject(URI.createURI("java:/javax.swing#JLabel"), true); //$NON-NLS-1$
- }
-
- public void testExternalJar() throws IOException {
- objFeaturesSetup();
-
- // This tests getting beaninfo out of jar. The jar is within the project. It contains ButtonBeanInfo.
- JavaClass button = getButton();
- reflectHierachy(button); // First reflect all parents (not introspect).
- // Now cause introspection.
-
- // To write out the names if want new set.
-// writeNames("d:/temp/extjarprops.txt", button.getAllProperties(), objFeaturesSet);
-
- Set names = getNames("testdata/extjarprops.txt");
- testIncludesAllNames("Button", button.getAllProperties(), names, objFeaturesSet);
-
- // To write out the names if want new set.
-// writeNames("d:/temp/extjarops.txt", button.getEOperations(), Collections.EMPTY_SET);
-
- names = getNames("testdata/extjarops.txt");
- testIncludesAllNames("Button", button.getEOperations(), names, Collections.EMPTY_SET);
-
-// showSortedProperties(button);
- }
-
- public void testJLabel() throws IOException {
- objFeaturesSetup();
-
- // This tests JLabel beaninfo out of current project, but through search path.
- JavaClass jlabel = getJLabel();
- reflectHierachy(jlabel); // First reflect all parents (not introspect).
- // Now cause introspection.
-
- // To write out the names if want new set.
-// writeNames("d:/temp/jlabelprops.txt", jlabel.getAllProperties(), objFeaturesSet);
-
- Set names = getNames("testdata/jlabelprops.txt");
- testIncludesAllNames("JLabel", jlabel.getAllProperties(), names, objFeaturesSet);
-
- // To write out the names if want new set.
-// writeNames("d:/temp/jlabelops.txt", jlabel.getEAllOperations(), Collections.EMPTY_SET);
-
- names = getNames("testdata/jlabelops.txt");
- testIncludesAllNames("JLabel", jlabel.getEAllOperations(), names, Collections.EMPTY_SET);
-
-// showSortedProperties(jlabel);
-// showSortedOperations(jlabel);
-
- // Test that isPreferred works both for 1.3 JVM and 1.4 and later since there was a bug in 1.3.
- EStructuralFeature enabledSF = jlabel.getEStructuralFeature("enabled"); //$NON-NLS-1$
- PropertyDecorator pd = Utilities.getPropertyDecorator(enabledSF);
- assertTrue(pd.isPreferred());
- }
-
- /*
- * At time of this test creation, this is the sorted lists for comparison purposes.
- *
- --- List of properties for java.awt.Button
- actionCommand
- alignmentX
- alignmentY
- background
- bounds
- class
- colorModel
- componentOrientation
- cursor
- enabled
- events
- focusTraversable
- font
- foreground
- graphics
- implicit
- initializationString
- instantiateUsing
- label
- locale
- location
- locationOnScreen
- maximumSize
- minimumSize
- name
- parent
- preferredSize
- serializeData
- showing
- size
- toolkit
- treeLock
- valid
- visible
-
- --- List of properties for javax.swing.JLabel
- alignmentX
- alignmentY
- autoscrolls
- background
- border
- bounds
- class
- colorModel
- componentCount
- componentOrientation
- components
- cursor
- debugGraphicsOptions
- disabledIcon
- displayedMnemonic
- doubleBuffered
- enabled
- events
- focusCycleRoot
- focusTraversable
- font
- foreground
- graphics
- height
- horizontalAlignment
- horizontalTextPosition
- icon
- iconTextGap
- implicit
- initializationString
- insets
- instantiateUsing
- labelFor
- layout
- locale
- location
- locationOnScreen
- managingFocus
- maximumSize
- minimumSize
- name
- nextFocusableComponent
- opaque
- optimizedDrawingEnabled
- paintingTile
- parent
- preferredSize
- registeredKeyStrokes
- requestFocusEnabled
- rootPane
- serializeData
- showing
- size
- text
- toolTipText
- toolkit
- topLevelAncestor
- treeLock
- valid
- validateRoot
- verticalAlignment
- verticalTextPosition
- visible
- visibleRect
- width
- x
- y
-
- --- List of Operations for javax.swing.JLabel
- add(java.awt.Component)
- add(java.awt.Component,int)
- add(java.awt.Component,java.lang.Object)
- add(java.awt.Component,java.lang.Object,int)
- add(java.awt.PopupMenu)
- add(java.lang.String,java.awt.Component)
- addNotify()
- checkImage(java.awt.Image,java.awt.image.ImageObserver)
- computeVisibleRect(java.awt.Rectangle)
- contains(int,int)
- contains(java.awt.Point)
- createImage(int,int)
- createImage(java.awt.image.ImageProducer)
- createToolTip()
- dispatchEvent(java.awt.AWTEvent)
- doLayout()
- equals(java.lang.Object)
- firePropertyChange(java.lang.String,boolean,boolean)
- firePropertyChange(java.lang.String,char,char)
- firePropertyChange(java.lang.String,double,double)
- firePropertyChange(java.lang.String,float,float)
- firePropertyChange(java.lang.String,int,int)
- firePropertyChange(java.lang.String,long,long)
- firePropertyChange(java.lang.String,short,short)
- getAccessibleContext()
- getActionForKeyStroke(javax.swing.KeyStroke)
- getAlignmentX()
- getAlignmentY()
- getAutoscrolls()
- getBackground()
- getBorder()
- getBounds()
- getBounds(java.awt.Rectangle)
- getClass()
- getClientProperty(java.lang.Object)
- getColorModel()
- getComponent(int)
- getComponentAt(int,int)
- getComponentAt(java.awt.Point)
- getComponentCount()
- getComponents()
- getConditionForKeyStroke(javax.swing.KeyStroke)
- getCursor()
- getDisabledIcon()
- getDisplayedMnemonic()
- getFont()
- getFontMetrics(java.awt.Font)
- getForeground()
- getGraphics()
- getHeight()
- getHorizontalAlignment()
- getHorizontalTextPosition()
- getIcon()
- getIconTextGap()
- getInsets()
- getLabelFor()
- getLayout()
- getLocale()
- getLocation()
- getLocation(java.awt.Point)
- getLocationOnScreen()
- getMaximumSize()
- getMinimumSize()
- getName()
- getNextFocusableComponent()
- getParent()
- getPreferredSize()
- getRegisteredKeyStrokes()
- getRootPane()
- getSize()
- getSize(java.awt.Dimension)
- getText()
- getToolTipText()
- getToolkit()
- getTopLevelAncestor()
- getTreeLock()
- getUI()
- getVerticalAlignment()
- getVerticalTextPosition()
- getVisibleRect()
- getWidth()
- getX()
- getY()
- grabFocus()
- hasFocus()
- hashCode()
- invalidate()
- isAncestorOf(java.awt.Component)
- isDoubleBuffered()
- isEnabled()
- isFocusCycleRoot()
- isFocusTraversable()
- isManagingFocus()
- isOpaque()
- isOptimizedDrawingEnabled()
- isRequestFocusEnabled()
- isShowing()
- isValid()
- isValidateRoot()
- isVisible()
- list()
- list(java.io.PrintStream)
- list(java.io.PrintStream,int)
- list(java.io.PrintWriter,int)
- notify()
- notifyAll()
- paint(java.awt.Graphics)
- paintAll(java.awt.Graphics)
- paintImmediately(java.awt.Rectangle)
- prepareImage(java.awt.Image,java.awt.image.ImageObserver)
- print(java.awt.Graphics)
- printAll(java.awt.Graphics)
- putClientProperty(java.lang.Object,java.lang.Object)
- remove(int)
- remove(java.awt.Component)
- remove(java.awt.MenuComponent)
- removeAll()
- removeNotify()
- repaint()
- repaint(java.awt.Rectangle)
- requestDefaultFocus()
- requestFocus()
- resetKeyboardActions()
- revalidate()
- scrollRectToVisible(java.awt.Rectangle)
- setAlignmentX(float)
- setAlignmentY(float)
- setAutoscrolls(boolean)
- setBackground(java.awt.Color)
- setBorder(javax.swing.border.Border)
- setBounds(int,int,int,int)
- setBounds(java.awt.Rectangle)
- setCursor(java.awt.Cursor)
- setDebugGraphicsOptions(int)
- setDisabledIcon(javax.swing.Icon)
- setDisplayedMnemonic(char)
- setDoubleBuffered(boolean)
- setEnabled(boolean)
- setFont(java.awt.Font)
- setForeground(java.awt.Color)
- setHorizontalAlignment(int)
- setHorizontalTextPosition(int)
- setIcon(javax.swing.Icon)
- setIconTextGap(int)
- setLabelFor(java.awt.Component)
- setLayout(java.awt.LayoutManager)
- setLocale(java.util.Locale)
- setLocation(int,int)
- setLocation(java.awt.Point)
- setMaximumSize(java.awt.Dimension)
- setMinimumSize(java.awt.Dimension)
- setName(java.lang.String)
- setNextFocusableComponent(java.awt.Component)
- setOpaque(boolean)
- setPreferredSize(java.awt.Dimension)
- setRequestFocusEnabled(boolean)
- setSize(int,int)
- setSize(java.awt.Dimension)
- setText(java.lang.String)
- setToolTipText(java.lang.String)
- setUI(javax.swing.plaf.LabelUI)
- setVerticalAlignment(int)
- setVerticalTextPosition(int)
- setVisible(boolean)
- toString()
- transferFocus()
- unregisterKeyboardAction(javax.swing.KeyStroke)
- update(java.awt.Graphics)
- updateUI()
- validate()
- wait()
- wait(long)
- wait(long,int)
-
- */
-
-}
diff --git a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/beaninfo/TestReflection.java b/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/beaninfo/TestReflection.java
deleted file mode 100644
index a5684dec..00000000
--- a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/beaninfo/TestReflection.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jem.tests.beaninfo;
-/*
- * $RCSfile: TestReflection.java,v $
- * $Revision: 1.7 $ $Date: 2005/02/15 23:00:16 $
- */
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EOperation;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.jem.internal.beaninfo.PropertyDecorator;
-import org.eclipse.jem.internal.beaninfo.core.Utilities;
-import org.eclipse.jem.java.JavaClass;
-import org.eclipse.jem.java.JavaEvent;
-import org.eclipse.jem.java.TypeKind;
-
-/**
- * @author richkulp
- * This one is for testing reflection. It is separate so that
- * test suite can guarentee that it is first.
- */
-public class TestReflection extends AbstractBeanInfoTestCase {
-
- public TestReflection() {
- super();
- }
-
- public TestReflection(String name) {
- super(name);
- }
-
- public void testReflection() {
- // Test one without a beaninfo. This will do reflection.
- JavaClass test1Class =
- (JavaClass) rset.getEObject(URI.createURI("java:/org.eclipse.jem.tests.beaninfo#Test1Class"), true); //$NON-NLS-1$
-
- assertSame(TypeKind.CLASS_LITERAL, test1Class.getKind());
-
- // Test that the reflection key can find features that aren't yet loaded.
- Object foo = rset.getEObject(URI.createURI("java:/org.eclipse.jem.tests.beaninfo#Test1Class/foo"), true); //$NON-NLS-1$
- assertNotNull(foo);
-
- // Test that the reflection key can find operations that aren't yet loaded.
- Object getFoo =
- rset.getEObject(URI.createURI("java:/org.eclipse.jem.tests.beaninfo#Test1Class/operation/getFoo"), true); //$NON-NLS-1$
- assertNotNull(getFoo);
- }
-
- public void testInnerReflectionInDefault() {
- // Test that a property of class (through reflection) is an inner class, and the class is resolved correctly.
- JavaClass testInnerClass =
- (JavaClass) rset.getEObject(URI.createURI("java:/#TestDefaultInner"), true); //$NON-NLS-1$
-
- assertSame(TypeKind.CLASS_LITERAL, testInnerClass.getKind());
-
- EList properties = testInnerClass.getProperties();
- assertEquals(1, properties.size());
-
- EStructuralFeature pf = (EStructuralFeature) properties.get(0);
- assertEquals("propertyInner", pf.getName());
-
- PropertyDecorator pd = Utilities.getPropertyDecorator(pf);
- assertNotNull(pd);
-
- JavaClass pdType = (JavaClass) pd.getPropertyType();
- assertEquals("TestDefaultInner$Inner", pdType.getName());
- assertSame(TypeKind.CLASS_LITERAL, pdType.getKind());
- }
-
- public void testInnerReflectionInPackage() {
- // Test that a property of class (through reflection) is an inner class, and the class is resolved correctly.
- JavaClass testInnerClass =
- (JavaClass) rset.getEObject(URI.createURI("java:/org.eclipse.jem.tests.beaninfo#TestInner"), true); //$NON-NLS-1$
-
- assertSame(TypeKind.CLASS_LITERAL, testInnerClass.getKind());
-
- EList properties = testInnerClass.getProperties();
- assertEquals(1, properties.size());
-
- EStructuralFeature pf = (EStructuralFeature) properties.get(0);
- assertEquals("propertyInner", pf.getName());
-
- PropertyDecorator pd = Utilities.getPropertyDecorator(pf);
- assertNotNull(pd);
-
- JavaClass pdType = (JavaClass) pd.getPropertyType();
- assertEquals("TestInner$Inner", pdType.getName());
- assertSame(TypeKind.CLASS_LITERAL, pdType.getKind());
- }
-
- private List getRealProps(List props) {
- int size = props.size();
- List newList = new ArrayList(size);
- for (int i=0; i<size; i++) {
- EStructuralFeature f = (EStructuralFeature) props.get(i);
- if (Utilities.getPropertyDecorator(f) != null)
- newList.add(f);
- }
- return newList;
- }
-
- public void testInterfacePropertyReflection() {
- // Test the reflection of interfaces with multiple extends on them so that properities are correct.
- JavaClass testPropClass =
- (JavaClass) rset.getEObject(URI.createURI("java:/org.eclipse.jem.tests.beaninfo.test#NotTopGuy"), true); //$NON-NLS-1$
-
- assertTrue(testPropClass.isInterface());
-
- // Test that we don't pick up the extends stuff
- List props = getRealProps(testPropClass.getProperties());
- // Forgot there may be non-properties properties.
- assertEquals(1, props.size());
- assertEquals("number", ((EStructuralFeature) props.get(0)).getName());
-
- // Test that we pick up the extends stuff
- props = getRealProps(testPropClass.getAllProperties());
- assertEquals(3, props.size());
- List validNames = Arrays.asList(new String[] {"number", "object", "integer"});
- for (Iterator itr = props.iterator(); itr.hasNext();) {
- EStructuralFeature feature = (EStructuralFeature) itr.next();
- assertTrue("Extra feature:"+feature.getName(), validNames.contains(feature.getName()));
- }
- }
-
- public void testInterfaceEventReflection() {
- // Test the reflection of interfaces with multiple extends on them so that events are correct.
- JavaClass testEventClass =
- (JavaClass) rset.getEObject(URI.createURI("java:/org.eclipse.jem.tests.beaninfo.test#NotTopGuy"), true); //$NON-NLS-1$
-
- assertTrue(testEventClass.isInterface());
-
- // Test that we don't pick up the extends stuff
- List events = testEventClass.getEvents();
- assertTrue(events.isEmpty());
-
- // Test that we pick up the extends stuff
- events = testEventClass.getAllEvents();
- assertEquals(1, events.size());
- assertEquals("test1ClassEvent", ((JavaEvent) events.get(0)).getName());
- }
-
- public void testInterfaceOperationsReflection() {
- // Test the reflection of interfaces with multiple extends on them so that properities are correct.
- JavaClass testOpClass =
- (JavaClass) rset.getEObject(URI.createURI("java:/org.eclipse.jem.tests.beaninfo.test#NotTopGuy"), true); //$NON-NLS-1$
-
- assertTrue(testOpClass.isInterface());
-
- // Test that we don't pick up the extends stuff
- List ops = testOpClass.getEOperations();
- assertEquals(2, ops.size());
- List validNames = Arrays.asList(new String[] {"getNumber", "setNumber"});
- for (Iterator itr = ops.iterator(); itr.hasNext();) {
- EOperation op = (EOperation) itr.next();
- assertTrue("Extra operation:"+op.getName(), validNames.contains(op.getName()));
- }
-
-
- // Test that we pick up the extends stuff
- ops = testOpClass.getEAllOperations();
- assertEquals(8, ops.size());
- validNames = Arrays.asList(new String[] {"getNumber", "setNumber", "getObject", "setObject", "getInteger", "setInteger", "addTest1ClassEventListener", "removeTest1ClassEventListener"});
- for (Iterator itr = ops.iterator(); itr.hasNext();) {
- EOperation op = (EOperation) itr.next();
- assertTrue("Extra operation:"+op.getName(), validNames.contains(op.getName()));
- }
- }
-
-
-}
diff --git a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/beaninfo/TestStandard.java b/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/beaninfo/TestStandard.java
deleted file mode 100644
index 2f6c6942..00000000
--- a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/beaninfo/TestStandard.java
+++ /dev/null
@@ -1,630 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jem.tests.beaninfo;
-/*
- * $RCSfile: TestStandard.java,v $
- * $Revision: 1.9 $ $Date: 2005/02/15 23:00:16 $
- */
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.*;
-import org.eclipse.emf.ecore.EOperation;
-import org.eclipse.emf.ecore.EStructuralFeature;
-
-import org.eclipse.jem.internal.beaninfo.*;
-import org.eclipse.jem.internal.beaninfo.core.Utilities;
-
-import org.eclipse.jem.java.*;
-
-/**
- * @author richkulp
- *
- * Standard BeanInfo tests.
- */
-public class TestStandard extends AbstractBeanInfoTestCase {
-
- public TestStandard() {
- super();
- }
-
- public TestStandard(String name) {
- super(name);
- }
-
- public void testArrayClassType() {
- // Test one dimension array type for a class as final component
- JavaClass at = (JavaClass) JavaRefFactory.eINSTANCE.reflectType("org.eclipse.jem.tests.beaninfo.Test1Class[]", rset);
-
- assertTrue(at.isArray());
- assertSame(TypeKind.CLASS_LITERAL, at.getKind());
- assertEquals(1, ((ArrayType) at).getArrayDimensions());
- assertTrue(at.isPublic());
- assertTrue("java.lang.Object".equals(at.getSupertype().getQualifiedName()));
- assertTrue(at.getImplementsInterfaces().size() == 2);
- assertTrue(at.getMethods().isEmpty());
- assertTrue(at.getFields().isEmpty());
- assertTrue(at.getProperties().isEmpty());
- assertTrue(at.getEvents().isEmpty());
- assertTrue(at.getEOperations().isEmpty());
- }
-
- public void testArrayPrimitiveType() {
- // Test one dimension array type for a class as final component
- JavaClass at = (JavaClass) JavaRefFactory.eINSTANCE.reflectType("int[]", rset);
-
- assertTrue(at.isArray());
- assertSame(TypeKind.CLASS_LITERAL, at.getKind());
- assertEquals(1, ((ArrayType) at).getArrayDimensions());
- assertTrue(at.isPublic());
- assertTrue("java.lang.Object".equals(at.getSupertype().getQualifiedName()));
- assertTrue(at.getImplementsInterfaces().size() == 2);
- assertTrue(at.getMethods().isEmpty());
- assertTrue(at.getFields().isEmpty());
- assertTrue(at.getProperties().isEmpty());
- assertTrue(at.getEvents().isEmpty());
- assertTrue(at.getEOperations().isEmpty());
- }
-
- public void testArrayUndefined() {
- // Test one dimension array type for a class as final component that is undefined.
- JavaClass at = (JavaClass) JavaRefFactory.eINSTANCE.reflectType("XYZ[]", rset);
-
- assertTrue(at.isArray());
- assertSame(TypeKind.UNDEFINED_LITERAL, at.getKind());
- }
-
- public void testArrayClassType2Dim() {
- // Test one dimension array type for a class as final component
- JavaClass at = (JavaClass) JavaRefFactory.eINSTANCE.reflectType("org.eclipse.jem.tests.beaninfo.Test1Class[][]", rset);
-
- assertTrue(at.isArray());
- assertSame(TypeKind.CLASS_LITERAL, at.getKind());
- assertEquals(2, ((ArrayType) at).getArrayDimensions());
- assertTrue(at.isPublic());
- assertTrue("java.lang.Object".equals(at.getSupertype().getQualifiedName()));
- assertTrue(at.getImplementsInterfaces().size() == 2);
- assertTrue(at.getMethods().isEmpty());
- assertTrue(at.getFields().isEmpty());
- assertTrue(at.getProperties().isEmpty());
- assertTrue(at.getEvents().isEmpty());
- assertTrue(at.getEOperations().isEmpty());
- }
-
- public void testArrayPrimitiveType2Dim() {
- // Test one dimension array type for a class as final component
- JavaClass at = (JavaClass) JavaRefFactory.eINSTANCE.reflectType("int[][]", rset);
-
- assertTrue(at.isArray());
- assertSame(TypeKind.CLASS_LITERAL, at.getKind());
- assertEquals(2, ((ArrayType) at).getArrayDimensions());
- assertTrue(at.isPublic());
- assertTrue("java.lang.Object".equals(at.getSupertype().getQualifiedName()));
- assertTrue(at.getImplementsInterfaces().size() == 2);
- assertTrue(at.getMethods().isEmpty());
- assertTrue(at.getFields().isEmpty());
- assertTrue(at.getProperties().isEmpty());
- assertTrue(at.getEvents().isEmpty());
- assertTrue(at.getEOperations().isEmpty());
- }
-
- public void testArrayUndefined2Dim() {
- // Test one dimension array type for a class as final component that is undefined.
- JavaClass at = (JavaClass) JavaRefFactory.eINSTANCE.reflectType("XYZ[][]", rset);
-
- assertTrue(at.isArray());
- assertSame(TypeKind.UNDEFINED_LITERAL, at.getKind());
- }
-
- public void testArrayInnerClassType() {
- // Test one dimension array type for a class as final component
- JavaClass at = (JavaClass) JavaRefFactory.eINSTANCE.reflectType("org.eclipse.jem.tests.beaninfo.Customer$Account[]", rset);
-
- assertTrue(at.isArray());
- assertSame(TypeKind.CLASS_LITERAL, at.getKind());
- assertEquals(1, ((ArrayType) at).getArrayDimensions());
- assertTrue(at.isPublic());
- assertTrue("java.lang.Object".equals(at.getSupertype().getQualifiedName()));
- assertTrue(at.getImplementsInterfaces().size() == 2);
- assertTrue(at.getMethods().isEmpty());
- assertTrue(at.getFields().isEmpty());
- assertTrue(at.getProperties().isEmpty());
- assertTrue(at.getEvents().isEmpty());
- assertTrue(at.getEOperations().isEmpty());
- }
-
- public void testBeanDecoratorReflected() {
- JavaClass test1Class = getTest1Class();
-
- // Test the bean decorator.
- BeanDecorator bd = Utilities.getBeanDecorator(test1Class);
- assertEquals("Test1Class", bd.getName()); //$NON-NLS-1$
- assertNull(bd.getCustomizerClass());
- }
-
- protected JavaClass getTest1Class() {
- JavaClass test1Class =
- (JavaClass) rset.getEObject(URI.createURI("java:/org.eclipse.jem.tests.beaninfo#Test1Class"), true); //$NON-NLS-1$
- return test1Class;
- }
-
- public void testLocalReflectedProperties() {
- EList allLocalFeatures = getTest1Class().getProperties();
- assertEquals(2, allLocalFeatures.size());
-
- Iterator itr = Utilities.getPropertiesIterator(allLocalFeatures);
- boolean found = false;
- while (itr.hasNext()) {
- PropertyDecorator pd = (PropertyDecorator) itr.next();
- if (pd.getName().equals("foo")) { //$NON-NLS-1$
- found = true;
- assertTrue(pd instanceof IndexedPropertyDecorator);
- IndexedPropertyDecorator ip = (IndexedPropertyDecorator) pd;
- JavaHelpers type = (JavaHelpers) ip.getPropertyType();
- assertEquals("java.lang.String[]", type.getQualifiedName());
- if (!type.getQualifiedName().equals("java.lang.String[]")); //$NON-NLS-1$
-
- Method mthd = ip.getReadMethod();
- assertSame(rset.getEObject(URI.createURI("java:/org.eclipse.jem.tests.beaninfo#Test1Class.getFoo("), true), mthd);
-
- mthd = ip.getWriteMethod();
- assertSame(rset.getEObject(URI.createURI("java:/org.eclipse.jem.tests.beaninfo#Test1Class.setFoo(java.lang.String[]"), true), mthd);
-
- mthd = ip.getIndexedReadMethod();
- assertSame(rset.getEObject(URI.createURI("java:/org.eclipse.jem.tests.beaninfo#Test1Class.getFoo(int"), true), mthd);
-
- mthd = ip.getIndexedWriteMethod();
- assertSame(rset.getEObject(URI.createURI("java:/org.eclipse.jem.tests.beaninfo#Test1Class.setFoo(int,java.lang.String"), true), mthd);
-
- break;
- }
- }
-
- assertTrue(found);
- }
-
- public void testLocalReflectedOperations() {
- JavaClass test1Class = getTest1Class();
-
- // Test local operations.
- EList allLocalOperations = test1Class.getEOperations();
- assertEquals(10, allLocalOperations.size());
- Iterator itr = allLocalOperations.iterator();
- // This is the desired method that the operation of interest points to.
- Method desired =
- (Method) rset.getEObject(URI.createURI(
- "java:/org.eclipse.jem.tests.beaninfo#Test1Class.setFoo(int,java.lang.String"), true); //$NON-NLS-1$
- boolean found = false;
- while (itr.hasNext()) {
- MethodProxy bhav = (MethodProxy) itr.next();
- if (bhav.getMethod() == desired) {
- found = true;
- List parms = Utilities.getMethodDecorator(bhav).getParameterDescriptors();
- assertEquals(2, parms.size());
- ParameterDecorator pmd = (ParameterDecorator) parms.get(0);
- assertEquals("index", pmd.getName());
-
- break;
- }
- }
- assertTrue(found);
- }
-
- public void testLocalReflectedEvents() {
- JavaClass test1Class = getTest1Class();
-
- // Test event set reflected.
- List events = test1Class.getEvents();
- assertEquals(2, events.size());
- Iterator itr = events.iterator();
- boolean foundevt1 = false, foundevt2 = false;
- while (itr.hasNext()) {
- JavaEvent event = (JavaEvent) itr.next();
- if ("test1ClassEvent".equals(event.getName())) { //$NON-NLS-1$
- foundevt1 = true;
- EventSetDecorator edec = Utilities.getEventSetDecorator(event);
- List mlist = edec.getListenerMethods();
- assertEquals(2, mlist.size());
- } else if ("test1ClassUnicastEvent".equals(event.getName())) { //$NON-NLS-1$
- foundevt2 = true;
- EventSetDecorator edec = Utilities.getEventSetDecorator(event);
- assertTrue(edec.isUnicast());
- }
- }
- assertTrue(foundevt1);
- assertTrue(foundevt2);
- }
-
- protected JavaClass getTest2ClassB() {
- return (JavaClass) rset.getEObject(URI.createURI("java:/org.eclipse.jem.tests.beaninfo#Test2ClassB"), true); //$NON-NLS-1$
- }
-
- public void testBeanDecoratorIntrospected() {
- // Test one with a beaninfo.
- JavaClass test2ClassB = getTest2ClassB();
- BeanDecorator bd = Utilities.getBeanDecorator(test2ClassB);
- assertEquals("Test2ClassB", bd.getName());
-
- // The following will test if search across beaninfo search path worked. It would fail if it didn't work.
- assertEquals("A name for this class.", bd.getDisplayName()); //$NON-NLS-1$
- assertFalse(bd.isExpert());
- // Customizer class set in BeanInfo, but bogus for now to same class as being introspected.
- assertSame(test2ClassB, bd.getCustomizerClass());
- }
-
- public void testLocalIntrospectedProperties() {
- JavaClass test2ClassB = getTest2ClassB();
- EList allLocalFeatures = test2ClassB.getProperties();
- assertEquals(2, allLocalFeatures.size());
-
- Iterator itr = Utilities.getPropertiesIterator(allLocalFeatures);
- boolean gotSet = false, gotFoo = false;
- while (itr.hasNext()) {
- PropertyDecorator pd = (PropertyDecorator) itr.next();
- Method mthd = null;
- if (pd.getName().equals("setA")) { //$NON-NLS-1$
- gotSet = true;
- mthd = pd.getReadMethod();
- assertSame(rset.getEObject(URI.createURI("java:/org.eclipse.jem.tests.beaninfo#Test2ClassB.isSetA("), true), mthd);
- } else if (pd.getName().equals("foo")) { //$NON-NLS-1$
- gotFoo = true;
- IndexedPropertyDecorator ipd = (IndexedPropertyDecorator) pd;
- mthd = ipd.getIndexedReadMethod();
- assertSame(rset.getEObject(URI.createURI("java:/org.eclipse.jem.tests.beaninfo#Test2ClassB.getFoo(int"), true), mthd);
- }
- }
- assertTrue(gotSet);
- assertTrue(gotFoo);
- }
-
- public void testLocalIntrospectedOperations() {
- JavaClass test2ClassB = getTest2ClassB();
-
- EList allLocalOperations = test2ClassB.getEOperations();
- assertEquals(2, allLocalOperations.size());
-
- boolean found = false;
- Iterator itr = test2ClassB.getEOperations().iterator();
- while (itr.hasNext()) {
- EOperation bhav = (EOperation) itr.next();
- if (bhav.getName().equals("setSetA")) { //$NON-NLS-1$
- List parms = Utilities.getMethodDecorator(bhav).getParameterDescriptors();
- assertEquals(1, parms.size());
- ParameterDecorator pmd = (ParameterDecorator) parms.get(0);
- assertEquals("aBooleanSetting", pmd.getName());
- found = true;
- break;
- }
- }
- assertTrue(found);
- }
-
- public void testLocalIntrospectedEvents() {
- JavaClass test2ClassB = getTest2ClassB();
-
- // Test event set introspected.
- EList events = test2ClassB.getEvents();
- assertEquals(1, events.size());
- JavaEvent event = (JavaEvent) events.get(0);
- assertEquals("overrideName", event.getName()); //$NON-NLS-1$
- EventSetDecorator edec = Utilities.getEventSetDecorator(event);
- assertEquals("ITest1ClassEventListener", edec.getListenerType().getName());
- List mlist = edec.getListenerMethods();
- assertEquals(1, mlist.size());
- MethodProxy mproxy = (MethodProxy) mlist.get(0);
- MethodDecorator mdec = Utilities.getMethodDecorator(mproxy);
- assertEquals("event1", mdec.getName()); //$NON-NLS-1$
- assertEquals("Event 1", mdec.getDisplayName()); //$NON-NLS-1$
- }
-
- public void testSuperTypes() {
- JavaClass testClass = getTest1Class();
- objFeaturesSetup(); // Get number of features for Object. This can vary depending on extensions, so that is why we compute it.
-
- // Now do the testing of merging with super types.
- assertEquals(2+objFeatures, testClass.getAllProperties().size());
- JavaClass test1ClassA = getTest1ClassA(); //$NON-NLS-1$
- assertNotNull(test1ClassA);
- assertEquals(3+objFeatures, test1ClassA.getAllProperties().size());
- }
-
- protected JavaClass getTest1ClassA() {
- return (JavaClass) rset.getEObject(URI.createURI("java:/org.eclipse.jem.tests.beaninfo#Test1ClassA"), true);
- }
-
- public void testSuperTypesEvents() {
- JavaClass test1ClassA = getTest1ClassA();
-
- // Test merging supertypes event set.
- List events = test1ClassA.getAllEvents();
- assertEquals(2, events.size());
- Iterator itr = events.iterator();
- boolean foundevt1 = false;
- boolean foundevt2 = false;
- while (itr.hasNext()) {
- JavaEvent event = (JavaEvent) itr.next();
- if ("test1ClassEvent".equals(event.getName())) { //$NON-NLS-1$
- foundevt1 = true;
- EventSetDecorator edec = Utilities.getEventSetDecorator(event);
- List mlist = edec.getListenerMethods();
- assertEquals(2, mlist.size());
- } else if ("test1ClassUnicastEvent".equals(event.getName())) { //$NON-NLS-1$
- foundevt2 = true;
- EventSetDecorator edec = Utilities.getEventSetDecorator(event);
- assertTrue(edec.isUnicast());
- }
- }
- assertTrue(foundevt1);
- assertTrue(foundevt2);
- }
-
- protected JavaClass getTest2Class() {
- return (JavaClass) rset.getEObject(URI.createURI("java:/org.eclipse.jem.tests.beaninfo#Test2Class"), true); //$NON-NLS-1$
- }
-
- protected JavaClass getTest2ClassA() {
- return (JavaClass) rset.getEObject(URI.createURI("java:/org.eclipse.jem.tests.beaninfo#Test2ClassA"), true); //$NON-NLS-1$
- }
-
- public void testSuperTypeHideProperty() {
- JavaClass test2Class = getTest2Class();
- objFeaturesSetup();
-
- // Test2ClassBeanInfo explicitly hides Object (super) from its BeanInfo, so only the non-BeanInfo properties will show.
- assertEquals(2+objNonProperties, test2Class.getAllProperties().size());
-
- // Try with subclasses. Make sure that Test2ClassBeanInfo is used with the subclasses.
- JavaClass test2ClassA = getTest2ClassA();
- assertEquals(3+objNonProperties, test2ClassA.getAllProperties().size());
-
- JavaClass test2ClassB = getTest2ClassB();
- assertEquals(4+objNonProperties, test2ClassB.getAllProperties().size());
- }
-
- public void testIndexedBeanInfo() {
- JavaClass test2Class = getTest2Class();
-
- // Test that Indexed thru beaninfo works
- Iterator itr = Utilities.getPropertiesIterator(test2Class.getProperties());
- boolean found = false;
- while (itr.hasNext()) {
- PropertyDecorator pd = (PropertyDecorator) itr.next();
- if (pd.getName().equals("fooBar")) { //$NON-NLS-1$
- found = true;
- assertTrue(pd instanceof IndexedPropertyDecorator);
- IndexedPropertyDecorator ip = (IndexedPropertyDecorator) pd;
- JavaHelpers type = (JavaHelpers) ip.getPropertyType();
- assertEquals("java.lang.String[]", type.getQualifiedName()); //$NON-NLS-1$
- Method mthd = ip.getReadMethod();
- assertSame(rset.getEObject(URI.createURI("java:/org.eclipse.jem.tests.beaninfo#Test2Class.getFooBar("), true), mthd); //$NON-NLS-1$
- mthd = ip.getWriteMethod();
- assertSame(rset.getEObject(URI.createURI("java:/org.eclipse.jem.tests.beaninfo#Test2Class.setFooBar(java.lang.String[]"), true), mthd); //$NON-NLS-1$
- mthd = ip.getIndexedReadMethod();
- assertSame(rset.getEObject(URI.createURI("java:/org.eclipse.jem.tests.beaninfo#Test2Class.getFooBar(int"), true), mthd); //$NON-NLS-1$
- mthd = ip.getIndexedWriteMethod();
- assertSame(rset.getEObject(URI.createURI("java:/org.eclipse.jem.tests.beaninfo#Test2Class.setFooBar(int,java.lang.String"), true), mthd); //$NON-NLS-1$
- break;
- }
- }
-
- assertTrue(found);
- }
-
- protected JavaClass getTest2ClassC() {
- return (JavaClass) rset.getEObject(URI.createURI("java:/org.eclipse.jem.tests.beaninfo#Test2ClassC"), true); //$NON-NLS-1$
- }
-
- public void testBeanInfoProject() {
- JavaClass test2ClassC = getTest2ClassC();
-
- // This will test that we could find Test2ClassC BeanInfo that is in another BeanInfo project (i.e. a project
- // that is specifically for BeanInfo's for a specific code project).
- BeanDecorator bd = Utilities.getBeanDecorator(test2ClassC);
- assertNotNull(bd);
- assertEquals("Test2ClassC from BeanInfo", bd.getDisplayName());
-
- }
-
- public void testOverride() {
-
- // Test that the local property is expert because it overrode from Test2ClassB and made it expert.
- JavaClass test2ClassB = getTest2ClassB();
-
- // Test that the local property is not expert in Test2ClassB.
- EStructuralFeature p = test2ClassB.getEStructuralFeature("setA");
- assertNotNull(p);
- PropertyDecorator pd = Utilities.getPropertyDecorator(p);
- assertFalse(pd.isExpert());
-
- // Now get subclass with override.
- JavaClass test2ClassC = getTest2ClassC();
-
- // Test that the local property is now expert because it overrode from Test2ClassB and made it expert.
- p = test2ClassC.getEStructuralFeature("setA");
- assertNotNull(p);
- pd = Utilities.getPropertyDecorator(p);
- assertTrue(pd.isExpert());
- }
-
- protected JavaClass getTest2ClassPreq() {
- return (JavaClass) rset.getEObject(URI.createURI("java:/org.eclipse.jem.tests.beaninfo.prereq#Test2ClassPreq"), true); //$NON-NLS-1$
- }
-
- public void testPrereqedProjects() {
- JavaClass test2ClassPrereq = getTest2ClassPreq();
- objFeaturesSetup();
-
- // Test finding beaninfos for classes in another project (pre-reqed project).
- assertEquals(1+objFeatures, test2ClassPrereq.getAllProperties().size());
- // Verify BeanInfo and not jsut introspection.
- EStructuralFeature f = test2ClassPrereq.getEStructuralFeature("aSet");
- assertNotNull(f);
- PropertyDecorator pd = Utilities.getPropertyDecorator(f);
- assertTrue(pd.isExpert());
- }
-
- public void testRemovePropRebuild() throws CoreException {
- objFeaturesSetup();
-
- // Test removing a property directly from a super class causes the subclasses to re-build their properties.
- JavaClass test1Class = getTest1Class();
- JavaClass test1ClassA = getTest1ClassA();
- // Get and test the properties first to cause introspection for both BEFORE the modification.
- assertEquals(2+objFeatures, test1Class.getAllProperties().size());
- assertEquals(3+objFeatures, test1ClassA.getAllProperties().size());
- try {
- test1Class.getEStructuralFeatures().remove(0); // Remove the first one. They should both now rebuild.
- assertEquals(1+objFeatures, test1Class.getAllProperties().size());
- assertEquals(2+objFeatures, test1ClassA.getAllProperties().size());
- } finally {
- // Need to close and reopen the project so that to restore the correct shape for test1Class for other tests.
- final IProject project = nature.getProject();
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- workspace.run(new IWorkspaceRunnable () {
- public void run(IProgressMonitor monitor) throws CoreException {
- project.close(monitor);
- project.open(monitor);
- }
- }, project, 0, null);
- }
- }
-
- public void testRemoveEventRebuild() throws CoreException {
- // Test removing an event directly from a super class causes the subclasses to re-build their allEvents.
- JavaClass test1Class = getTest1Class();
- JavaClass test1ClassA = getTest1ClassA();
- // Get and test the events first to cause introspection for both BEFORE the modification.
- assertEquals(2, test1Class.getAllEvents().size());
- assertEquals(2, test1ClassA.getAllEvents().size());
- try {
- test1Class.getEvents().remove(0); // Remove the first one. They should now both rebuild.
- assertEquals(1, test1Class.getAllEvents().size());
- assertEquals(1, test1ClassA.getAllEvents().size());
- } finally {
- // Need to close and reopen the project so that to restore the correct shape for test1Class for other tests.
- final IProject project = nature.getProject();
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- workspace.run(new IWorkspaceRunnable () {
- public void run(IProgressMonitor monitor) throws CoreException {
- project.close(monitor);
- project.open(monitor);
- }
- }, project, 0, null);
- }
- }
-
- protected JavaClass getCustomer() {
- return (JavaClass) rset.getEObject(URI.createURI("java:/org.eclipse.jem.tests.beaninfo#Customer"), true); //$NON-NLS-1$
- }
-
- public void testInnerClass() {
- JavaClass customer = getCustomer();
-
- // Now test customer to make sure that it introspects correctly, plus the inner class of one of its properties does too.
- List allLocalFeatures = customer.getProperties();
- assertEquals(2, allLocalFeatures.size());
- Iterator itr = allLocalFeatures.iterator();
- boolean found = false;
- while (itr.hasNext()) {
- EStructuralFeature ea = (EStructuralFeature) itr.next();
- if ("savings".equals(ea.getName())) { //$NON-NLS-1$
- found = true;
- JavaClass innerClass = (JavaClass) ea.getEType(); // This property type is an innerclass of Customer
- assertEquals("Customer$Account", innerClass.getName());
- allLocalFeatures = innerClass.getProperties();
- assertEquals(2, allLocalFeatures.size());
- }
- }
-
- assertTrue(found);
- }
-
- protected JavaClass getTestBoundNotBound() {
- return (JavaClass) rset.getEObject(URI.createURI("java:/org.eclipse.jem.tests.beaninfo#TestBoundNotBound"), true); //$NON-NLS-1$
- }
-
- public void testNotBoundReflection() {
- JavaClass testBoundNotBound = getTestBoundNotBound();
-
- // Now test that properties are bound correctly on reflection. First test reflect not bound correct.
- // This is determined by no addPropertyChangeListener method on class.
- List allLocalFeatures = testBoundNotBound.getProperties();
- assertEquals(1, allLocalFeatures.size());
- EStructuralFeature ea = (EStructuralFeature) allLocalFeatures.get(0);
- PropertyDecorator pd = Utilities.getPropertyDecorator(ea);
- assertNotNull(pd);
- assertFalse(pd.isBound());
- }
-
- protected JavaClass getTestBoundSuper() {
- return (JavaClass) rset.getEObject(URI.createURI("java:/org.eclipse.jem.tests.beaninfo#TestBoundSuper"), true); //$NON-NLS-1$
- }
-
- public void testBoundReflection() {
- JavaClass testBoundSuper = getTestBoundSuper();
-
- // Test that reflection can find bound property.
- // This is determined by finding add/remove PropertyChangeListener method on class.
- List allLocalFeatures = testBoundSuper.getProperties();
- assertEquals(1, allLocalFeatures.size());
- EStructuralFeature ea = (EStructuralFeature) allLocalFeatures.get(0);
- PropertyDecorator pd = Utilities.getPropertyDecorator(ea);
- assertNotNull(pd);
- assertTrue(pd.isBound());
- }
-
- protected JavaClass getTestBoundSub() {
- return (JavaClass) rset.getEObject(URI.createURI("java:/org.eclipse.jem.tests.beaninfo#TestBoundSub"), true); //$NON-NLS-1$
- }
-
- public void testBoundReflectionSubclass() {
- JavaClass testBoundSub = getTestBoundSub();
-
- // Test that reflection can find bound property due to inherit from a bound class.
- // This is determined by finding add/remove PropertyChangeListener method on class (but from a super class).
- List allLocalFeatures = testBoundSub.getProperties();
- assertEquals(1, allLocalFeatures.size());
- EStructuralFeature ea = (EStructuralFeature) allLocalFeatures.get(0);
- PropertyDecorator pd = Utilities.getPropertyDecorator(ea);
- assertNotNull(pd);
- assertTrue(pd.isBound());
- }
-
- public void testOverridesFile() {
- // Test that override files get applied correctly.
- JavaClass testOverride = (JavaClass) rset.getEObject(URI.createURI("java:/org.eclipse.jem.tests.beaninfo#TestOverrides"), true); //$NON-NLS-1$
- assertNotNull(testOverride);
- EStructuralFeature xyz = testOverride.getEStructuralFeature("xyz");
- assertNotNull(xyz);
- // Test that it has the correct type so that we know it was reflected correctly.
- assertEquals(rset.getEObject(URI.createURI("java:/#int"), true), xyz.getEType());
-
- // Test that we have the annotation we added.
- assertNotNull(xyz.getEAnnotation("Override Annotation"));
- }
-
- public void test79083() {
- // Test bug 79083: Null ETypes from overrides that didn't have a reflection to give it the type. BeanInfo should make it EObject type.
- JavaClass testOverride = (JavaClass) rset.getEObject(URI.createURI("java:/org.eclipse.jem.tests.beaninfo#TestOverrides"), true); //$NON-NLS-1$
- assertNotNull(testOverride);
- EStructuralFeature test79083 = testOverride.getEStructuralFeature("test79083");
- assertNotNull(test79083);
- assertEquals(EcorePackage.eINSTANCE.getEObject(), test79083.getEType());
- }
-}
diff --git a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/instantiation/InstantiationSuite.java b/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/instantiation/InstantiationSuite.java
deleted file mode 100644
index 78d375c1..00000000
--- a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/instantiation/InstantiationSuite.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jem.tests.instantiation;
-/*
- * $RCSfile: InstantiationSuite.java,v $
- * $Revision: 1.9 $ $Date: 2005/02/15 23:00:16 $
- */
-import java.net.URL;
-
-import junit.extensions.TestSetup;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-
-import org.eclipse.jem.internal.beaninfo.adapters.BeaninfoNature;
-import org.eclipse.jem.internal.instantiation.base.JavaInstantiation;
-import org.eclipse.jem.tests.JavaProjectUtil;
-import org.eclipse.jem.tests.JavaTestsPlugin;
-import org.eclipse.jem.tests.beaninfo.AbstractBeanInfoTestCase;
-
-/**
- * @author richkulp
- *
- */
-public class InstantiationSuite extends TestSetup {
-
- // Test cases to be include in the suite
- private static final Class testsList[] = { TestStandard.class, };
-
- /**
- *
- */
- public InstantiationSuite() {
- this("Test Instantiation Suite");
- }
-
- /**
- * @param name
- */
- public InstantiationSuite(String name) {
- super(new TestSuite(name) {
- {
- for (int i = 0; i < testsList.length; i++) {
- addTestSuite(testsList[i]);
- }
-
- }
- });
- }
-
- public static Test suite() {
- return new InstantiationSuite();
- }
-
- private boolean oldAutoBuildingState; // autoBuilding state before we started.
- protected void setUp() throws Exception {
- System.out.println("-- Initializing the Instantiation test data --"); //$NON-NLS-1$
- oldAutoBuildingState = JavaProjectUtil.setAutoBuild(true);
- URL installURL = JavaTestsPlugin.getPlugin().getBundle().getEntry("/");
- String[] zipPaths = new String[2];
- zipPaths[0] = Platform.asLocalURL(new URL(installURL, "testdata/testbeaninfo.zip")).getFile();
- zipPaths[1] = Platform.asLocalURL(new URL(installURL, "testdata/testbeaninfopreq.zip")).getFile();
- IProject[] projects =
- JavaProjectUtil.importProjects(
- new String[] { AbstractBeanInfoTestCase.TEST_BEANINFO_PROJECT, AbstractBeanInfoTestCase.TEST_BEANINFO_PREREQ_PROJECT },
- zipPaths);
- assertNotNull(projects[0]);
- assertNotNull(projects[1]);
- JavaProjectUtil.waitForAutoBuild();
- System.out.println("-- Data initialized --"); //$NON-NLS-1$
-
- BeaninfoNature nature = BeaninfoNature.getRuntime(projects[0]);
- assertNotNull(nature);
- JavaInstantiation.initialize(nature.getResourceSet());
- }
-
- protected void tearDown() throws Exception {
- ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- JavaProjectUtil.deleteProject(JavaProjectUtil.getProject(AbstractBeanInfoTestCase.TEST_BEANINFO_PROJECT));
- JavaProjectUtil.deleteProject(JavaProjectUtil.getProject(AbstractBeanInfoTestCase.TEST_BEANINFO_PREREQ_PROJECT));
- }
- }, ResourcesPlugin.getWorkspace().getRoot(), 0, null);
-
- JavaProjectUtil.setAutoBuild(oldAutoBuildingState);
- }
-
-}
diff --git a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/instantiation/TestStandard.java b/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/instantiation/TestStandard.java
deleted file mode 100644
index e3aae607..00000000
--- a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/instantiation/TestStandard.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * Created on Sep 3, 2003
- *
- * To change the template for this generated file go to
- * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
- */
-package org.eclipse.jem.tests.instantiation;
-
-import java.io.*;
-import java.util.Collections;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-
-import org.eclipse.jem.internal.beaninfo.adapters.BeaninfoNature;
-import org.eclipse.jem.internal.instantiation.InitStringAllocation;
-import org.eclipse.jem.internal.instantiation.InstantiationFactory;
-import org.eclipse.jem.internal.instantiation.base.IJavaDataTypeInstance;
-import org.eclipse.jem.internal.instantiation.base.IJavaObjectInstance;
-import org.eclipse.jem.java.*;
-import org.eclipse.jem.tests.JavaProjectUtil;
-import org.eclipse.jem.tests.beaninfo.AbstractBeanInfoTestCase;
-
-/**
- * @author richkulp
- *
- * To change the template for this generated type comment go to
- * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
- */
-public class TestStandard extends TestCase {
-
- /**
- *
- */
- public TestStandard() {
- super();
- }
-
- /**
- * @param name
- */
- public TestStandard(String name) {
- super(name);
- }
-
- protected BeaninfoNature nature;
- protected ResourceSet rset;
- protected JavaHelpers boolType;
-
- /* (non-Javadoc)
- * @see junit.framework.TestCase#setUp()
- */
- protected void setUp() throws Exception {
- super.setUp();
- IProject biProject = JavaProjectUtil.getProject(AbstractBeanInfoTestCase.TEST_BEANINFO_PROJECT);
- assertNotNull(biProject);
- nature = BeaninfoNature.getRuntime(biProject);
- assertNotNull(nature);
- rset = nature.getResourceSet();
- assertNotNull(rset);
- boolType = JavaRefFactory.eINSTANCE.reflectType("boolean", rset);
- assertNotNull(boolType);
- }
-
- protected JavaClass getTest1Class() {
- return (JavaClass) JavaRefFactory.eINSTANCE.reflectType("org.eclipse.jem.tests.beaninfo.Test1Class", rset); //$NON-NLS-1$
- }
-
- public void testInit() {
- JavaClass test1Class = getTest1Class();
-
- // Test instantiate an instance.
- IJavaObjectInstance ji1 = (IJavaObjectInstance) test1Class.getEPackage().getEFactoryInstance().create(test1Class);
- ji1.setAllocation(InstantiationFactory.eINSTANCE.createInitStringAllocation("new Test1Class()")); //$NON-NLS-1$
- assertInit(ji1);
- }
-
- private void assertInit(IJavaObjectInstance ji1) {
- // Here because two tests will do same test sequence.
- assertTrue(ji1.isSetAllocation());
- InitStringAllocation alloc = (InitStringAllocation) ji1.getAllocation();
- assertEquals("new Test1Class()", ((InitStringAllocation) alloc).getInitString()); //$NON-NLS-1$
- }
-
- public void testPropertyAccess() {
- JavaClass test1Class = getTest1Class();
- IJavaObjectInstance ji1 = (IJavaObjectInstance) test1Class.getEPackage().getEFactoryInstance().create(test1Class);
- ji1.setAllocation(InstantiationFactory.eINSTANCE.createInitStringAllocation("new Test1Class()")); //$NON-NLS-1$
-
- // Test property set/get of a dynamic property.
- EStructuralFeature setSF = test1Class.getEStructuralFeature("set");
- assertNotNull(setSF);
- assertSame(boolType, setSF.getEType());
- IJavaDataTypeInstance setting = (IJavaDataTypeInstance) setSF.getEType().getEPackage().getEFactoryInstance().create((EClass) setSF.getEType());
- setting.setAllocation(InstantiationFactory.eINSTANCE.createInitStringAllocation("true")); //$NON-NLS-1$
- ji1.eSet(
- setSF,
- setting);
- assertProperty(ji1);
- }
-
- private void assertProperty(IJavaObjectInstance ji1) {
- // Here because two tests will do same test sequence.
- EStructuralFeature setSF = ji1.eClass().getEStructuralFeature("set");
- Object v = ji1.eGet(setSF);
- assertNotNull(v);
- assertTrue(v instanceof IJavaDataTypeInstance);
- IJavaDataTypeInstance dtv = (IJavaDataTypeInstance) v;
- assertSame(boolType, dtv.getJavaType());
- assertTrue(dtv.isSetAllocation());
- InitStringAllocation alloc = (InitStringAllocation) dtv.getAllocation();
- assertEquals("true", ((InitStringAllocation) alloc).getInitString());
- }
-
- protected IJavaObjectInstance setupInstance() {
- // Setup the standard test instance without the assertions. For use in other tests.
- JavaClass test1Class = getTest1Class();
- IJavaObjectInstance ji1 = (IJavaObjectInstance) test1Class.getEPackage().getEFactoryInstance().create(test1Class);
- ji1.setAllocation(InstantiationFactory.eINSTANCE.createInitStringAllocation("new Test1Class()")); //$NON-NLS-1$
-
- // Test property set/get of a dynamic property.
- EStructuralFeature setSF = test1Class.getEStructuralFeature("set");
- IJavaDataTypeInstance setting = (IJavaDataTypeInstance) setSF.getEType().getEPackage().getEFactoryInstance().create((EClass) setSF.getEType());
- setting.setAllocation(InstantiationFactory.eINSTANCE.createInitStringAllocation("true")); //$NON-NLS-1$
- ji1.eSet(
- setSF,
- setting);
- return ji1;
- }
-
- protected String setupResource() throws IOException {
- IJavaObjectInstance ji1 = setupInstance();
-
- // Write it out, see if it is what it should be, then read it in and see if it loads correctly.
- ResourceSet rswork1 = nature.newResourceSet(); // Rsource set to write from
-
- Resource r = rswork1.createResource(URI.createURI("f.xmi")); //$NON-NLS-1$
- r.getContents().add(ji1);
- // Bit of a kludge, but all references in java model are shared, so to serialize we need to get the
- // "set" setting and add to the resource so that it is contained somewhere.
- r.getContents().add(ji1.eGet(ji1.eClass().getEStructuralFeature("set")));
-
- ByteArrayOutputStream bo = new ByteArrayOutputStream();
- r.save(bo, Collections.EMPTY_MAP);
- return bo.toString();
- }
-
- public void testSerialization() throws IOException {
- // Test the serialization that it produces correct output string.
- String out = setupResource();
- // Need to create a print stream so that we get the correct local newline chars in to match from the resource.
- StringWriter sw = new StringWriter(out.length() + 50);
- PrintWriter pw = new PrintWriter(sw);
- pw.println("<?xml version=\"1.0\" encoding=\"ASCII\"?>");
- pw.println(
- "<xmi:XMI xmi:version=\"2.0\" xmlns:xmi=\"http://www.omg.org/XMI\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:_-javaprim=\"java:/\" xmlns:org.eclipse.jem.internal.instantiation=\"http:///org/eclipse/jem/internal/instantiation.ecore\" xmlns:org.eclipse.jem.tests.beaninfo=\"java:/org.eclipse.jem.tests.beaninfo\">");
- pw.println(" <org.eclipse.jem.tests.beaninfo:Test1Class set=\"/1\">");
- pw.println(" <allocation xsi:type=\"org.eclipse.jem.internal.instantiation:InitStringAllocation\" initString=\"new Test1Class()\"/>");
- pw.println(" </org.eclipse.jem.tests.beaninfo:Test1Class>");
- pw.println(" <_-javaprim:boolean>");
- pw.println(" <allocation xsi:type=\"org.eclipse.jem.internal.instantiation:InitStringAllocation\" initString=\"true\"/>");
- pw.println(" </_-javaprim:boolean>");
- pw.println("</xmi:XMI>");
- pw.close();
- assertEquals(sw.toString(), out);
- }
-
- public void testReading() throws IOException {
- // Test reading serialization back in produces correct objects.
- // Rerun tests.
- String out = setupResource();
-
- ResourceSet rswork2 = nature.newResourceSet(); // Resource set to read into
- Resource rIn = rswork2.createResource(URI.createURI("f1.xmi")); //$NON-NLS-1$
- rIn.load(new ByteArrayInputStream(out.getBytes()), Collections.EMPTY_MAP);
- JavaClass test1Class = getTest1Class();
- IJavaObjectInstance ji1 = (IJavaObjectInstance) EcoreUtil.getObjectByType(rIn.getContents(), test1Class);
- assertNotNull(ji1);
- assertInit(ji1);
- assertProperty(ji1);
- }
-
-}
diff --git a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/modelListeners/IListenerTester.java b/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/modelListeners/IListenerTester.java
deleted file mode 100644
index 45993419..00000000
--- a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/modelListeners/IListenerTester.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * $RCSfile: IListenerTester.java,v $
- * $Revision: 1.2 $ $Date: 2005/02/15 23:00:16 $
- */
-package org.eclipse.jem.tests.modelListeners;
-
-import junit.framework.AssertionFailedError;
-
-
-/**
- * For many of the listener tests, the actual Assert is done on a safe runnable so that it can't be
- * normally sent. So we will have a listener tester that will retrieve the exception and will
- * be called to get it from the main thread.
- * @since 1.0.0
- */
-public interface IListenerTester {
-
- public void isException() throws AssertionFailedError;
- public void isComplete() throws AssertionFailedError;
-}
diff --git a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/modelListeners/ListenersSuite.java b/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/modelListeners/ListenersSuite.java
deleted file mode 100644
index ea6cd77b..00000000
--- a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/modelListeners/ListenersSuite.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jem.tests.modelListeners;
-/*
- * $RCSfile: ListenersSuite.java,v $
- * $Revision: 1.4 $ $Date: 2005/02/15 23:00:16 $
- */
-import java.net.URL;
-
-import junit.extensions.TestSetup;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-
-import org.eclipse.jem.tests.JavaProjectUtil;
-import org.eclipse.jem.tests.JavaTestsPlugin;
-import org.eclipse.jem.tests.beaninfo.AbstractBeanInfoTestCase;
-
-/**
- * @author richkulp
- *
- */
-public class ListenersSuite extends TestSetup {
-
- // Test cases to be include in the suite
- private static final Class testsList[] = { TestJEM.class, TestBeanInfo.class};
-
- /**
- *
- */
- public ListenersSuite() {
- this("Test Listeners Suite");
- }
-
- /**
- * @param name
- */
- public ListenersSuite(String name) {
- super(new TestSuite(name) {
- {
- for (int i = 0; i < testsList.length; i++) {
- addTestSuite(testsList[i]);
- }
-
- }
- });
- }
-
- public static Test suite() {
- return new ListenersSuite();
- }
-
- private boolean oldAutoBuildingState; // autoBuilding state before we started.
- protected void setUp() throws Exception {
- System.out.println("-- Initializing the Listeners test data --"); //$NON-NLS-1$
- oldAutoBuildingState = JavaProjectUtil.setAutoBuild(true);
- URL installURL = JavaTestsPlugin.getPlugin().getBundle().getEntry("/");
- String[] zipPaths = new String[2];
- zipPaths[0] = Platform.asLocalURL(new URL(installURL, "testdata/testbeaninfo.zip")).getFile();
- zipPaths[1] = Platform.asLocalURL(new URL(installURL, "testdata/testbeaninfopreq.zip")).getFile();
- IProject[] projects =
- JavaProjectUtil.importProjects(
- new String[] { AbstractBeanInfoTestCase.TEST_BEANINFO_PROJECT, AbstractBeanInfoTestCase.TEST_BEANINFO_PREREQ_PROJECT },
- zipPaths);
- assertNotNull(projects[0]);
- assertNotNull(projects[1]);
- JavaProjectUtil.waitForAutoBuild();
- System.out.println("-- Data initialized --"); //$NON-NLS-1$
-
- }
-
- protected void tearDown() throws Exception {
- ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- JavaProjectUtil.deleteProject(JavaProjectUtil.getProject(AbstractBeanInfoTestCase.TEST_BEANINFO_PROJECT));
- JavaProjectUtil.deleteProject(JavaProjectUtil.getProject(AbstractBeanInfoTestCase.TEST_BEANINFO_PREREQ_PROJECT));
- }
- }, ResourcesPlugin.getWorkspace().getRoot(), 0, null);
-
- JavaProjectUtil.setAutoBuild(oldAutoBuildingState);
- }
-
-}
diff --git a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/modelListeners/TestBeanInfo.java b/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/modelListeners/TestBeanInfo.java
deleted file mode 100644
index 83b21d88..00000000
--- a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/modelListeners/TestBeanInfo.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * $RCSfile: TestBeanInfo.java,v $
- * $Revision: 1.3 $ $Date: 2005/02/15 23:00:16 $
- */
-package org.eclipse.jem.tests.modelListeners;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jdt.core.JavaModelException;
-
-import org.eclipse.jem.internal.beaninfo.adapters.BeaninfoModelSynchronizer;
-import org.eclipse.jem.internal.beaninfo.core.IBeaninfoSupplier;
-import org.eclipse.jem.internal.proxy.core.ProxyFactoryRegistry;
-
-
-/**
- * This is for testing the JEM Reflection listeners
- * @since 1.0.0
- */
-public class TestBeanInfo extends TestListeners {
-
- BeaninfoModelSynchronizer sync;
- TestBeaninfoAdapterFactory factory;
-
- /* (non-Javadoc)
- * @see junit.framework.TestCase#setUp()
- */
- protected void setUp() throws Exception {
- factory = new TestBeaninfoAdapterFactory(new IBeaninfoSupplier() {
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jem.internal.beaninfo.core.IBeaninfoSupplier#getRegistry()
- */
- public ProxyFactoryRegistry getRegistry() {
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jem.internal.beaninfo.core.IBeaninfoSupplier#isRegistryCreated()
- */
- public boolean isRegistryCreated() {
- return false;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jem.internal.beaninfo.core.IBeaninfoSupplier#closeRegistry()
- */
- public void closeRegistry() {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jem.internal.beaninfo.core.IBeaninfoSupplier#getProject()
- */
- public IProject getProject() {
- return jp.getProject();
- }
- }); // Needs to be set first so that super.setUP() calls to special setups will have a factory.
- super.setUp(); // Called first so that any setup won't fire our synchronizer.
-
- // Basic for this is add our special listener. (Don't need full JEM model cluttering things up).
- sync = new BeaninfoModelSynchronizer(factory, jp);
- setTester(factory);
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.jem.tests.modelListeners.TestListeners#setUpClose()
- */
- protected void setUpClose() throws JavaModelException {
- super.setUpClose();
- factory.setTestCases(new int[0], new Object[0]);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jem.tests.modelListeners.TestListeners#setUpOpen()
- */
- protected void setUpOpen() {
- super.setUpOpen();
- factory.setTestCases(new int[0], new Object[0]);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jem.tests.modelListeners.TestListeners#setUpAddMethodInWorkingCopy()
- */
- protected void setUpAddMethodInWorkingCopy() throws JavaModelException {
- super.setUpAddMethodInWorkingCopy();
- factory.setTestCases(new int[0], new Object[0]);
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.jem.tests.modelListeners.TestListeners#setUpSaveFromWorkingCopy()
- */
- protected void setUpSaveFromWorkingCopy() throws JavaModelException {
- super.setUpSaveFromWorkingCopy();
- factory.setTestCases(new int[] {TestBeaninfoAdapterFactory.MARK_STALE_INTROSPECTION_PLUS_INNER}, new Object[] {new Object[] {"org.eclipse.jem.tests.beaninfo.Test1Class", Boolean.FALSE}});
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jem.tests.modelListeners.TestListeners#setUpRevert()
- */
- protected void setUpRevert() throws JavaModelException {
- super.setUpRevert();
- factory.setTestCases(new int[0], new Object[0]);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jem.tests.modelListeners.TestListeners#setupDeleteMethodNoWorkingCopy()
- */
- protected void setupDeleteMethodNoWorkingCopy() throws JavaModelException {
- super.setupDeleteMethodNoWorkingCopy();
- factory.setTestCases(new int[] {TestBeaninfoAdapterFactory.MARK_STALE_INTROSPECTION_PLUS_INNER}, new Object[] {new Object[] {"org.eclipse.jem.tests.beaninfo.Test1Class", Boolean.FALSE}});
- }
- /* (non-Javadoc)
- * @see org.eclipse.jem.tests.modelListeners.TestListeners#setupAddClass()
- */
- protected void setupAddClass() {
- super.setupAddClass();
- factory.setTestCases(new int[] {TestBeaninfoAdapterFactory.MARK_STALE_INTROSPECTION_PLUS_INNER}, new Object[] {new Object[] {"org.eclipse.jem.tests.beaninfo.NewClass", Boolean.TRUE}});
- }
- /* (non-Javadoc)
- * @see org.eclipse.jem.tests.modelListeners.TestListeners#setupDeleteClassWithWorkingCopy()
- */
- protected void setupDeleteClassWithWorkingCopy() throws JavaModelException {
- super.setupDeleteClassWithWorkingCopy();
- factory.setTestCases(new int[] {TestBeaninfoAdapterFactory.MARK_STALE_INTROSPECTION_PLUS_INNER, TestBeaninfoAdapterFactory.MARK_STALE_INTROSPECTION_PLUS_INNER}, new Object[] {new Object[] {"org.eclipse.jem.tests.beaninfo.NewClass", Boolean.FALSE}, new Object[] {"org.eclipse.jem.tests.beaninfo.NewClass", Boolean.TRUE}});
- }
- /* (non-Javadoc)
- * @see org.eclipse.jem.tests.modelListeners.TestListeners#setUpDeleteClassNoWorkingCopy()
- */
- protected void setUpDeleteClassNoWorkingCopy() throws JavaModelException {
- super.setUpDeleteClassNoWorkingCopy();
- factory.setTestCases(new int[] {TestBeaninfoAdapterFactory.MARK_STALE_INTROSPECTION_PLUS_INNER}, new Object[] {new Object[] {"org.eclipse.jem.tests.beaninfo.NewClass", Boolean.TRUE}});
- }
- /* (non-Javadoc)
- * @see org.eclipse.jem.tests.modelListeners.TestListeners#setUpAddPackage()
- */
- protected void setUpAddPackage() throws JavaModelException {
- super.setUpAddPackage();
- factory.setTestCases(new int[0], new Object[0]);
- }
- /* (non-Javadoc)
- * @see org.eclipse.jem.tests.modelListeners.TestListeners#setUpDeletePackage()
- */
- protected void setUpDeletePackage() throws JavaModelException {
- super.setUpDeletePackage();
- factory.setTestCases(new int[] {TestBeaninfoAdapterFactory.MARK_ALL_STALE}, new Object[] {null});
- }
- /* (non-Javadoc)
- * @see junit.framework.TestCase#tearDown()
- */
- protected void tearDown() throws Exception {
- sync.stopSynchronizer(true);
- super.tearDown();
- }
-}
diff --git a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/modelListeners/TestBeaninfoAdapterFactory.java b/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/modelListeners/TestBeaninfoAdapterFactory.java
deleted file mode 100644
index 419339c3..00000000
--- a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/modelListeners/TestBeaninfoAdapterFactory.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * $RCSfile: TestBeaninfoAdapterFactory.java,v $
- * $Revision: 1.2 $ $Date: 2005/02/15 23:00:16 $
- */
-package org.eclipse.jem.tests.modelListeners;
-
-import junit.framework.Assert;
-import junit.framework.AssertionFailedError;
-
-import org.eclipse.jem.internal.beaninfo.adapters.BeaninfoAdapterFactory;
-import org.eclipse.jem.internal.beaninfo.core.IBeaninfoSupplier;
-
-/**
- * Test factory to handle the calls from the listener during our tests.
- *
- * @since 1.0.0
- */
-public class TestBeaninfoAdapterFactory extends BeaninfoAdapterFactory implements IListenerTester {
-
- /**
- * @param supplier
- *
- * @since 1.0.0
- */
- public TestBeaninfoAdapterFactory(IBeaninfoSupplier supplier) {
- super(supplier);
- }
-
- int callIndex = -1; // Index of calls into control list.
-
- AssertionFailedError exception; // Set if exception occured.
-
- protected int[] callTypes; // Order of permitted calltypes. If any come out of order, then error.
-
- protected Object[] callArgs; // Corresponding args for each call types. Each type specific.
-
- public void setTestCases(int[] callTypes, Object[] callArgs) {
- this.callTypes = callTypes;
- this.callArgs = callArgs;
- }
-
- public void isException() throws AssertionFailedError {
- if (exception != null)
- throw exception;
- }
-
- public void isComplete() throws AssertionFailedError {
- Assert.assertEquals("Did not complete all notifcations. ", callTypes.length, callIndex + 1);
- }
-
- public static final int MARK_ALL_STALE = 0, MARK_STALE_INTROSPECTION = 1, MARK_STALE_INTROSPECTION_PLUS_INNER = 2;
-
- private static final String[] callTypeNames = new String[] { "MARK_ALL_STALE", "MARK_STALE_INTROSPECTION", "MARK_STALE_INTROSPECTION_PLUS_INNER",
- "UNREGISTER_INTROSPECTION", "UNREGISTER_INTROSPECTION_PLUS_INNER"};
-
- /*
- * Test the next call type, if not valid, return false.
- */
- protected boolean testCallType(int callType) {
- if (exception != null)
- return false; // Already had an error
- try {
- if (++callIndex >= callTypes.length)
- Assert.fail("An extra notification of type " + callTypeNames[callType] + " received.");
- if (callTypes[callIndex] != callType)
- Assert.assertEquals(callTypeNames[callTypes[callIndex]], callTypeNames[callType]);
- } catch (AssertionFailedError e) {
- exception = e;
- return false;
- }
- return true;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jem.internal.beaninfo.adapters.BeaninfoAdapterFactory#markAllStale()
- */
- public void markAllStale() {
- testCallType(MARK_ALL_STALE);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jem.internal.beaninfo.adapters.BeaninfoAdapterFactory#markStaleIntrospection(java.lang.String, boolean)
- */
- public void markStaleIntrospection(String sourceName, boolean clearResults) {
- if (testCallType(MARK_STALE_INTROSPECTION)) {
- try {
- Assert.assertEquals((String) ((Object[]) callArgs[callIndex])[0], sourceName);
- Assert.assertEquals(((Boolean) ((Object[]) callArgs[callIndex])[1]).booleanValue(), clearResults);
- } catch (AssertionFailedError e) {
- exception = e;
- }
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jem.internal.beaninfo.adapters.BeaninfoAdapterFactory#markStaleIntrospectionPlusInner(java.lang.String, boolean)
- */
- public void markStaleIntrospectionPlusInner(String sourceName, boolean clearResults) {
- if (testCallType(MARK_STALE_INTROSPECTION_PLUS_INNER)) {
- try {
- Assert.assertEquals((String) ((Object[]) callArgs[callIndex])[0], sourceName);
- Assert.assertEquals(((Boolean) ((Object[]) callArgs[callIndex])[1]).booleanValue(), clearResults);
- } catch (AssertionFailedError e) {
- exception = e;
- }
- }
- }
-} \ No newline at end of file
diff --git a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/modelListeners/TestJEM.java b/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/modelListeners/TestJEM.java
deleted file mode 100644
index 627d8831..00000000
--- a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/modelListeners/TestJEM.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * $RCSfile: TestJEM.java,v $
- * $Revision: 1.3 $ $Date: 2005/02/15 23:00:16 $
- */
-package org.eclipse.jem.tests.modelListeners;
-
-import org.eclipse.jdt.core.JavaModelException;
-
-import org.eclipse.jem.internal.adapters.jdom.JavaReflectionSynchronizer;
-
-
-/**
- * This is for testing the JEM Reflection listeners
- * @since 1.0.0
- */
-public class TestJEM extends TestListeners {
-
- JavaReflectionSynchronizer sync;
- TestJavaJDOMAdapterFactory factory;
-
- /* (non-Javadoc)
- * @see junit.framework.TestCase#setUp()
- */
- protected void setUp() throws Exception {
- factory = new TestJavaJDOMAdapterFactory(); // Needs to be set first so that super.setUP() calls to special setups will have a factory.
- super.setUp(); // Called first so that any setup won't fire our synchronizer.
-
- // Basic for this is add our special listener. (Don't need full JEM model cluttering things up).
- factory.setJavaProject(jp);
- sync = factory.getSynchronizer();
- setTester(factory);
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.jem.tests.modelListeners.TestListeners#setUpClose()
- */
- protected void setUpClose() throws JavaModelException {
- super.setUpClose();
- factory.setTestCases(new int[0], new Object[0]);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jem.tests.modelListeners.TestListeners#setUpOpen()
- */
- protected void setUpOpen() {
- super.setUpOpen();
- factory.setTestCases(new int[0], new Object[0]);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jem.tests.modelListeners.TestListeners#setUpAddMethodInWorkingCopy()
- */
- protected void setUpAddMethodInWorkingCopy() throws JavaModelException {
- super.setUpAddMethodInWorkingCopy();
- factory.setTestCases(new int[0], new Object[0]);
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.jem.tests.modelListeners.TestListeners#setUpSaveFromWorkingCopy()
- */
- protected void setUpSaveFromWorkingCopy() throws JavaModelException {
- super.setUpSaveFromWorkingCopy();
- factory.setTestCases(new int[] {TestJavaJDOMAdapterFactory.FLUSH_REFLECTION_PLUS_INNER_NO_NOTIFICATION}, new Object[] {"org.eclipse.jem.tests.beaninfo.Test1Class"});
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jem.tests.modelListeners.TestListeners#setUpRevert()
- */
- protected void setUpRevert() throws JavaModelException {
- super.setUpRevert();
- factory.setTestCases(new int[0], new Object[0]);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jem.tests.modelListeners.TestListeners#setupDeleteMethodNoWorkingCopy()
- */
- protected void setupDeleteMethodNoWorkingCopy() throws JavaModelException {
- super.setupDeleteMethodNoWorkingCopy();
- factory.setTestCases(new int[] {TestJavaJDOMAdapterFactory.FLUSH_REFLECTION_PLUS_INNER_NO_NOTIFICATION}, new Object[] {"org.eclipse.jem.tests.beaninfo.Test1Class"});
- }
- /* (non-Javadoc)
- * @see org.eclipse.jem.tests.modelListeners.TestListeners#setupAddClass()
- */
- protected void setupAddClass() {
- super.setupAddClass();
- factory.setTestCases(new int[0], new Object[0]);
- }
- /* (non-Javadoc)
- * @see org.eclipse.jem.tests.modelListeners.TestListeners#setupDeleteClassWithWorkingCopy()
- */
- protected void setupDeleteClassWithWorkingCopy() throws JavaModelException {
- super.setupDeleteClassWithWorkingCopy();
- factory.setTestCases(new int[] {TestJavaJDOMAdapterFactory.FLUSH_REFLECTION_PLUS_INNER_NO_NOTIFICATION, TestJavaJDOMAdapterFactory.DISASSOCIATE_SOURCE_PLUS_INNER_NOTIFY}, new Object[] {"org.eclipse.jem.tests.beaninfo.NewClass", new Object[] {"org.eclipse.jem.tests.beaninfo.NewClass", Boolean.FALSE}});
- }
- /* (non-Javadoc)
- * @see org.eclipse.jem.tests.modelListeners.TestListeners#setUpDeleteClassNoWorkingCopy()
- */
- protected void setUpDeleteClassNoWorkingCopy() throws JavaModelException {
- super.setUpDeleteClassNoWorkingCopy();
- factory.setTestCases(new int[] {TestJavaJDOMAdapterFactory.DISASSOCIATE_SOURCE_PLUS_INNER_NOTIFY}, new Object[] {new Object[] {"org.eclipse.jem.tests.beaninfo.NewClass", Boolean.FALSE}});
- }
- /* (non-Javadoc)
- * @see org.eclipse.jem.tests.modelListeners.TestListeners#setUpAddPackage()
- */
- protected void setUpAddPackage() throws JavaModelException {
- super.setUpAddPackage();
- factory.setTestCases(new int[] {TestJavaJDOMAdapterFactory.FLUSH_PACKAGE_NO_NOTIFICATION}, new Object[] {new Object[] {"test", Boolean.TRUE}});
- }
- /* (non-Javadoc)
- * @see org.eclipse.jem.tests.modelListeners.TestListeners#setUpDeletePackage()
- */
- protected void setUpDeletePackage() throws JavaModelException {
- super.setUpDeletePackage();
- factory.setTestCases(new int[] {TestJavaJDOMAdapterFactory.FLUSH_PACKAGE}, new Object[] {new Object[] {"test", Boolean.FALSE}});
- }
- /* (non-Javadoc)
- * @see junit.framework.TestCase#tearDown()
- */
- protected void tearDown() throws Exception {
- sync.stopSynchronizer();
- super.tearDown();
- }
-}
diff --git a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/modelListeners/TestJavaJDOMAdapterFactory.java b/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/modelListeners/TestJavaJDOMAdapterFactory.java
deleted file mode 100644
index e78fdbf3..00000000
--- a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/modelListeners/TestJavaJDOMAdapterFactory.java
+++ /dev/null
@@ -1,234 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * $RCSfile: TestJavaJDOMAdapterFactory.java,v $
- * $Revision: 1.2 $ $Date: 2005/02/15 23:00:16 $
- */
-package org.eclipse.jem.tests.modelListeners;
-
-import java.util.Collections;
-import java.util.List;
-
-import junit.framework.Assert;
-import junit.framework.AssertionFailedError;
-
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.jdt.core.ICompilationUnit;
-
-import org.eclipse.jem.internal.adapters.jdom.JavaJDOMAdapterFactory;
-import org.eclipse.jem.internal.adapters.jdom.JavaReflectionSynchronizer;
-
-
-/**
- * A test version of this so that it works with our test cases without having fullblown JEM model up and running.
- * @since 1.0.0
- */
-public class TestJavaJDOMAdapterFactory extends JavaJDOMAdapterFactory implements IListenerTester {
-
- int callIndex = -1; // Index of calls into control list.
- AssertionFailedError exception; // Set if exception occured.
-
- protected int[] callTypes; // Order of permitted calltypes. If any come out of order, then error.
- protected Object[] callArgs; // Corresponding args for each call types. Each type specific.
-
- public void setTestCases(int[] callTypes, Object[] callArgs) {
- this.callTypes = callTypes;
- this.callArgs = callArgs;
- }
-
- public void isException() throws AssertionFailedError {
- if (exception != null)
- throw exception;
- }
-
- public void isComplete() throws AssertionFailedError {
- Assert.assertEquals("Did not complete all notifcations. ", callTypes.length, callIndex+1);
- }
-
- public static final int FLUSH_ALL = 0, FLUSH_ALL_NO_NOTIFICATION = 1, FLUSH_PACKAGE = 2, FLUSH_PACKAGE_NO_NOTIFICATION = 3,
- FLUSH_REFLECTION = 4, FLUSH_REFLECTION_NO_NOTIFICATION = 5, FLUSH_REFLECTION_PLUS_INNER_NO_NOTIFICATION = 6, NOTIFY_CONTENT_CHANGED = 7,
- DISASSOCIATE_SOURCE_NOTIFY = 8, DISASSOCIATE_SOURCE = 9, DISASSOCIATE_SOURCE_PLUS_INNER_NOTIFY = 10, DISASSOCIATE_SOURCE_PLUS_INNER = 11;
-
- private static final String[] callTypeNames = new String[] {"FLUSH_ALL", "FLUSH_ALL_NO_NOTIFICATION", "FLUSH_PACKAGE", "FLUSH_PACKAGE_NO_NOTIFICATION",
- "FLUSH_REFLECTION", "FLUSH_REFLECTION_NO_NOTIFICATION", "FLUSH_REFLECTION_PLUS_INNER_NO_NOTIFICATION", "NOTIFY_CONTENT_CHANGED",
- "DISASSOCIATE_SOURCE_NOTIFY", "DISASSOCIATE_SOURCE", "DISASSOCIATE_SOURCE_PLUS_INNER_NOTIFY", "DISASSOCIATE_SOURCE_PLUS_INNER"};
- /*
- * Test the next call type, if not valid, return false.
- */
- protected boolean testCallType(int callType) {
- if (exception != null)
- return false; // Already had an error
- try {
- if (++callIndex >= callTypes.length)
- Assert.fail("An extra notification of type " + callTypeNames[callType] + " received.");
- if (callTypes[callIndex] != callType)
- Assert.assertEquals(callTypeNames[callTypes[callIndex]], callTypeNames[callType]);
- } catch (AssertionFailedError e) {
- exception = e;
- return false;
- }
- return true;
- }
- /* (non-Javadoc)
- * @see org.eclipse.jem.internal.java.adapters.JavaReflectionAdapterFactory#flushAll()
- */
- public void flushAll() {
- testCallType(FLUSH_ALL);
- }
- /* (non-Javadoc)
- * @see org.eclipse.jem.internal.adapters.jdom.JavaJDOMAdapterFactory#flushAllNoNotification()
- */
- public List flushAllNoNotification() {
- testCallType(FLUSH_ALL_NO_NOTIFICATION);
- return Collections.EMPTY_LIST;
- }
- /* (non-Javadoc)
- * @see org.eclipse.jem.internal.adapters.jdom.JavaJDOMAdapterFactory#flushPackage(java.lang.String, boolean)
- */
- public void flushPackage(String packageName, boolean noFlushIfSourceFound) {
- if (testCallType(FLUSH_PACKAGE)) {
- try {
- Assert.assertEquals((String) ((Object[]) callArgs[callIndex])[0], packageName);
- Assert.assertEquals(((Boolean) ((Object[]) callArgs[callIndex])[1]).booleanValue(), noFlushIfSourceFound);
- } catch (AssertionFailedError e) {
- exception = e;
- }
- }
- }
- /* (non-Javadoc)
- * @see org.eclipse.jem.internal.adapters.jdom.JavaJDOMAdapterFactory#flushPackageNoNotification(java.lang.String, boolean)
- */
- public List flushPackageNoNotification(String packageName, boolean noFlushIfSourceFound) {
- if (testCallType(FLUSH_PACKAGE_NO_NOTIFICATION)) {
- try {
- Assert.assertEquals((String) ((Object[]) callArgs[callIndex])[0], packageName);
- Assert.assertEquals(((Boolean) ((Object[]) callArgs[callIndex])[1]).booleanValue(), noFlushIfSourceFound);
- } catch (AssertionFailedError e) {
- exception = e;
- }
- }
- return Collections.EMPTY_LIST;
- }
- /* (non-Javadoc)
- * @see org.eclipse.jem.internal.java.adapters.JavaReflectionAdapterFactory#flushReflection(java.lang.String)
- */
- public void flushReflection(String source) {
- if (testCallType(FLUSH_REFLECTION)) {
- try {
- Assert.assertEquals((String) callArgs[callIndex], source);
- } catch (AssertionFailedError e) {
- exception = e;
- }
- }
- }
- /* (non-Javadoc)
- * @see org.eclipse.jem.internal.adapters.jdom.JavaJDOMAdapterFactory#flushReflectionNoNotification(java.lang.String)
- */
- public Notification flushReflectionNoNotification(String source) {
- if (testCallType(FLUSH_REFLECTION_NO_NOTIFICATION)) {
- try {
- Assert.assertEquals((String) callArgs[callIndex], source);
- } catch (AssertionFailedError e) {
- exception = e;
- }
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jem.internal.adapters.jdom.JavaJDOMAdapterFactory#flushReflectionPlusInnerNoNotification(java.lang.String)
- */
- public Notification flushReflectionPlusInnerNoNotification(String source) {
- if (testCallType(FLUSH_REFLECTION_PLUS_INNER_NO_NOTIFICATION)) {
- try {
- Assert.assertEquals((String) callArgs[callIndex], source);
- } catch (AssertionFailedError e) {
- exception = e;
- }
- }
- return null;
- }
- /* (non-Javadoc)
- * @see org.eclipse.jem.internal.adapters.jdom.JavaJDOMAdapterFactory#notifyContentChanged(org.eclipse.jdt.core.ICompilationUnit)
- */
- public void notifyContentChanged(ICompilationUnit targetCU) {
- if (testCallType(NOTIFY_CONTENT_CHANGED)) {
- try {
- Assert.assertEquals((String) callArgs[callIndex], targetCU.getElementName());
- } catch (AssertionFailedError e) {
- exception = e;
- }
- }
- }
-
-
-
- /* (non-Javadoc)
- * @see org.eclipse.jem.internal.java.adapters.JavaReflectionAdapterFactory#disAssociateSource(java.lang.String, boolean)
- */
- public Notification disAssociateSource(String source, boolean doNotify) {
- if (testCallType(DISASSOCIATE_SOURCE_NOTIFY)) {
- try {
- Assert.assertEquals((String) ((Object[]) callArgs[callIndex])[0], source);
- Assert.assertEquals(((Boolean) ((Object[]) callArgs[callIndex])[1]).booleanValue(), doNotify);
- } catch (AssertionFailedError e) {
- exception = e;
- }
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jem.internal.java.adapters.JavaReflectionAdapterFactory#disAssociateSource(java.lang.String)
- */
- public Notification disAssociateSource(String source) {
- if (testCallType(DISASSOCIATE_SOURCE)) {
- try {
- Assert.assertEquals((String) callArgs[callIndex], source);
- } catch (AssertionFailedError e) {
- exception = e;
- }
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jem.internal.java.adapters.JavaReflectionAdapterFactory#disAssociateSourcePlusInner(java.lang.String, boolean)
- */
- public Notification disAssociateSourcePlusInner(String source, boolean doNotify) {
- if (testCallType(DISASSOCIATE_SOURCE_PLUS_INNER_NOTIFY)) {
- try {
- Assert.assertEquals((String) ((Object[]) callArgs[callIndex])[0], source);
- Assert.assertEquals(((Boolean) ((Object[]) callArgs[callIndex])[1]).booleanValue(), doNotify);
- } catch (AssertionFailedError e) {
- exception = e;
- }
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jem.internal.java.adapters.JavaReflectionAdapterFactory#disAssociateSourcePlusInner(java.lang.String)
- */
- public void disAssociateSourcePlusInner(String source) {
- if (testCallType(DISASSOCIATE_SOURCE_PLUS_INNER)) {
- try {
- Assert.assertEquals((String) callArgs[callIndex], source);
- } catch (AssertionFailedError e) {
- exception = e;
- }
- }
- }
-
- public JavaReflectionSynchronizer getSynchronizer() {
- return synchronizer;
- }
-}
diff --git a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/modelListeners/TestListeners.java b/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/modelListeners/TestListeners.java
deleted file mode 100644
index 64630e12..00000000
--- a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/modelListeners/TestListeners.java
+++ /dev/null
@@ -1,350 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * $RCSfile: TestListeners.java,v $
- * $Revision: 1.2 $ $Date: 2005/02/15 23:00:16 $
- */
-package org.eclipse.jem.tests.modelListeners;
-
-import java.util.Arrays;
-import java.util.List;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jdt.core.*;
-
-import org.eclipse.jem.tests.JavaProjectUtil;
-import org.eclipse.jem.tests.beaninfo.AbstractBeanInfoTestCase;
-
-
-/**
- *
- * @since 1.0.0
- */
-public abstract class TestListeners extends TestCase {
-
- protected IJavaProject jp;
-
- // The indexes of these lookups are found in the setup and teardown methods. They must be kept in sync.
- protected List setupSpecials = Arrays.asList(new String[] { "testOpen", "testClose", "testAddMethodInWorkcopy", "testSaveFromWorkingCopy",
- "testRevert", "testDeleteMethodNoWorkingCopy", "testAddClass", "testDeleteClassWithWorkingCopy",
- "testDeleteClassNoWorkingCopy", "testAddPackage", "testDeletePackage"});
-
- protected IListenerTester tester;
-
- /* (non-Javadoc)
- * @see junit.framework.TestCase#setUp()
- */
- protected void setUp() throws Exception {
- super.setUp();
- jp = JavaCore.create(JavaProjectUtil.getProject(AbstractBeanInfoTestCase.TEST_BEANINFO_PROJECT));
- String testname = getName();
- int index = setupSpecials.indexOf(testname);
- switch (index) {
- case 0:
- setUpOpen();
- break;
- case 1:
- setUpClose();
- break;
- case 2:
- setUpAddMethodInWorkingCopy();
- break;
- case 3:
- setUpSaveFromWorkingCopy();
- break;
- case 4:
- setUpRevert();
- break;
- case 5:
- setupDeleteMethodNoWorkingCopy();
- break;
- case 6:
- setupAddClass();
- break;
- case 7:
- setupDeleteClassWithWorkingCopy();
- break;
- case 8:
- setUpDeleteClassNoWorkingCopy();
- break;
- case 9:
- setUpAddPackage();
- break;
- case 10:
- setUpDeletePackage();
- break;
- default:
- break;
- }
- }
-
- /* (non-Javadoc)
- * @see junit.framework.TestCase#tearDown()
- */
- protected void tearDown() throws Exception {
- String testname = getName();
- int index = setupSpecials.indexOf(testname);
- switch (index) {
- case 0:
- tearDownOpen();
- break;
- case 1:
- tearDownClose();
- break;
- case 2:
- tearDownAddMethodInWorkingCopy();
- break;
- case 3:
- tearDownSaveFromWorkingCopy();
- break;
- case 4:
- tearDownRevert();
- break;
- case 5:
- tearDownDeleteMethodNoWorkingCopy();
- break;
- case 6:
- tearDownAddClass();
- break;
- case 7:
- tearDownDeleteClassWithWorkingCopy();
- break;
- case 8:
- tearDownDeleteClassNoWorkingCopy();
- break;
- case 9:
- tearDownAddPackage();
- break;
- case 10:
- tearDownDeletePackage();
- break;
- default:
- break;
- }
- super.tearDown();
- }
-
-
- protected void setTester(IListenerTester tester) {
- this.tester = tester;
- }
-
- protected void setUpOpen() {
- }
- public void testOpen() throws JavaModelException {
- // Test open a working copy.
- testCU = (ICompilationUnit) jp.findElement(new Path("org/eclipse/jem/tests/beaninfo/Test1Class.java"));
- testCU.becomeWorkingCopy(null, null);
- tester.isException();
- tester.isComplete(); // It should of been complete.
- }
- protected void tearDownOpen() throws JavaModelException {
- if (testCU != null)
- testCU.discardWorkingCopy();
- }
-
-
- protected ICompilationUnit testCU;
- protected void setUpClose() throws JavaModelException {
- testCU = (ICompilationUnit) jp.findElement(new Path("org/eclipse/jem/tests/beaninfo/Test1Class.java"));
- testCU.becomeWorkingCopy(null, null);
- }
- public void testClose() throws JavaModelException {
- // Test close a working copy.
- testCU.discardWorkingCopy();
- tester.isException();
- tester.isComplete(); // It should of been complete.
- }
- protected void tearDownClose() throws JavaModelException {
- if (testCU != null)
- testCU.discardWorkingCopy();
- }
-
-
- protected void setUpAddMethodInWorkingCopy() throws JavaModelException {
- testCU = (ICompilationUnit) jp.findElement(new Path("org/eclipse/jem/tests/beaninfo/Test1Class.java"));
- testCU.becomeWorkingCopy(null, null);
- }
- public void testAddMethodInWorkcopy() throws JavaModelException {
- testCU.getTypes()[0].createMethod("private void getSomething() {}", null, true, new NullProgressMonitor());
- tester.isException();
- tester.isComplete(); // It should of been complete.
- }
- protected void tearDownAddMethodInWorkingCopy() throws JavaModelException {
- if (testCU != null)
- testCU.discardWorkingCopy();
- }
-
-
- protected void setUpSaveFromWorkingCopy() throws JavaModelException {
- testCU = (ICompilationUnit) jp.findElement(new Path("org/eclipse/jem/tests/beaninfo/Test1Class.java"));
- testCU.becomeWorkingCopy(null, null);
- testCU.getTypes()[0].createMethod("private void getSomething() {}", null, true, new NullProgressMonitor());
- }
- public void testSaveFromWorkingCopy() throws JavaModelException {
- testCU.commitWorkingCopy(true, new NullProgressMonitor());
- tester.isException();
- tester.isComplete(); // It should of been complete.
- }
- protected void tearDownSaveFromWorkingCopy() throws JavaModelException {
- if (testCU != null)
- testCU.discardWorkingCopy();
- }
-
- protected void setUpRevert() throws JavaModelException {
- testCU = (ICompilationUnit) jp.findElement(new Path("org/eclipse/jem/tests/beaninfo/Test1Class.java"));
- testCU.becomeWorkingCopy(null, null);
- testCU.getTypes()[0].createMethod("private void getSomething() {}", null, true, new NullProgressMonitor());
- }
- public void testRevert() throws JavaModelException {
- testCU.restore();
- tester.isException();
- tester.isComplete(); // It should of been complete.
- }
- protected void tearDownRevert() throws JavaModelException {
- if (testCU != null)
- testCU.discardWorkingCopy();
- }
-
- protected void setupDeleteMethodNoWorkingCopy() throws JavaModelException {
- testCU = (ICompilationUnit) jp.findElement(new Path("org/eclipse/jem/tests/beaninfo/Test1Class.java"));
- IMethod m = testCU.getTypes()[0].getMethod("getSomething", new String[0]);
- if (m.exists())
- m.delete(true, new NullProgressMonitor());
- testCU.getTypes()[0].createMethod("private void getSomething() {}", null, true, new NullProgressMonitor());
- }
- public void testDeleteMethodNoWorkingCopy() throws CoreException {
- JavaCore.run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- // Actually there will be a working copy. This is to simulate what delete method from member list
- // with no open editor. This is done by batching everything up, but there is a working copy created.
- // But it changes the file directly then. (Confusing, no? But that is the way it does it in JDT).
- testCU.becomeWorkingCopy(null, null);
- IMethod method = testCU.getTypes()[0].getMethod("getSomething", new String[] {});
- IBuffer cuBuffer = testCU.getBuffer();
- ISourceRange sr = method.getSourceRange();
- cuBuffer.replace(sr.getOffset(), sr.getLength(),"");
- cuBuffer.save(monitor, true);
- testCU.discardWorkingCopy();
- }
- }, new NullProgressMonitor());
- tester.isException();
- tester.isComplete(); // It should of been complete.
- }
- protected void tearDownDeleteMethodNoWorkingCopy() throws JavaModelException {
- if (testCU != null)
- testCU.discardWorkingCopy();
- }
-
- protected void setupAddClass() {
-
- }
- public void testAddClass() throws JavaModelException {
- IPackageFragment pkg = (IPackageFragment) jp.findElement(new Path("org/eclipse/jem/tests/beaninfo"));
- testCU = pkg.createCompilationUnit("NewClass.java", "public class NewClass {}", true, new NullProgressMonitor());
- tester.isException();
- tester.isComplete(); // It should of been complete.
- }
- protected void tearDownAddClass() throws JavaModelException {
- if (testCU != null) {
- testCU.delete(true, new NullProgressMonitor());
- }
- }
-
- protected void setupDeleteClassWithWorkingCopy() throws JavaModelException {
- IPackageFragment pkg = (IPackageFragment) jp.findElement(new Path("org/eclipse/jem/tests/beaninfo"));
- testCU = pkg.createCompilationUnit("NewClass.java", "public class NewClass {}", true, new NullProgressMonitor());
- testCU.becomeWorkingCopy(null, null);
- }
- public void testDeleteClassWithWorkingCopy() throws CoreException {
- ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
-
- public void run(IProgressMonitor monitor) throws CoreException {
- // Need to run this way to simulate what happens for real.
- testCU.delete(true, new NullProgressMonitor());
- ResourcesPlugin.getWorkspace().checkpoint(true);
- testCU.discardWorkingCopy();
- }
- }, new NullProgressMonitor());
- tester.isException();
- tester.isComplete(); // It should of been complete.
- testCU = null;
- }
- protected void tearDownDeleteClassWithWorkingCopy() throws JavaModelException {
- if (testCU != null && testCU.exists()) {
- testCU.delete(true, new NullProgressMonitor());
- }
- }
-
- protected void setUpDeleteClassNoWorkingCopy() throws JavaModelException {
- IPackageFragment pkg = (IPackageFragment) jp.findElement(new Path("org/eclipse/jem/tests/beaninfo"));
- testCU = pkg.createCompilationUnit("NewClass.java", "public class NewClass {}", true, new NullProgressMonitor());
- }
- public void testDeleteClassNoWorkingCopy() throws JavaModelException {
- testCU.delete(true, new NullProgressMonitor());
- tester.isException();
- tester.isComplete(); // It should of been complete.
- testCU = null;
- }
- protected void tearDownDeleteClassNoWorkingCopy() throws JavaModelException {
- if (testCU != null && testCU.exists()) {
- testCU.delete(true, new NullProgressMonitor());
- }
- }
-
- protected void setUpAddPackage() throws JavaModelException {
- IPackageFragment pkg = (IPackageFragment) jp.findElement(new Path("test"));
- if (pkg != null)
- pkg.delete(true, new NullProgressMonitor());
- }
- public void testAddPackage() throws JavaModelException {
- IPackageFragmentRoot[] roots = jp.getPackageFragmentRoots();
- for (int i = 0; i < roots.length; i++) {
- if (roots[i].getKind() == IPackageFragmentRoot.K_SOURCE) {
- roots[i].createPackageFragment("test", true, new NullProgressMonitor());
- break;
- }
- }
- tester.isException();
- tester.isComplete(); // It should of been complete.
- }
- protected void tearDownAddPackage() throws JavaModelException {
- IPackageFragment pkg = (IPackageFragment) jp.findElement(new Path("test"));
- if (pkg != null)
- pkg.delete(true, new NullProgressMonitor());
- }
-
- protected IPackageFragment testPkg;
- protected void setUpDeletePackage() throws JavaModelException {
- IPackageFragmentRoot[] roots = jp.getPackageFragmentRoots();
- for (int i = 0; i < roots.length; i++) {
- if (roots[i].getKind() == IPackageFragmentRoot.K_SOURCE) {
- testPkg = roots[i].createPackageFragment("test", true, new NullProgressMonitor());
- break;
- }
- }
- }
- public void testDeletePackage() throws JavaModelException {
- testPkg.delete(true, new NullProgressMonitor());
- tester.isException();
- tester.isComplete(); // It should of been complete.
- testPkg = null;
- }
- protected void tearDownDeletePackage() throws JavaModelException {
- if (testPkg != null && testPkg.exists())
- testPkg.delete(true, new NullProgressMonitor());
- }
-
-}
diff --git a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/AbstractTestProxy.java b/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/AbstractTestProxy.java
deleted file mode 100644
index 2241ade0..00000000
--- a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/AbstractTestProxy.java
+++ /dev/null
@@ -1,110 +0,0 @@
-package org.eclipse.jem.tests.proxy;
-/*******************************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * $RCSfile: AbstractTestProxy.java,v $
- * $Revision: 1.3 $ $Date: 2005/02/15 23:00:16 $
- */
-import java.util.Enumeration;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jem.internal.proxy.core.*;
-import org.eclipse.jem.internal.proxy.core.IStandardBeanTypeProxyFactory;
-import org.eclipse.jem.internal.proxy.core.ProxyFactoryRegistry;
-
-import junit.framework.*;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-/**
- * @author richkulp
- *
- * Standard type of Proxy Tests.
- */
-public abstract class AbstractTestProxy extends TestCase {
-
- /**
- * @author richkulp
- *
- * Interface for registry handler. Actual implementations will place their
- * handler in the field REGISTRY_HANDLER to that the proxy tests can access it.
- */
- public interface RegistryHandler {
-
- /**
- * @return is the handler valid and setup correctly.
- */
- public boolean isValid();
-
- /**
- * Return the current registry, creating it if necessary.
- * @return The registry.
- */
- public ProxyFactoryRegistry getRegistry() throws CoreException;
-
- /**
- * Destroy the current registry.
- */
- public void destroyRegistry();
- }
-
- /**
- * Initialize the registry handler for all AbstractTestProxy tests in the
- * given suite.
- * @param suite
- */
- public static void initRegistryHandler(TestSuite suite, RegistryHandler registryHandler) {
- Enumeration tests = suite.tests();
- while (tests.hasMoreElements()) {
- Test test = (Test) tests.nextElement();
- if (test instanceof AbstractTestProxy)
- ((AbstractTestProxy) test).setRegistryHandler(registryHandler);
- else if (test instanceof TestSuite)
- initRegistryHandler((TestSuite) test, registryHandler);
- }
- }
-
- public AbstractTestProxy() {
- super();
- }
-
- public AbstractTestProxy(String name) {
- super(name);
- }
-
- private RegistryHandler registryHandler;
-
- protected ProxyFactoryRegistry registry;
- protected IStandardBeanTypeProxyFactory proxyTypeFactory;
- protected IStandardBeanProxyFactory proxyFactory;
-
- /* (non-Javadoc)
- * @see junit.framework.TestCase#setUp()
- */
- protected void setUp() throws Exception {
- super.setUp();
- assertNotNull(getRegistryHandler());
- assertTrue("Suite not setup correctly.", getRegistryHandler().isValid());
- registry = getRegistryHandler().getRegistry();
- assertNotNull(registry);
- proxyFactory = registry.getBeanProxyFactory();
- proxyTypeFactory = registry.getBeanTypeProxyFactory();
- }
-
- public void setRegistryHandler(RegistryHandler registryHandler) {
- this.registryHandler = registryHandler;
- }
-
- public RegistryHandler getRegistryHandler() {
- return registryHandler;
- }
-
-}
diff --git a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/ExpressionTest.java b/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/ExpressionTest.java
deleted file mode 100644
index 64b2829e..00000000
--- a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/ExpressionTest.java
+++ /dev/null
@@ -1,1158 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * $RCSfile: ExpressionTest.java,v $
- * $Revision: 1.4 $ $Date: 2005/02/15 23:00:16 $
- */
-package org.eclipse.jem.tests.proxy;
-
-import org.eclipse.jem.internal.proxy.core.*;
-import org.eclipse.jem.internal.proxy.initParser.tree.IExpressionConstants;
-import org.eclipse.jem.internal.proxy.initParser.tree.IExpressionConstants.NoExpressionValueException;
-
-/**
- *
- * @since 1.0.0
- */
-public class ExpressionTest extends AbstractTestProxy {
-
- /**
- *
- *
- * @since 1.0.0
- */
- public ExpressionTest() {
- super();
- }
-
- /**
- * @param name
- *
- * @since 1.0.0
- */
- public ExpressionTest(String name) {
- super(name);
- }
-
- public void testCastStringType() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createCastExpression(IExpressionConstants.ROOTEXPRESSION, "short");
- exp.createPrimitiveLiteral(IExpressionConstants.CAST_EXPRESSION, 10l);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("short", result.getTypeProxy().getTypeName());
- assertEquals((short) 10, ((INumberBeanProxy) result).shortValue());
- }
-
- public void testCastProxyType() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createCastExpression(IExpressionConstants.ROOTEXPRESSION, proxyTypeFactory.getBeanTypeProxy("short"));
- exp.createPrimitiveLiteral(IExpressionConstants.CAST_EXPRESSION, 'a');
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("short", result.getTypeProxy().getTypeName());
- assertEquals((short) 'a', ((INumberBeanProxy) result).shortValue());
- }
-
- public void testCastError() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createCastExpression(IExpressionConstants.ROOTEXPRESSION, proxyTypeFactory.getBeanTypeProxy("short"));
- try {
- exp.createProxyExpression(IExpressionConstants.CAST_EXPRESSION, proxyFactory.createBeanProxyWith(Boolean.TRUE));
- exp.getExpressionValue();
- fail("Should of thrown ClassCastException");
- } catch (ThrowableProxy e) {
- if (!e.getTypeProxy().getFormalTypeName().equals("java.lang.ClassCastException"))
- throw e; // Some other exception, rethrow it.
- }
- }
-
- public void testCastFailed() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createCastExpression(IExpressionConstants.ROOTEXPRESSION, proxyTypeFactory.getBeanTypeProxy("short"));
- try {
- exp.getExpressionValue();
- fail("Should of gotton IllegalStateException");
- } catch (IllegalStateException e) {
- System.out.println(e.getLocalizedMessage());
- }
- }
-
- public void testInstanceofStringType() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createInstanceofExpression(IExpressionConstants.ROOTEXPRESSION, "java.lang.String");
- exp.createStringLiteral(IExpressionConstants.INSTANCEOF_VALUE, "asdf");
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("boolean", result.getTypeProxy().getTypeName());
- assertEquals(true, ((IBooleanBeanProxy) result).booleanValue());
- }
-
- public void testInstanceofProxyType() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createInstanceofExpression(IExpressionConstants.ROOTEXPRESSION, proxyTypeFactory.getBeanTypeProxy("java.lang.String"));
- exp.createStringLiteral(IExpressionConstants.INSTANCEOF_VALUE, "asdf");
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("boolean", result.getTypeProxy().getTypeName());
- assertEquals(true, ((IBooleanBeanProxy) result).booleanValue());
-
- }
-
- public void testInstanceofFailed() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createInstanceofExpression(IExpressionConstants.ROOTEXPRESSION, proxyTypeFactory.getBeanTypeProxy("java.lang.String"));
- try {
- exp.getExpressionValue();
- fail("Should of gotton IllegalStateException");
- } catch (IllegalStateException e) {
- System.out.println(e.getLocalizedMessage());
- }
- }
-
- public void testTypeLiteral() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createTypeLiteral(IExpressionConstants.ROOTEXPRESSION, "java.lang.String");
- IBeanProxy result = exp.getExpressionValue();
- assertTrue("Not a bean type proxy.", result instanceof IBeanTypeProxy);
- IBeanTypeProxy type = (IBeanTypeProxy) result;
- assertTrue("Not valid.", type.isValid());
- assertEquals("java.lang.String", type.getFormalTypeName());
- }
-
- public void testTypeFails() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- try {
- exp.createTypeLiteral(IExpressionConstants.ROOTEXPRESSION, "java.lang.Stng");
- exp.getExpressionValue();
- fail("Should not of gotton a result.");
- } catch (ThrowableProxy e) {
- System.out.println(e.getProxyLocalizedMessage());
- }
- }
-
- public void testNesting() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createInstanceofExpression(IExpressionConstants.ROOTEXPRESSION, "short");
- exp.createCastExpression(IExpressionConstants.INSTANCEOF_VALUE, "short");
- exp.createPrimitiveLiteral(IExpressionConstants.CAST_EXPRESSION, (short) 10);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("boolean", result.getTypeProxy().getTypeName());
- assertEquals(true, ((IBooleanBeanProxy) result).booleanValue());
- }
-
- public void testPrefixPlus() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createPrefixExpression(IExpressionConstants.ROOTEXPRESSION, IExpressionConstants.PRE_PLUS);
- exp.createPrimitiveLiteral(IExpressionConstants.PREFIX_OPERAND, 10);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("int", result.getTypeProxy().getTypeName());
- assertEquals(10, ((INumberBeanProxy) result).intValue());
-
- }
-
- public void testPrefixMinus() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createPrefixExpression(IExpressionConstants.ROOTEXPRESSION, IExpressionConstants.PRE_MINUS);
- exp.createPrimitiveLiteral(IExpressionConstants.PREFIX_OPERAND, 10);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("int", result.getTypeProxy().getTypeName());
- assertEquals(-10, ((INumberBeanProxy) result).intValue());
-
- }
-
- public void testPrefixMinusChar() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createPrefixExpression(IExpressionConstants.ROOTEXPRESSION, IExpressionConstants.PRE_MINUS);
- exp.createPrimitiveLiteral(IExpressionConstants.PREFIX_OPERAND, 'a');
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("int", result.getTypeProxy().getTypeName());
- assertEquals(-'a', ((INumberBeanProxy) result).intValue());
-
- }
-
- public void testPrefixComplement() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createPrefixExpression(IExpressionConstants.ROOTEXPRESSION, IExpressionConstants.PRE_COMPLEMENT);
- exp.createPrimitiveLiteral(IExpressionConstants.PREFIX_OPERAND, (short) 10);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("int", result.getTypeProxy().getTypeName());
- assertEquals(~10, ((INumberBeanProxy) result).intValue());
-
- }
-
- public void testPrefixNot() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createPrefixExpression(IExpressionConstants.ROOTEXPRESSION, IExpressionConstants.PRE_NOT);
- exp.createPrimitiveLiteral(IExpressionConstants.PREFIX_OPERAND, true);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("boolean", result.getTypeProxy().getTypeName());
- assertEquals(false, ((IBooleanBeanProxy) result).booleanValue());
-
- }
-
- public void testPrefixFail() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createPrefixExpression(IExpressionConstants.ROOTEXPRESSION, IExpressionConstants.PRE_NOT);
- try {
- exp.createPrimitiveLiteral(IExpressionConstants.PREFIX_OPERAND, 10);
- exp.getExpressionValue();
- fail("Should of failed.");
- } catch (ThrowableProxy e) {
- System.out.println(e.getProxyLocalizedMessage());
- }
-
- }
-
- public void testTimes() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createInfixExpression(IExpressionConstants.ROOTEXPRESSION, IExpressionConstants.IN_TIMES, 0);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_LEFT, 3);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_RIGHT, 4);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("int", result.getTypeProxy().getTypeName());
- assertEquals(3*4, ((INumberBeanProxy) result).intValue());
-
- }
-
- public void testTimesExtended() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createInfixExpression(IExpressionConstants.ROOTEXPRESSION, IExpressionConstants.IN_TIMES, 1);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_LEFT, 3);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_RIGHT, 4);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_EXTENDED, 5d);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("double", result.getTypeProxy().getTypeName());
- assertEquals((3*4*5d), ((INumberBeanProxy) result).doubleValue(), 0);
-
- }
-
- public void testTimesExtendedNested() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createInfixExpression(IExpressionConstants.ROOTEXPRESSION, IExpressionConstants.IN_TIMES, 1);
- exp.createInfixExpression(IExpressionConstants.INFIX_LEFT, IExpressionConstants.IN_MINUS, 0);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_LEFT, 10);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_RIGHT, 5);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_RIGHT, 4);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_EXTENDED, 5d);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("double", result.getTypeProxy().getTypeName());
- assertEquals(((10-5)*4*5d), ((INumberBeanProxy) result).doubleValue(), 0);
-
- }
-
- public void testDivide() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createInfixExpression(IExpressionConstants.ROOTEXPRESSION, IExpressionConstants.IN_DIVIDE, 0);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_LEFT, 4);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_RIGHT, 2);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("int", result.getTypeProxy().getTypeName());
- assertEquals(4/2, ((INumberBeanProxy) result).intValue());
-
- }
-
- public void testDivideExtended() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createInfixExpression(IExpressionConstants.ROOTEXPRESSION, IExpressionConstants.IN_DIVIDE, 1);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_LEFT, 12);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_RIGHT, 3);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_EXTENDED, 2d);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("double", result.getTypeProxy().getTypeName());
- assertEquals((12/3/2d), ((INumberBeanProxy) result).doubleValue(), 0);
-
- }
-
- public void testRemainder() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createInfixExpression(IExpressionConstants.ROOTEXPRESSION, IExpressionConstants.IN_REMAINDER, 0);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_LEFT, 4);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_RIGHT, 3);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("int", result.getTypeProxy().getTypeName());
- assertEquals(4%3, ((INumberBeanProxy) result).intValue());
-
- }
-
- public void testRemainderExtended() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createInfixExpression(IExpressionConstants.ROOTEXPRESSION, IExpressionConstants.IN_REMAINDER, 1);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_LEFT, 12);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_RIGHT, 9);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_EXTENDED, 2d);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("double", result.getTypeProxy().getTypeName());
- assertEquals((12%9%2d), ((INumberBeanProxy) result).doubleValue(), 0);
-
- }
-
- public void testMinus() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createInfixExpression(IExpressionConstants.ROOTEXPRESSION, IExpressionConstants.IN_MINUS, 0);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_LEFT, 4);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_RIGHT, 3);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("int", result.getTypeProxy().getTypeName());
- assertEquals(4-3, ((INumberBeanProxy) result).intValue());
-
- }
-
- public void testMinusExtended() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createInfixExpression(IExpressionConstants.ROOTEXPRESSION, IExpressionConstants.IN_MINUS, 1);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_LEFT, 12);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_RIGHT, 9);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_EXTENDED, 2d);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("double", result.getTypeProxy().getTypeName());
- assertEquals((12-9-2d), ((INumberBeanProxy) result).doubleValue(), 0);
-
- }
-
- public void testLeftShift() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createInfixExpression(IExpressionConstants.ROOTEXPRESSION, IExpressionConstants.IN_LEFT_SHIFT, 0);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_LEFT, 4);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_RIGHT, 3);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("int", result.getTypeProxy().getTypeName());
- assertEquals(4<<3, ((INumberBeanProxy) result).intValue());
-
- }
-
- public void testLeftShiftExtended() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createInfixExpression(IExpressionConstants.ROOTEXPRESSION, IExpressionConstants.IN_LEFT_SHIFT, 1);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_LEFT, 12);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_RIGHT, 9);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_EXTENDED, 2);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("int", result.getTypeProxy().getTypeName());
- assertEquals((12<<9<<2), ((INumberBeanProxy) result).intValue(), 0);
- }
-
- public void testRightShiftSigned() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createInfixExpression(IExpressionConstants.ROOTEXPRESSION, IExpressionConstants.IN_RIGHT_SHIFT_SIGNED, 0);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_LEFT, -10000000);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_RIGHT, 3);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("int", result.getTypeProxy().getTypeName());
- assertEquals(-10000000>>3, ((INumberBeanProxy) result).intValue());
- }
-
- public void testRightShiftSignedExtended() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createInfixExpression(IExpressionConstants.ROOTEXPRESSION, IExpressionConstants.IN_RIGHT_SHIFT_SIGNED, 1);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_LEFT, -10000000);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_RIGHT, 4);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_EXTENDED, 2);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("int", result.getTypeProxy().getTypeName());
- assertEquals((-10000000>>4>>2), ((INumberBeanProxy) result).intValue(), 0);
- }
- public void testRightShiftUnSigned() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createInfixExpression(IExpressionConstants.ROOTEXPRESSION, IExpressionConstants.IN_RIGHT_SHIFT_UNSIGNED, 0);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_LEFT, -10000000);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_RIGHT, 3);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("int", result.getTypeProxy().getTypeName());
- assertEquals(-10000000>>>3, ((INumberBeanProxy) result).intValue());
- }
-
- public void testRightShiftUnSignedExtended() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createInfixExpression(IExpressionConstants.ROOTEXPRESSION, IExpressionConstants.IN_RIGHT_SHIFT_UNSIGNED, 1);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_LEFT, -10000000);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_RIGHT, 4);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_EXTENDED, 2);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("int", result.getTypeProxy().getTypeName());
- assertEquals((-10000000>>>4>>>2), ((INumberBeanProxy) result).intValue(), 0);
- }
-
- public void testLess() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createInfixExpression(IExpressionConstants.ROOTEXPRESSION, IExpressionConstants.IN_LESS, 0);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_LEFT, -10000000);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_RIGHT, 3);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("boolean", result.getTypeProxy().getTypeName());
- assertEquals(-10000000<3, ((IBooleanBeanProxy) result).booleanValue());
- }
-
- public void testLessEquals() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createInfixExpression(IExpressionConstants.ROOTEXPRESSION, IExpressionConstants.IN_LESS_EQUALS, 0);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_LEFT, 3);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_RIGHT, 3);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("boolean", result.getTypeProxy().getTypeName());
- assertEquals(3<=3, ((IBooleanBeanProxy) result).booleanValue());
- }
-
- public void testGreater() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createInfixExpression(IExpressionConstants.ROOTEXPRESSION, IExpressionConstants.IN_GREATER, 0);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_LEFT, -10000000);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_RIGHT, 3);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("boolean", result.getTypeProxy().getTypeName());
- assertEquals(-10000000>3, ((IBooleanBeanProxy) result).booleanValue());
- }
-
- public void testGreaterEquals() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createInfixExpression(IExpressionConstants.ROOTEXPRESSION, IExpressionConstants.IN_GREATER_EQUALS, 0);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_LEFT, 2);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_RIGHT, 3);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("boolean", result.getTypeProxy().getTypeName());
- assertEquals(2>=3, ((IBooleanBeanProxy) result).booleanValue());
- }
-
- public void testEqualsPrimitives() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createInfixExpression(IExpressionConstants.ROOTEXPRESSION, IExpressionConstants.IN_EQUALS, 0);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_LEFT, 3d);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_RIGHT, 3);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("boolean", result.getTypeProxy().getTypeName());
- assertEquals(3d==3, ((IBooleanBeanProxy) result).booleanValue());
- }
-
- public void testEqualsObjects() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createInfixExpression(IExpressionConstants.ROOTEXPRESSION, IExpressionConstants.IN_EQUALS, 0);
- exp.createTypeLiteral(IExpressionConstants.INFIX_LEFT, "java.lang.String");
- exp.createTypeLiteral(IExpressionConstants.INFIX_RIGHT, "java.lang.String");
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("boolean", result.getTypeProxy().getTypeName());
- assertEquals(String.class == String.class, ((IBooleanBeanProxy) result).booleanValue());
- }
-
- public void testNotEqualsPrimitives() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createInfixExpression(IExpressionConstants.ROOTEXPRESSION, IExpressionConstants.IN_NOT_EQUALS, 0);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_LEFT, 3d);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_RIGHT, 3);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("boolean", result.getTypeProxy().getTypeName());
- assertEquals(3d!=3, ((IBooleanBeanProxy) result).booleanValue());
- }
-
- public void testNotEqualsObjects() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createInfixExpression(IExpressionConstants.ROOTEXPRESSION, IExpressionConstants.IN_NOT_EQUALS, 0);
- exp.createTypeLiteral(IExpressionConstants.INFIX_LEFT, "java.lang.String");
- exp.createTypeLiteral(IExpressionConstants.INFIX_RIGHT, "java.lang.String");
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("boolean", result.getTypeProxy().getTypeName());
- assertEquals(String.class != String.class, ((IBooleanBeanProxy) result).booleanValue());
- }
-
- public void testXOR() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createInfixExpression(IExpressionConstants.ROOTEXPRESSION, IExpressionConstants.IN_XOR, 0);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_LEFT, 5);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_RIGHT, 3);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("int", result.getTypeProxy().getTypeName());
- assertEquals(5^3, ((INumberBeanProxy) result).intValue());
-
- }
-
- public void testXORExtended() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createInfixExpression(IExpressionConstants.ROOTEXPRESSION, IExpressionConstants.IN_XOR, 1);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_LEFT, 23);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_RIGHT, 9);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_EXTENDED, 2);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("int", result.getTypeProxy().getTypeName());
- assertEquals((23^9^2), ((INumberBeanProxy) result).intValue(), 0);
-
- }
-
- public void testAnd() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createInfixExpression(IExpressionConstants.ROOTEXPRESSION, IExpressionConstants.IN_AND, 0);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_LEFT, 5);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_RIGHT, 3);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("int", result.getTypeProxy().getTypeName());
- assertEquals(5&3, ((INumberBeanProxy) result).intValue());
- }
-
- public void testAndExtended() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createInfixExpression(IExpressionConstants.ROOTEXPRESSION, IExpressionConstants.IN_AND, 1);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_LEFT, 13);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_RIGHT, 15);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_EXTENDED, 1);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("int", result.getTypeProxy().getTypeName());
- assertEquals((13&5&1), ((INumberBeanProxy) result).intValue(), 0);
- }
-
- public void testOr() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createInfixExpression(IExpressionConstants.ROOTEXPRESSION, IExpressionConstants.IN_OR, 0);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_LEFT, 5);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_RIGHT, 2);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("int", result.getTypeProxy().getTypeName());
- assertEquals(5|2, ((INumberBeanProxy) result).intValue());
- }
-
- public void testOrExtended() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createInfixExpression(IExpressionConstants.ROOTEXPRESSION, IExpressionConstants.IN_OR, 1);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_LEFT, 13);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_RIGHT, 6);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_EXTENDED, 2);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("int", result.getTypeProxy().getTypeName());
- assertEquals((13|6|2), ((INumberBeanProxy) result).intValue(), 0);
- }
-
- public void testPlus() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createInfixExpression(IExpressionConstants.ROOTEXPRESSION, IExpressionConstants.IN_PLUS, 0);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_LEFT, 5);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_RIGHT, 2);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("int", result.getTypeProxy().getTypeName());
- assertEquals(5+2, ((INumberBeanProxy) result).intValue());
- }
-
- public void testPlusExtended() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createInfixExpression(IExpressionConstants.ROOTEXPRESSION, IExpressionConstants.IN_PLUS, 1);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_LEFT, 5);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_RIGHT, 2);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_EXTENDED, 2l);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("long", result.getTypeProxy().getTypeName());
- assertEquals(5+2+2l, ((INumberBeanProxy) result).intValue());
- }
-
- public void testPlusStringLeft() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createInfixExpression(IExpressionConstants.ROOTEXPRESSION, IExpressionConstants.IN_PLUS, 0);
- exp.createProxyExpression(IExpressionConstants.INFIX_LEFT, proxyFactory.createBeanProxyWith("abc"));
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_RIGHT, 2);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("java.lang.String", result.getTypeProxy().getTypeName());
- assertEquals("abc"+2, ((IStringBeanProxy) result).stringValue());
- }
-
- public void testPlusStringRight() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createInfixExpression(IExpressionConstants.ROOTEXPRESSION, IExpressionConstants.IN_PLUS, 0);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_LEFT, 2);
- exp.createProxyExpression(IExpressionConstants.INFIX_RIGHT, proxyFactory.createBeanProxyWith("abc"));
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("java.lang.String", result.getTypeProxy().getTypeName());
- assertEquals(2+"abc", ((IStringBeanProxy) result).stringValue());
- }
-
- public void testPlusStringLeftNull() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createInfixExpression(IExpressionConstants.ROOTEXPRESSION, IExpressionConstants.IN_PLUS, 0);
- exp.createProxyExpression(IExpressionConstants.INFIX_LEFT, proxyFactory.createBeanProxyWith("abc"));
- exp.createNull(IExpressionConstants.INFIX_RIGHT);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("java.lang.String", result.getTypeProxy().getTypeName());
- assertEquals("abc"+null, ((IStringBeanProxy) result).stringValue());
- }
-
- public void testPlusStringRightNull() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createInfixExpression(IExpressionConstants.ROOTEXPRESSION, IExpressionConstants.IN_PLUS, 0);
- exp.createNull(IExpressionConstants.INFIX_LEFT);
- exp.createProxyExpression(IExpressionConstants.INFIX_RIGHT, proxyFactory.createBeanProxyWith("abc"));
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("java.lang.String", result.getTypeProxy().getTypeName());
- assertEquals(null+"abc", ((IStringBeanProxy) result).stringValue());
- }
-
- public void testPlusStringLeftChar() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createInfixExpression(IExpressionConstants.ROOTEXPRESSION, IExpressionConstants.IN_PLUS, 0);
- exp.createProxyExpression(IExpressionConstants.INFIX_LEFT, proxyFactory.createBeanProxyWith("abc"));
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_RIGHT, 'a');
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("java.lang.String", result.getTypeProxy().getTypeName());
- assertEquals("abc"+'a', ((IStringBeanProxy) result).stringValue());
- }
-
- public void testPlusStringRightChar() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createInfixExpression(IExpressionConstants.ROOTEXPRESSION, IExpressionConstants.IN_PLUS, 0);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_LEFT, 'a');
- exp.createProxyExpression(IExpressionConstants.INFIX_RIGHT, proxyFactory.createBeanProxyWith("abc"));
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("java.lang.String", result.getTypeProxy().getTypeName());
- assertEquals('a'+"abc", ((IStringBeanProxy) result).stringValue());
- }
-
- public void testConditionalAnd() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createInfixExpression(IExpressionConstants.ROOTEXPRESSION, IExpressionConstants.IN_CONDITIONAL_AND, 0);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_LEFT, true);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_RIGHT, true);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("boolean", result.getTypeProxy().getTypeName());
- assertEquals(true && true, ((IBooleanBeanProxy) result).booleanValue());
- }
-
- public void testConditionalAndExtended() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createInfixExpression(IExpressionConstants.ROOTEXPRESSION, IExpressionConstants.IN_CONDITIONAL_AND, 1);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_LEFT, true);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_RIGHT, true);
- exp.createInfixExpression(IExpressionConstants.INFIX_EXTENDED, IExpressionConstants.IN_EQUALS, 0);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_LEFT, 3);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_RIGHT, 3);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("boolean", result.getTypeProxy().getTypeName());
- assertEquals(true && true && (3 == 3), ((IBooleanBeanProxy) result).booleanValue());
- }
-
- public void testConditionalAndFalseLast() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createInfixExpression(IExpressionConstants.ROOTEXPRESSION, IExpressionConstants.IN_CONDITIONAL_AND, 0);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_LEFT, true);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_RIGHT, false);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("boolean", result.getTypeProxy().getTypeName());
- assertEquals(true && false, ((IBooleanBeanProxy) result).booleanValue());
- }
-
- public void testConditionalAndFalseFirst() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createInfixExpression(IExpressionConstants.ROOTEXPRESSION, IExpressionConstants.IN_CONDITIONAL_AND, 0);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_LEFT, false);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_RIGHT, true);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("boolean", result.getTypeProxy().getTypeName());
- assertEquals(false && true, ((IBooleanBeanProxy) result).booleanValue());
- }
-
- public void testConditionalAndExtendedAndFalseFirst() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createInfixExpression(IExpressionConstants.ROOTEXPRESSION, IExpressionConstants.IN_CONDITIONAL_AND, 1);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_LEFT, false);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_RIGHT, true);
- exp.createInfixExpression(IExpressionConstants.INFIX_EXTENDED, IExpressionConstants.IN_EQUALS, 0);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_LEFT, 3);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_RIGHT, 3);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("boolean", result.getTypeProxy().getTypeName());
- assertEquals(false && true && (3 == 3), ((IBooleanBeanProxy) result).booleanValue());
- }
-
- public void testConditionalOr() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createInfixExpression(IExpressionConstants.ROOTEXPRESSION, IExpressionConstants.IN_CONDITIONAL_OR, 0);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_LEFT, false);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_RIGHT, true);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("boolean", result.getTypeProxy().getTypeName());
- assertEquals(false || true, ((IBooleanBeanProxy) result).booleanValue());
- }
-
- public void testConditionalOrExtended() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createInfixExpression(IExpressionConstants.ROOTEXPRESSION, IExpressionConstants.IN_CONDITIONAL_OR, 1);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_LEFT, false);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_RIGHT, false);
- exp.createInfixExpression(IExpressionConstants.INFIX_EXTENDED, IExpressionConstants.IN_EQUALS, 0);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_LEFT, 3);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_RIGHT, 3);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("boolean", result.getTypeProxy().getTypeName());
- assertEquals(false || false || (3 == 3), ((IBooleanBeanProxy) result).booleanValue());
- }
-
- public void testConditionalOrTrueFirst() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createInfixExpression(IExpressionConstants.ROOTEXPRESSION, IExpressionConstants.IN_CONDITIONAL_OR, 0);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_LEFT, true);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_RIGHT, false);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("boolean", result.getTypeProxy().getTypeName());
- assertEquals(true || false, ((IBooleanBeanProxy) result).booleanValue());
- }
-
- public void testConditionalOrExtendedAndTrueMiddle() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createInfixExpression(IExpressionConstants.ROOTEXPRESSION, IExpressionConstants.IN_CONDITIONAL_OR, 1);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_LEFT, false);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_RIGHT, true);
- exp.createInfixExpression(IExpressionConstants.INFIX_EXTENDED, IExpressionConstants.IN_EQUALS, 0);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_LEFT, 3);
- exp.createPrimitiveLiteral(IExpressionConstants.INFIX_RIGHT, 3);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("boolean", result.getTypeProxy().getTypeName());
- assertEquals(false || true || (3 == 3), ((IBooleanBeanProxy) result).booleanValue());
- }
-
- public void testArrayAccess() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IArrayBeanProxy array = (IArrayBeanProxy) proxyFactory.createBeanProxyWith(proxyTypeFactory.getBeanTypeProxy("short"), 1);
- array.set(proxyFactory.createBeanProxyWith((short) 3), 0);
-
- IExpression exp = proxyFactory.createExpression();
- exp.createArrayAccess(IExpressionConstants.ROOTEXPRESSION, 1);
- exp.createProxyExpression(IExpressionConstants.ARRAYACCESS_ARRAY, array);
- exp.createPrimitiveLiteral(IExpressionConstants.ARRAYACCESS_INDEX, 0);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("short", result.getTypeProxy().getTypeName());
- assertEquals(((INumberBeanProxy) result).shortValue(), (short) 3);
- }
-
- public void testMultiArrayAccess() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IArrayBeanProxy array = (IArrayBeanProxy) proxyFactory.createBeanProxyWith(proxyTypeFactory.getBeanTypeProxy("short"), new int[] {2,1});
- array.set(proxyFactory.createBeanProxyWith((short) 3), new int[]{1,0});
-
- IExpression exp = proxyFactory.createExpression();
- exp.createArrayAccess(IExpressionConstants.ROOTEXPRESSION, 1);
- exp.createProxyExpression(IExpressionConstants.ARRAYACCESS_ARRAY, array);
- exp.createPrimitiveLiteral(IExpressionConstants.ARRAYACCESS_INDEX, 1);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("short[]", result.getTypeProxy().getFormalTypeName());
- }
-
- public void testMultiArrayAccess1() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IArrayBeanProxy array = (IArrayBeanProxy) proxyFactory.createBeanProxyWith(proxyTypeFactory.getBeanTypeProxy("short"), new int[] {2,1});
- array.set(proxyFactory.createBeanProxyWith((short) 3), new int[]{1,0});
-
- IExpression exp = proxyFactory.createExpression();
- exp.createArrayAccess(IExpressionConstants.ROOTEXPRESSION, 2);
- exp.createProxyExpression(IExpressionConstants.ARRAYACCESS_ARRAY, array);
- exp.createPrimitiveLiteral(IExpressionConstants.ARRAYACCESS_INDEX, 1);
- exp.createPrimitiveLiteral(IExpressionConstants.ARRAYACCESS_INDEX, 0);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("short", result.getTypeProxy().getFormalTypeName());
- assertEquals((short) 3, ((INumberBeanProxy) result).shortValue());
- }
-
- public void testArrayCreation() throws IllegalStateException, IllegalArgumentException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createArrayCreation(IExpressionConstants.ROOTEXPRESSION, "int[]", 1);
- exp.createPrimitiveLiteral(IExpressionConstants.ARRAYCREATION_DIMENSION, 2);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("int[]", result.getTypeProxy().getFormalTypeName());
- assertEquals(2, ((IArrayBeanProxy) result).getLength());
- }
-
- public void testMultiArrayCreation() throws IllegalStateException, IllegalArgumentException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createArrayCreation(IExpressionConstants.ROOTEXPRESSION, "int[][]", 2);
- exp.createPrimitiveLiteral(IExpressionConstants.ARRAYCREATION_DIMENSION, 2);
- exp.createPrimitiveLiteral(IExpressionConstants.ARRAYCREATION_DIMENSION, 4);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("int[][]", result.getTypeProxy().getFormalTypeName());
- assertEquals(2, ((IArrayBeanProxy) result).getLength());
- assertEquals(4, ((IArrayBeanProxy)((IArrayBeanProxy) result).get(0)).getLength());
- }
-
- public void testMultiPartialArrayCreation() throws IllegalStateException, IllegalArgumentException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createArrayCreation(IExpressionConstants.ROOTEXPRESSION, "int[][][]", 2);
- exp.createPrimitiveLiteral(IExpressionConstants.ARRAYCREATION_DIMENSION, 2);
- exp.createPrimitiveLiteral(IExpressionConstants.ARRAYCREATION_DIMENSION, 4);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("int[][][]", result.getTypeProxy().getFormalTypeName());
- assertEquals(2, ((IArrayBeanProxy) result).getLength());
- assertEquals(4, ((IArrayBeanProxy)((IArrayBeanProxy) result).get(0)).getLength());
- assertNull(((IArrayBeanProxy)((IArrayBeanProxy) result).get(0)).get(0));
- }
-
- public void testArrayInitializerEmpty() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createArrayCreation(IExpressionConstants.ROOTEXPRESSION, "int[]", 0);
- exp.createArrayInitializer(0);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("int[]", result.getTypeProxy().getFormalTypeName());
- assertEquals(0, ((IArrayBeanProxy) result).getLength());
- }
-
- public void testArrayInitializerOneDim() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createArrayCreation(IExpressionConstants.ROOTEXPRESSION, "int[]", 0);
- exp.createArrayInitializer(1);
- exp.createPrimitiveLiteral(IExpressionConstants.ARRAYINITIALIZER_EXPRESSION, 3);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("int[]", result.getTypeProxy().getFormalTypeName());
- assertEquals(1, ((IArrayBeanProxy) result).getLength());
- assertEquals(3, ((INumberBeanProxy) ((IArrayBeanProxy) result).get(0)).intValue());
- }
-
- public void testArrayInitializerTwoDimEmpty() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createArrayCreation(IExpressionConstants.ROOTEXPRESSION, "int[][]", 0);
- exp.createArrayInitializer(0);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("int[][]", result.getTypeProxy().getFormalTypeName());
- assertEquals(0, ((IArrayBeanProxy) result).getLength());
- }
-
- public void testArrayInitializerTwoDim() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createArrayCreation(IExpressionConstants.ROOTEXPRESSION, "int[][]", 0);
- exp.createArrayInitializer(1);
- exp.createArrayInitializer(0);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("int[][]", result.getTypeProxy().getFormalTypeName());
- assertEquals(1, ((IArrayBeanProxy) result).getLength());
- assertEquals(0, ((IArrayBeanProxy) ((IArrayBeanProxy) result).get(0)).getLength());
- }
-
- public void testArrayInitializerTwoDimNotEmpty() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createArrayCreation(IExpressionConstants.ROOTEXPRESSION, "int[][]", 0);
- exp.createArrayInitializer(2);
- exp.createNull(IExpressionConstants.ARRAYINITIALIZER_EXPRESSION);
- exp.createArrayInitializer(2);
- exp.createPrimitiveLiteral(IExpressionConstants.ARRAYINITIALIZER_EXPRESSION, 3);
- exp.createPrimitiveLiteral(IExpressionConstants.ARRAYINITIALIZER_EXPRESSION, 4);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("int[][]", result.getTypeProxy().getFormalTypeName());
- assertEquals(2, ((IArrayBeanProxy) result).getLength());
- assertNull((IArrayBeanProxy) ((IArrayBeanProxy) result).get(0));
- assertEquals(2, ((IArrayBeanProxy) ((IArrayBeanProxy) result).get(1)).getLength());
- assertEquals(4, ((INumberBeanProxy)((IArrayBeanProxy) ((IArrayBeanProxy) result).get(1)).get(1)).intValue());
- }
-
- public void testArrayInitializerShortInt() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createArrayCreation(IExpressionConstants.ROOTEXPRESSION, "short[]", 0);
- exp.createArrayInitializer(1);
- exp.createPrimitiveLiteral(IExpressionConstants.ARRAYINITIALIZER_EXPRESSION, 3);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("short[]", result.getTypeProxy().getFormalTypeName());
- assertEquals(1, ((IArrayBeanProxy) result).getLength());
- assertEquals(3, ((INumberBeanProxy) ((IArrayBeanProxy) result).get(0)).intValue());
- }
-
- public void testClassInstanceCreationDefault() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createClassInstanceCreation(IExpressionConstants.ROOTEXPRESSION, "java.lang.Object", 0);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("java.lang.Object", result.getTypeProxy().getFormalTypeName());
- }
-
- public void testClassInstanceCreationDefaultWithBeanTypeProxy() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createClassInstanceCreation(IExpressionConstants.ROOTEXPRESSION, proxyTypeFactory.getBeanTypeProxy("java.lang.Object"), 0);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("java.lang.Object", result.getTypeProxy().getFormalTypeName());
- }
-
- public void testClassInstanceCreationOneArg() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createClassInstanceCreation(IExpressionConstants.ROOTEXPRESSION, "java.lang.Integer", 1);
- exp.createStringLiteral(IExpressionConstants.CLASSINSTANCECREATION_ARGUMENT, "3");
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("java.lang.Integer", result.getTypeProxy().getFormalTypeName());
- assertEquals(3, ((INumberBeanProxy) result).intValue());
- }
-
- public void testClassInstanceCreationOneArgWithPrimWidening() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createClassInstanceCreation(IExpressionConstants.ROOTEXPRESSION, "java.lang.Short", 1);
- exp.createPrimitiveLiteral(IExpressionConstants.CLASSINSTANCECREATION_ARGUMENT, (byte)3);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("java.lang.Short", result.getTypeProxy().getFormalTypeName());
- assertEquals((short)3, ((INumberBeanProxy) result).shortValue());
- }
-
- public void testClassInstanceCreationNullArg() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createClassInstanceCreation(IExpressionConstants.ROOTEXPRESSION, "testPackage.TestCtorWithNull", 1);
- exp.createNull(IExpressionConstants.CLASSINSTANCECREATION_ARGUMENT);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("testPackage.TestCtorWithNull", result.getTypeProxy().getFormalTypeName());
- }
-
- public void testClassInstanceCreationMismatchArg() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createClassInstanceCreation(IExpressionConstants.ROOTEXPRESSION, "testPackage.TestCtorWithNull", 1);
- try {
- exp.createPrimitiveLiteral(IExpressionConstants.CLASSINSTANCECREATION_ARGUMENT, 1);
- exp.getExpressionValue();
- fail("Exception should of been thrown.");
- } catch (ThrowableProxy e) {
- assertEquals("java.lang.NoSuchMethodException", e.getTypeProxy().getFormalTypeName());
- }
- }
-
- public void testStaticFieldAccess() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createFieldAccess(IExpressionConstants.ROOTEXPRESSION, "RED", true);
- exp.createTypeReceiver("java.awt.Color");
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("java.awt.Color", result.getTypeProxy().getFormalTypeName());
- IBeanTypeProxy colorType = result.getTypeProxy();
- IMethodProxy red = colorType.getMethodProxy("getRed");
- IMethodProxy green = colorType.getMethodProxy("getGreen");
- IMethodProxy blue = colorType.getMethodProxy("getBlue");
- assertEquals(255, ((INumberBeanProxy) red.invoke(result)).intValue());
- assertEquals(0, ((INumberBeanProxy) green.invoke(result)).intValue());
- assertEquals(0, ((INumberBeanProxy) blue.invoke(result)).intValue());
- }
-
- public void testNonStaticFieldAccess() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createFieldAccess(IExpressionConstants.ROOTEXPRESSION, "x", true);
- exp.createClassInstanceCreation(IExpression.FIELD_RECEIVER, "java.awt.Point", 2);
- exp.createPrimitiveLiteral(IExpression.CLASSINSTANCECREATION_ARGUMENT, 1);
- exp.createPrimitiveLiteral(IExpression.CLASSINSTANCECREATION_ARGUMENT, 2);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("int", result.getTypeProxy().getFormalTypeName());
- assertEquals(1, ((INumberBeanProxy) result).intValue());
- }
-
- public void testStaticMethodInvoke() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createMethodInvocation(IExpressionConstants.ROOTEXPRESSION, "valueOf", true, 1);
- exp.createTypeReceiver("java.lang.String");
- exp.createPrimitiveLiteral(IExpression.METHOD_ARGUMENT, true);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("java.lang.String", result.getTypeProxy().getFormalTypeName());
- assertEquals("true", ((IStringBeanProxy) result).stringValue());
- }
-
- public void testNonStaticMethodInvoke() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createMethodInvocation(IExpressionConstants.ROOTEXPRESSION, "compareTo", true, 1);
- exp.createClassInstanceCreation(IExpression.METHOD_RECEIVER, "java.lang.Integer", 1);
- exp.createPrimitiveLiteral(IExpression.CLASSINSTANCECREATION_ARGUMENT, 3);
- exp.createClassInstanceCreation(IExpression.METHOD_ARGUMENT, "java.lang.Integer", 1);
- exp.createPrimitiveLiteral(IExpression.CLASSINSTANCECREATION_ARGUMENT, 4);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("int", result.getTypeProxy().getFormalTypeName());
- assertTrue("CompareTo wasn't less than 0.", ((INumberBeanProxy) result).intValue() < 0);
- }
-
- public void testConditionalTrue() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createConditionalExpression(IExpression.ROOTEXPRESSION);
- exp.createInfixExpression(IExpression.CONDITIONAL_CONDITION, IExpressionConstants.IN_EQUALS, 0);
- exp.createPrimitiveLiteral(IExpression.INFIX_LEFT, (byte) 3);
- exp.createPrimitiveLiteral(IExpression.INFIX_RIGHT, (short) 3);
- exp.createInfixExpression(IExpression.CONDITIONAL_TRUE, IExpressionConstants.IN_PLUS, 0);
- exp.createPrimitiveLiteral(IExpression.INFIX_LEFT, (byte) 3);
- exp.createPrimitiveLiteral(IExpression.INFIX_RIGHT, (short) 3);
- exp.createInfixExpression(IExpression.CONDITIONAL_FALSE, IExpressionConstants.IN_PLUS, 0);
- exp.createPrimitiveLiteral(IExpression.INFIX_LEFT, (byte) 3);
- exp.createPrimitiveLiteral(IExpression.INFIX_RIGHT, (short) 3);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("int", result.getTypeProxy().getFormalTypeName());
- assertEquals(6, ((INumberBeanProxy) result).intValue());
- }
-
- public void testConditionalFalse() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createConditionalExpression(IExpression.ROOTEXPRESSION);
- exp.createInfixExpression(IExpression.CONDITIONAL_CONDITION, IExpressionConstants.IN_EQUALS, 0);
- exp.createPrimitiveLiteral(IExpression.INFIX_LEFT, (byte) 4);
- exp.createPrimitiveLiteral(IExpression.INFIX_RIGHT, (short) 3);
- exp.createInfixExpression(IExpression.CONDITIONAL_TRUE, IExpressionConstants.IN_PLUS, 0);
- exp.createPrimitiveLiteral(IExpression.INFIX_LEFT, (byte) 3);
- exp.createPrimitiveLiteral(IExpression.INFIX_RIGHT, (short) 3);
- exp.createInfixExpression(IExpression.CONDITIONAL_FALSE, IExpressionConstants.IN_MINUS, 0);
- exp.createPrimitiveLiteral(IExpression.INFIX_LEFT, (byte) 3);
- exp.createPrimitiveLiteral(IExpression.INFIX_RIGHT, (short) 3);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("int", result.getTypeProxy().getFormalTypeName());
- assertEquals(0, ((INumberBeanProxy) result).intValue());
- }
-
- public void testNestedConditionalTrueTrue() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createConditionalExpression(IExpression.ROOTEXPRESSION);
- exp.createInfixExpression(IExpression.CONDITIONAL_CONDITION, IExpressionConstants.IN_EQUALS, 0);
- exp.createPrimitiveLiteral(IExpression.INFIX_LEFT, (byte) 3);
- exp.createPrimitiveLiteral(IExpression.INFIX_RIGHT, (short) 3);
- exp.createConditionalExpression(IExpression.CONDITIONAL_TRUE);
- exp.createInfixExpression(IExpression.CONDITIONAL_CONDITION, IExpressionConstants.IN_EQUALS, 0);
- exp.createPrimitiveLiteral(IExpression.INFIX_LEFT, (byte) 3);
- exp.createPrimitiveLiteral(IExpression.INFIX_RIGHT, (short) 3);
- exp.createInfixExpression(IExpression.CONDITIONAL_TRUE, IExpressionConstants.IN_PLUS, 0);
- exp.createPrimitiveLiteral(IExpression.INFIX_LEFT, (byte) 4);
- exp.createPrimitiveLiteral(IExpression.INFIX_RIGHT, (short) 4);
- exp.createInfixExpression(IExpression.CONDITIONAL_FALSE, IExpressionConstants.IN_MINUS, 0);
- exp.createPrimitiveLiteral(IExpression.INFIX_LEFT, (byte) 4);
- exp.createPrimitiveLiteral(IExpression.INFIX_RIGHT, (short) 3);
- exp.createInfixExpression(IExpression.CONDITIONAL_FALSE, IExpressionConstants.IN_MINUS, 0);
- exp.createPrimitiveLiteral(IExpression.INFIX_LEFT, (byte) 5);
- exp.createPrimitiveLiteral(IExpression.INFIX_RIGHT, (short) 3);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("int", result.getTypeProxy().getFormalTypeName());
- assertEquals(8, ((INumberBeanProxy) result).intValue());
- }
-
- public void testNestedConditionalFalseFalse() throws IllegalStateException, ThrowableProxy, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createConditionalExpression(IExpression.ROOTEXPRESSION);
- exp.createInfixExpression(IExpression.CONDITIONAL_CONDITION, IExpressionConstants.IN_EQUALS, 0);
- exp.createPrimitiveLiteral(IExpression.INFIX_LEFT, (byte) 3);
- exp.createPrimitiveLiteral(IExpression.INFIX_RIGHT, (short) 2);
- exp.createConditionalExpression(IExpression.CONDITIONAL_TRUE);
- exp.createInfixExpression(IExpression.CONDITIONAL_CONDITION, IExpressionConstants.IN_EQUALS, 0);
- exp.createPrimitiveLiteral(IExpression.INFIX_LEFT, (byte) 2);
- exp.createPrimitiveLiteral(IExpression.INFIX_RIGHT, (short) 3);
- exp.createInfixExpression(IExpression.CONDITIONAL_TRUE, IExpressionConstants.IN_PLUS, 0);
- exp.createPrimitiveLiteral(IExpression.INFIX_LEFT, (byte) 4);
- exp.createPrimitiveLiteral(IExpression.INFIX_RIGHT, (short) 4);
- exp.createInfixExpression(IExpression.CONDITIONAL_FALSE, IExpressionConstants.IN_MINUS, 0);
- exp.createPrimitiveLiteral(IExpression.INFIX_LEFT, (byte) 4);
- exp.createPrimitiveLiteral(IExpression.INFIX_RIGHT, (short) 3);
- exp.createInfixExpression(IExpression.CONDITIONAL_FALSE, IExpressionConstants.IN_MINUS, 0);
- exp.createPrimitiveLiteral(IExpression.INFIX_LEFT, (byte) 5);
- exp.createPrimitiveLiteral(IExpression.INFIX_RIGHT, (short) 3);
- IBeanProxy result = exp.getExpressionValue();
- assertNotNull(result);
- assertEquals("int", result.getTypeProxy().getFormalTypeName());
- assertEquals(2, ((INumberBeanProxy) result).intValue());
- }
-
- public void testVoidReturnType() throws IllegalStateException, ThrowableProxy {
- IExpression exp = proxyFactory.createExpression();
- try {
- exp.createInfixExpression(IExpression.ROOTEXPRESSION, IExpressionConstants.IN_PLUS, 0);
- exp.createPrimitiveLiteral(IExpression.INFIX_LEFT, 3);
- exp.createMethodInvocation(IExpression.INFIX_RIGHT, "gc", true, 0);
- exp.createTypeReceiver("java.lang.System");
- exp.getExpressionValue();
- fail("Should of received no expression value exception.");
- } catch (NoExpressionValueException e) {
- if (e.getLocalizedMessage() != null)
- System.out.println(e.getLocalizedMessage());
- }
- }
-
- public void testWrongReturnType() throws ThrowableProxy, IllegalStateException, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- try {
- exp.createInfixExpression(IExpression.ROOTEXPRESSION, IExpressionConstants.IN_PLUS, 0);
- exp.createPrimitiveLiteral(IExpression.INFIX_LEFT, 3);
- exp.createMethodInvocation(IExpression.INFIX_RIGHT, "getSecurityManager", true, 0);
- exp.createTypeReceiver("java.lang.System");
- exp.getExpressionValue();
- fail("Should of received class cast proxy exception.");
- } catch (ThrowableProxy e) {
- if (!e.getTypeProxy().getFormalTypeName().equals("java.lang.IllegalArgumentException"))
- throw e; // Some other exception, rethrow it.
- }
- }
-
- public void testInvoke() throws ThrowableProxy, IllegalStateException, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- exp.createMethodInvocation(IExpression.ROOTEXPRESSION, "getSecurityManager", true, 0);
- exp.createTypeReceiver("java.lang.System");
- exp.invokeExpression();
- }
-
- public void testInvokeFail() throws ThrowableProxy, IllegalStateException, NoExpressionValueException {
- IExpression exp = proxyFactory.createExpression();
- try {
- exp.createMethodInvocation(IExpression.ROOTEXPRESSION, "getenv", true, 1);
- exp.createTypeReceiver("java.lang.System");
- exp.createStringLiteral(IExpression.METHOD_ARGUMENT, "xyz");
- exp.invokeExpression();
- } catch (ThrowableProxy e) {
- if (!e.getTypeProxy().getFormalTypeName().equals("java.lang.Error"))
- throw e; // Some other exception, rethrow it.
- }
- }
-}
diff --git a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/ProxySuite.java b/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/ProxySuite.java
deleted file mode 100644
index 0be0f93f..00000000
--- a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/ProxySuite.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jem.tests.proxy;
-/*
- * $RCSfile: ProxySuite.java,v $
- * $Revision: 1.8 $ $Date: 2005/02/15 23:00:16 $
- */
-import junit.framework.TestSuite;
-
-import org.eclipse.core.runtime.CoreException;
-
-import org.eclipse.jem.internal.proxy.core.*;
-import org.eclipse.jem.tests.JavaTestsPlugin;
-
-/**
- * @author richkulp
- *
- * This suite is for testing straight Proxy independent of the type of proxy (e.g. Remote or IDE).
- * It can't run by itself. It needs to have the registry creater object stored in it so that
- * the appropriate registry can be created and recreated as necessary by the test.
- *
- * If the tests inherit from AbstractTestProxy the setRegistryHandler will be called on it.
- */
-public class ProxySuite extends TestSuite {
-
-
- // Test cases to be include in the suite
- private static Class testsList[] = {
- TestStandard.class,
- TestAWTProxy.class,
- ExpressionTest.class,
- } ;
-
- public static String pkgName = "org.eclipse.jem.tests.proxy" ;
-
- /**
- * Constructor for PackageSuite.
- */
- public ProxySuite() {
- super();
- populateSuite();
- }
-
- /**
- * Constructor for PackageSuite.
- * @param theClass
- */
- public ProxySuite(Class theClass) {
- super(theClass);
- populateSuite();
- }
-
- /**
- * Constructor for PackageSuite.
- * @param name
- */
- public ProxySuite(String name) {
- super(name);
- populateSuite() ;
- }
-
- private void populateSuite () {
- for (int i=0; i<testsList.length; i++)
- addTestSuite(testsList[i]) ;
- }
-
- /**
- * Return a contributor to be used when starting tests so that ProxySuite can contribute to it.
- * @return A contributor for Proxy Suite tests
- */
- public static IConfigurationContributor getProxySuiteContributor() {
- return new ConfigurationContributorAdapter() {
- public void contributeClasspaths(IConfigurationContributionController controller) throws CoreException {
- controller.contributeClasspath(JavaTestsPlugin.getPlugin().getBundle(), "vm/tests.jar", IConfigurationContributionController.APPEND_USER_CLASSPATH, false);
- }
- };
- }
-}
diff --git a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/TestAWTProxy.java b/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/TestAWTProxy.java
deleted file mode 100644
index a20032d8..00000000
--- a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/TestAWTProxy.java
+++ /dev/null
@@ -1,119 +0,0 @@
-package org.eclipse.jem.tests.proxy;
-/*******************************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * $RCSfile: TestAWTProxy.java,v $
- * $Revision: 1.3 $ $Date: 2005/02/15 23:00:16 $
- */
-import org.eclipse.jem.internal.proxy.core.*;
-import org.eclipse.jem.internal.proxy.core.IBeanProxy;
-import org.eclipse.jem.internal.proxy.core.IBeanTypeProxy;
-import org.eclipse.jem.internal.proxy.awt.*;
-import org.eclipse.jem.internal.proxy.awt.IStandardAwtBeanProxyFactory;
-import org.eclipse.jem.internal.proxy.awt.JavaStandardAwtBeanConstants;
-
-/**
- * @author richkulp
- *
- * To change the template for this generated type comment go to
- * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
- */
-public class TestAWTProxy extends AbstractTestProxy {
-
- public TestAWTProxy() {
- super();
- }
-
- public TestAWTProxy(String name) {
- super(name);
- }
-
- private JavaStandardAwtBeanConstants constants; // If this is null then don't do tests.
-
- /* (non-Javadoc)
- * @see junit.framework.TestCase#setUp()
- */
- protected void setUp() throws Exception {
- super.setUp();
-
- constants = JavaStandardAwtBeanConstants.getConstants(registry);
- assertNotNull(constants);
- if (!constants.isAWTAvailable()) {
- // this is not an error. It just means we don't anything. This is signified by constants being null.
- constants = null;
- }
- }
-
- public void testAWTColor() throws ClassCastException, ThrowableProxy, InstantiationException {
- if (constants == null)
- return; // No AWT, so test isn't done, but still considered good.
-
- // AWT Color tests
- IBeanTypeProxy colorType = proxyTypeFactory.getBeanTypeProxy("java.awt.Color"); //$NON-NLS-1$
- assertNotNull(colorType);
- IBeanProxy colorProxy = colorType.newInstance("java.awt.Color.cyan"); //$NON-NLS-1$
- assertNotNull(colorProxy);
- assertEquals("java.awt.Color[r=0,g=255,b=255]", colorProxy.toBeanString());
- }
-
- public void testAWTProxyFactory() {
- if (constants == null)
- return; // No AWT, so test isn't done, but still considered good.
-
- IStandardAwtBeanProxyFactory awtProxyFactory = (IStandardAwtBeanProxyFactory) registry.getBeanProxyFactoryExtension(IStandardAwtBeanProxyFactory.REGISTRY_KEY);
- assertNotNull(awtProxyFactory);
-
- // Test the creation through the helpers, plus test special methods
- IDimensionBeanProxy dimBean = awtProxyFactory.createDimensionBeanProxyWith(5,6);
- assertNotNull(dimBean);
- assertEquals("java.awt.Dimension[width=5,height=6]", dimBean.toBeanString()); //$NON-NLS-1$
- assertEquals(5, dimBean.getWidth());
- assertEquals(6, dimBean.getHeight());
-
- IPointBeanProxy pointBean = awtProxyFactory.createPointBeanProxyWith(5,6);
- assertNotNull(pointBean);
- assertEquals("java.awt.Point[x=5,y=6]", pointBean.toBeanString()); //$NON-NLS-1$
- assertEquals(5, pointBean.getX());
- assertEquals(6, pointBean.getY());
-
- IRectangleBeanProxy rectBean = awtProxyFactory.createBeanProxyWith(5,6,7,8);
- assertNotNull(rectBean);
- assertEquals("java.awt.Rectangle[x=5,y=6,width=7,height=8]", rectBean.toBeanString()); //$NON-NLS-1$
- assertEquals(5, rectBean.getX());
- assertEquals(6, rectBean.getY());
- assertEquals(7, rectBean.getWidth());
- assertEquals(8, rectBean.getHeight());
- }
-
- public void testAWTSpecialsInitString() throws ClassCastException, ThrowableProxy, InstantiationException {
- if (constants == null)
- return; // No AWT, so test isn't done, but still considered good.
-
-
- // Test the creation through init strings
- IBeanTypeProxy dimType = proxyTypeFactory.getBeanTypeProxy("java.awt.Dimension"); //$NON-NLS-1$
- assertNotNull(dimType);
- IDimensionBeanProxy dimBean = (IDimensionBeanProxy) dimType.newInstance("new java.awt.Dimension(7,8)"); //$NON-NLS-1$
- assertNotNull(dimBean);
- assertEquals("java.awt.Dimension[width=7,height=8]", dimBean.toBeanString()); //$NON-NLS-1$
-
- IBeanTypeProxy pointType = proxyTypeFactory.getBeanTypeProxy("java.awt.Point"); //$NON-NLS-1$
- IPointBeanProxy pointBean = (IPointBeanProxy) pointType.newInstance("new java.awt.Point(5,6)"); //$NON-NLS-1$
- assertNotNull(pointBean);
- assertEquals("java.awt.Point[x=5,y=6]", pointBean.toBeanString()); //$NON-NLS-1$
-
- IBeanTypeProxy rectType = proxyTypeFactory.getBeanTypeProxy("java.awt.Rectangle"); //$NON-NLS-1$
- IRectangleBeanProxy rectBean = (IRectangleBeanProxy) rectType.newInstance("new java.awt.Rectangle(5,6,7,8)"); //$NON-NLS-1$
- assertNotNull(rectBean);
- assertEquals("java.awt.Rectangle[x=5,y=6,width=7,height=8]", rectBean.toBeanString()); //$NON-NLS-1$
- }
-
-}
diff --git a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/TestCallback.java b/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/TestCallback.java
deleted file mode 100644
index 17b1fae9..00000000
--- a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/TestCallback.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jem.tests.proxy;
-/*
- * $RCSfile: TestCallback.java,v $
- * $Revision: 1.4 $ $Date: 2005/02/15 23:00:16 $
- */
-
-import org.eclipse.jem.internal.proxy.core.*;
-import java.io.InputStream;
-
-import junit.framework.TestCase;
-/**
- * This is the callback for the test case. This runs on the IDE side.
- */
-public class TestCallback implements ICallback {
-
- Object tester;
- ProxyFactoryRegistry registry;
-
- int counter = 0;
-
- /**
- * This will do assert tests to make sure test completed correctly.
- */
- public void testCompleted() {
- if (badParmType != null)
- TestCase.assertEquals(IIntegerBeanProxy.class, badParmType);
- if (badParmValue != 0)
- TestCase.assertEquals(goodParmValue, badParmValue);
- if (badMsg != null)
- TestCase.fail(badMsg);
- TestCase.assertEquals(2, counter);
- }
-
- private boolean stoppedTest;
- private Class badParmType = null;
- private int badParmValue, goodParmValue;
- private String badMsg;
-
- // Normally the callback doesn't determine when to stop
- // the callback proxy. But for this test it does.
- public TestCallback(Object t, ProxyFactoryRegistry registry) {
- tester = t;
- this.registry = registry;
- }
-
- public Object calledBack(int msgID, IBeanProxy parm){
- synchronized(tester) {
- if (stoppedTest)
- return null; // We've already stopped, don't do anymore.
- }
-
- if (msgID != 0) {
- badMsg = "Msgid " + msgID + " is incorrect. It should be zero.";
- stopTest();
- } else if (parm instanceof IIntegerBeanProxy) {
- int pv = ((IIntegerBeanProxy) parm).intValue();
- if (++counter != pv) {
- badParmValue = pv;
- goodParmValue = counter;
- stopTest();
- return null;
- }
- if (counter == 2) {
- stopTest();
- }
- } else {
- // Bad parm type.
- badParmType = parm.getClass();
- stopTest();
- }
- return null;
- }
-
- public Object calledBack(int msgID, Object parm) {
- if (msgID != 1) {
- badMsg = "Msgid " + msgID + " is incorrect. It should be one.";
- stopTest();
- } else if (parm instanceof Integer){
- // We are going to use the registry to see what thread id is running when we call into it.
- IMethodProxy currentThreadMethod = registry.getMethodProxyFactory().getMethodProxy("java.lang.Thread", "currentThread", null);
- IBeanProxy thread = currentThreadMethod.invokeCatchThrowableExceptions(null);
- IMethodProxy hashcodeMethod = registry.getMethodProxyFactory().getMethodProxy("java.lang.Object", "hashCode", null);
- IBeanProxy threadID = hashcodeMethod.invokeCatchThrowableExceptions(thread);
- if (threadID instanceof INumberBeanProxy) {
- if (!parm.equals(((INumberBeanProxy) threadID).numberValue())) {
- badMsg = "ThreadID returned from call not match parm sent it. Means callback not on same thread.";
- stopTest();
- }
- } else {
- badMsg = "ThreadID returned from call is not valid.";
- stopTest();
- }
- } else {
- badMsg = "Parm is invalid for calledBack with Object";
- stopTest();
- }
- return null;
- }
-
- public Object calledBack(int msgID, Object[] parms){
- badMsg = "Failed Callback Test. Shouldn't have gotton to multi-parms"; //$NON-NLS-1$
- stopTest();
- return null;
- }
-
- public void calledBackStream(int msgID, InputStream in){
- badMsg = "Failed Callback Test. Shouldn't have gotton to input stream"; //$NON-NLS-1$
- stopTest();
- }
-
- void stopTest() {
- synchronized(tester) {
- stoppedTest = true;
- tester.notify();
- }
- }
-
-}
diff --git a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/TestCallbackStream.java b/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/TestCallbackStream.java
deleted file mode 100644
index cce61814..00000000
--- a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/TestCallbackStream.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jem.tests.proxy;
-/*
- * $RCSfile: TestCallbackStream.java,v $
- * $Revision: 1.4 $ $Date: 2005/02/15 23:00:16 $
- */
-
-import org.eclipse.jem.internal.proxy.core.*;
-import java.io.InputStream;
-import java.io.IOException;
-
-import junit.framework.TestCase;
-/**
- * This is the callback for the test case of the stream. This runs on the IDE side.
- */
-public class TestCallbackStream implements ICallback {
-
- Object tester; // Notified when the test is finished.
-
- private boolean testStopped;
- private String badMsg;
- private IOException exp;
- private boolean testSuccesful;
-
- public TestCallbackStream(Object o) {
- tester = o;
- }
-
- public void testComplete() throws IOException {
- if (badMsg != null)
- TestCase.fail(badMsg);
- if (exp != null)
- throw exp;
- TestCase.assertTrue(testSuccesful);
- }
-
- public Object calledBack(int msgID, Object parm){
- badMsg = "Failed Callback Test. Shouldn't have gotton to object parm"; //$NON-NLS-1$
- stopTest();
- return null;
- }
- public Object calledBack(int msgID, IBeanProxy parm){
- badMsg = "Failed Callback Test. Shouldn't have gotton to parm"; //$NON-NLS-1$
- stopTest();
- return null;
- }
- public Object calledBack(int msgID, Object[] parms){
- badMsg = "Failed Callback Test. Shouldn't have gotton to multi-parms"; //$NON-NLS-1$
- stopTest();
- return null;
- }
- public void calledBackStream(int msgID, InputStream in){
- // Read from the stream for 30000 bytes. Verify that
- // we get an incrementing stream, i.e. 0, 1, ..., 127, -127, ...
-
- synchronized (tester) {
- if (testStopped)
- return;
- }
- for (int i=0; i<30000; i++) {
- try {
- int next = in.read();
- if (next == -1) {
- badMsg = "Failed Callback Stream test. Stream ended too soon. On counter="+String.valueOf(i); //$NON-NLS-1$
- stopTest();
- return;
- }
-
- if (((byte) next) != ((byte) i)) {
- badMsg = "Failed Callback Stream test. Did not get correct next byte at:" + i; //$NON-NLS-1$
- stopTest();
- return;
- }
- } catch (IOException e) {
- exp = e;
- stopTest();
- return;
- }
- }
-
- try {
- if (in.read() != -1) {
- badMsg = "Failed Callback Stream test. Too much data sent."; //$NON-NLS-1$
- stopTest();
- return;
- }
- } catch (IOException e) {
- exp = e;
- }
-
- testSuccesful = true;
- stopTest();
- }
-
- void stopTest() {
- synchronized(tester) {
- testStopped = true;
- tester.notify();
- }
- }
-
-
-}
diff --git a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/TestStandard.java b/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/TestStandard.java
deleted file mode 100644
index a5a0fec0..00000000
--- a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/TestStandard.java
+++ /dev/null
@@ -1,639 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jem.tests.proxy;
-/*
- * $RCSfile: TestStandard.java,v $
- * $Revision: 1.8 $ $Date: 2005/02/15 23:00:16 $
- */
-import java.io.IOException;
-
-import org.eclipse.jem.internal.proxy.common.AmbiguousMethodException;
-import org.eclipse.jem.internal.proxy.core.*;
-
-/**
- * @author richkulp
- *
- * To change the template for this generated type comment go to
- * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
- */
-public class TestStandard extends AbstractTestProxy {
-
- /**
- *
- */
- public TestStandard() {
- super();
- }
-
- /**
- * @param name
- */
- public TestStandard(String name) {
- super(name);
- }
-
- public void testObject() {
- IBeanTypeProxy objectType = proxyTypeFactory.getBeanTypeProxy("java.lang.Object"); //$NON-NLS-1$
- assertNotNull(objectType);
- assertFalse(objectType.isArray());
- assertEquals("java.lang.Object", objectType.getTypeName());
- }
-
- public void testTypeOf() {
- IBeanTypeProxy objectType = proxyTypeFactory.getBeanTypeProxy("java.lang.Object"); //$NON-NLS-1$
- IBeanTypeProxy integerType = proxyTypeFactory.getBeanTypeProxy("java.lang.Integer"); //$NON-NLS-1$
- assertNotNull(integerType);
- assertEquals("java.lang.Integer", integerType.getTypeName());
- assertTrue(integerType.isKindOf(objectType));
- }
-
- public void testMethodInvoke() throws ThrowableProxy {
- IBeanTypeProxy integerType = proxyTypeFactory.getBeanTypeProxy("java.lang.Integer"); //$NON-NLS-1$
- IMethodProxy mthd = integerType.getMethodProxy("valueOf", "java.lang.String"); //$NON-NLS-1$ //$NON-NLS-2$
- assertNotNull(mthd);
- // See if we can invoke methods.
- IIntegerBeanProxy anInt = (IIntegerBeanProxy) mthd.invoke(null, proxyFactory.createBeanProxyWith("5")); //$NON-NLS-1$
- assertNotNull(anInt);
- assertEquals(5, anInt.intValue());
- // See if invoke with bad type throws the ExceptionProxy.
- try {
- mthd.invoke(null, proxyFactory.createBeanProxyWith(5));
- fail("Exception not thrown like it should of been.");
- } catch (ThrowableProxy e) {
- // We should of gotton the exception. See if it is of the correct type.
- assertEquals("java.lang.IllegalArgumentException", e.getTypeProxy().getTypeName()); //$NON-NLS-1$
- }
- }
-
- public void testInvoke() throws ThrowableProxy {
- // Technically invokables should be used for one-shot usage, but here to test the invoke correctly
- // it will be used twice. This is not an error, just overhead.
- IBeanTypeProxy integerType = proxyTypeFactory.getBeanTypeProxy("java.lang.Integer"); //$NON-NLS-1$
- IInvokable invokable = integerType.getInvokable("valueOf", "java.lang.String"); //$NON-NLS-1$ //$NON-NLS-2$
- assertNotNull(invokable);
- // See if we can invoke methods.
- IIntegerBeanProxy anInt = (IIntegerBeanProxy) invokable.invoke(null, proxyFactory.createBeanProxyWith("5")); //$NON-NLS-1$
- assertNotNull(anInt);
- assertEquals(5, anInt.intValue());
- // See if invoke with bad type throws the ExceptionProxy.
- try {
- invokable.invoke(null, proxyFactory.createBeanProxyWith(5));
- fail("Exception not thrown like it should of been.");
- } catch (ThrowableProxy e) {
- // We should of gotton the exception. See if it is of the correct type.
- assertEquals("java.lang.IllegalArgumentException", e.getTypeProxy().getTypeName()); //$NON-NLS-1$
- }
- }
-
- public void testSimpleInitString() throws ThrowableProxy, InstantiationException {
- IBeanTypeProxy integerType = proxyTypeFactory.getBeanTypeProxy("java.lang.Integer"); //$NON-NLS-1$
- // See if we can create it from an initialization string.
- IIntegerBeanProxy anInt = (IIntegerBeanProxy) integerType.newInstance("new java.lang.Integer(6)"); //$NON-NLS-1$
- assertNotNull(anInt);
- assertEquals(6, anInt.intValue());
-
- // See if string initialization works.
- IStringBeanProxy aString = (IStringBeanProxy) proxyTypeFactory.getBeanTypeProxy("java.lang.String").newInstance("\"abcd\""); //$NON-NLS-1$ //$NON-NLS-2$
- assertNotNull(aString);
- assertEquals("abcd", aString.stringValue()); //$NON-NLS-1$
- }
-
- public void testGetConstructors() {
- IBeanTypeProxy stringType = proxyTypeFactory.getBeanTypeProxy("java.lang.String"); //$NON-NLS-1$
-
- // Get all constructors.
- IConstructorProxy[] ctors = stringType.getConstructors();
- assertNotNull(ctors);
- assertEquals(11, ctors.length);
- }
-
- public void testGetDeclaredConstructors() {
- IBeanTypeProxy testAccessType = proxyTypeFactory.getBeanTypeProxy("testPackage.TestAccess"); //$NON-NLS-1$
-
- // Get all constructors.
- IConstructorProxy[] ctors = testAccessType.getDeclaredConstructors();
- assertNotNull(ctors);
- assertEquals(3, ctors.length);
- }
-
- public void testSimpleConstructor() throws ThrowableProxy {
- IBeanTypeProxy integerType = proxyTypeFactory.getBeanTypeProxy("java.lang.Integer"); //$NON-NLS-1$
-
- // See if we can create it from a constructor.
- IConstructorProxy ctor = integerType.getConstructorProxy(new String[] {"java.lang.String"}); //$NON-NLS-1$
- assertNotNull(ctor);
- IIntegerBeanProxy anInt = (IIntegerBeanProxy) ctor.newInstance(new IBeanProxy[] {proxyFactory.createBeanProxyWith("0")}); //$NON-NLS-1$
- assertEquals(0, anInt.intValue());
-
- // Zero is cached, let's see if that is what we got above.
- IIntegerBeanProxy aZero = proxyFactory.createBeanProxyWith(new Integer(0));
- assertSame(anInt, aZero);
- }
-
- public void testSimpleDeclaredConstructor() throws ThrowableProxy {
- IBeanTypeProxy testAccessType = proxyTypeFactory.getBeanTypeProxy("testPackage.TestAccess"); //$NON-NLS-1$
-
- // See if we can get a private constructor.
- IConstructorProxy ctor = testAccessType.getDeclaredConstructorProxy(new String[] {"java.lang.RuntimeException"}); //$NON-NLS-1$
- assertNotNull(ctor);
- }
-
- public void testPrimitiveReturn() throws ThrowableProxy {
- IBeanTypeProxy integerType = proxyTypeFactory.getBeanTypeProxy("java.lang.Integer"); //$NON-NLS-1$
-
- // See that we get a primitive back when the method return type is a primitive.
- IMethodProxy mthdPrim = integerType.getMethodProxy("intValue"); //$NON-NLS-1$
- IIntegerBeanProxy anInt = (IIntegerBeanProxy) mthdPrim.invoke(proxyFactory.createBeanProxyWith(5));
- assertEquals("int", anInt.getTypeProxy().getTypeName()); //$NON-NLS-1$
- assertEquals(5, anInt.intValue());
-
- // See that we get a primitive back when the field is a primitive.
- IFieldProxy fieldPrim = integerType.getFieldProxy("MIN_VALUE"); //$NON-NLS-1$
- anInt = (IIntegerBeanProxy) fieldPrim.get(null);
- assertEquals("int", anInt.getTypeProxy().getTypeName()); //$NON-NLS-1$
- assertEquals(Integer.MIN_VALUE, anInt.intValue());
- }
-
- public void testPrimitiveArrayType() {
- // Test Primitive arrays.
- IArrayBeanTypeProxy arrayType = (IArrayBeanTypeProxy) proxyTypeFactory.getBeanTypeProxy("[I"); //$NON-NLS-1$
- assertNotNull(arrayType);
- assertTrue(arrayType.isArray());
- assertEquals("[I", arrayType.getTypeName()); //$NON-NLS-1$
- assertEquals(proxyTypeFactory.getBeanTypeProxy("int"), arrayType.getComponentType()); //$NON-NLS-1$
- }
-
- public void testObjectArrayType() {
- // Test simple object type array
- IArrayBeanTypeProxy arrayType = (IArrayBeanTypeProxy) proxyTypeFactory.getBeanTypeProxy("[Ljava.lang.Integer;"); //$NON-NLS-1$
- assertNotNull(arrayType);
- assertTrue(arrayType.isArray());
- assertEquals("[Ljava.lang.Integer;", arrayType.getTypeName()); //$NON-NLS-1$
- assertEquals(proxyTypeFactory.getBeanTypeProxy("java.lang.Integer"), arrayType.getComponentType()); //$NON-NLS-1$
- }
-
- public void testPrimitive2DArrayType() {
- // Test two dimension primitive array
- IArrayBeanTypeProxy arrayType = (IArrayBeanTypeProxy) proxyTypeFactory.getBeanTypeProxy("[[I"); //$NON-NLS-1$
- assertNotNull(arrayType);
- assertTrue(arrayType.isArray());
- assertEquals("[[I", arrayType.getTypeName()); //$NON-NLS-1$
- assertEquals(proxyTypeFactory.getBeanTypeProxy("[I"), arrayType.getComponentType()); //$NON-NLS-1$
-
- // Test construction using accessor.
- arrayType = (IArrayBeanTypeProxy) proxyTypeFactory.getBeanTypeProxy("int", 2); //$NON-NLS-1$
- assertNotNull(arrayType);
- assertTrue(arrayType.isArray());
- assertEquals("[[I", arrayType.getTypeName()); //$NON-NLS-1$
- }
-
- public void testObject2DArrayType() {
- // Test two dimension object type array
- IArrayBeanTypeProxy arrayType = (IArrayBeanTypeProxy) proxyTypeFactory.getBeanTypeProxy("[[Ljava.lang.Integer;"); //$NON-NLS-1$
- assertNotNull(arrayType);
- assertTrue(arrayType.isArray());
- assertEquals("[[Ljava.lang.Integer;", arrayType.getTypeName()); //$NON-NLS-1$
- assertEquals(proxyTypeFactory.getBeanTypeProxy("[Ljava.lang.Integer;"), arrayType.getComponentType()); //$NON-NLS-1$
-
- // Test get type using accessor.
- arrayType = (IArrayBeanTypeProxy) proxyTypeFactory.getBeanTypeProxy("java.lang.Integer", 2); //$NON-NLS-1$
- assertNotNull(arrayType);
- assertTrue(arrayType.isArray());
- assertEquals("[[Ljava.lang.Integer;", arrayType.getTypeName()); //$NON-NLS-1$
- }
-
- public void testArrayTypeFromArrayType() {
- // Test creating an array type from an array type, i.e. adding dimensions.
- IArrayBeanTypeProxy arrayType = (IArrayBeanTypeProxy) proxyTypeFactory.getBeanTypeProxy("[Ljava.lang.Integer;", 2); //$NON-NLS-1$
- assertNotNull(arrayType);
- assertTrue(arrayType.isArray());
- assertEquals("[[[Ljava.lang.Integer;", arrayType.getTypeName()); //$NON-NLS-1$
- }
-
- public void testArrayFromAccessorSimpleType() throws ThrowableProxy {
- IBeanTypeProxy integerType = proxyTypeFactory.getBeanTypeProxy("java.lang.Integer"); //$NON-NLS-1$
-
- // Test creating an array with accessor of more than one dimension with component type not an array.
- IArrayBeanProxy arrayProxy = proxyFactory.createBeanProxyWith(integerType, new int[] {3, 4});
- assertNotNull(arrayProxy);
- assertEquals("[[Ljava.lang.Integer;", arrayProxy.getTypeProxy().getTypeName()); //$NON-NLS-1$
- assertEquals(3, arrayProxy.getLength());
-
- // get(0) should be an Integer[4].
- arrayProxy = (IArrayBeanProxy) arrayProxy.get(0);
- assertNotNull(arrayProxy);
- assertEquals(4, arrayProxy.getLength());
- }
-
- public void testArrayFromAccessorArrayType() throws ThrowableProxy {
- IArrayBeanTypeProxy arrayType = (IArrayBeanTypeProxy) proxyTypeFactory.getBeanTypeProxy("java.lang.Integer", 1); //$NON-NLS-1$
-
- // Test creating an array with accessor but component type is an array.
- IArrayBeanProxy arrayProxy = proxyFactory.createBeanProxyWith(arrayType, new int[] {1});
- assertNotNull(arrayProxy);
- assertEquals("[Ljava.lang.Integer;", arrayProxy.getTypeProxy().getTypeName()); //$NON-NLS-1$
- assertEquals(1, arrayProxy.getLength());
- }
-
- public void testArrayFromAccessorArrayTypeMultiDim() throws ThrowableProxy {
- IArrayBeanTypeProxy arrayType = (IArrayBeanTypeProxy) proxyTypeFactory.getBeanTypeProxy("java.lang.Integer", 1); //$NON-NLS-1$
-
- // Test creating an array with accessor but component type is an array, but extend and add a dimension.
- IArrayBeanProxy arrayProxy = proxyFactory.createBeanProxyWith(arrayType, new int[] {2 ,3});
- assertNotNull(arrayProxy);
- assertEquals("[[Ljava.lang.Integer;", arrayProxy.getTypeProxy().getTypeName()); //$NON-NLS-1$
- assertEquals(2, arrayProxy.getLength());
-
- // Test first entry is an Integer[3]
- IArrayBeanProxy idx1 = (IArrayBeanProxy) arrayProxy.get(0);
- assertNotNull(idx1);
- assertEquals(3, idx1.getLength());
-
- // Test [1][2] is null.
- IBeanProxy idx2 = arrayProxy.get(new int [] {1,2});
- assertNull(idx2);
- }
-
- public void testArraySet() throws ThrowableProxy {
- IBeanProxy anInt = proxyFactory.createBeanProxyWith(new java.lang.Integer(23));
- IArrayBeanTypeProxy arrayType = (IArrayBeanTypeProxy) proxyTypeFactory.getBeanTypeProxy("java.lang.Integer", 1); //$NON-NLS-1$
-
- IArrayBeanProxy arrayProxy = proxyFactory.createBeanProxyWith(arrayType, new int[] {2 ,3});
- assertNotNull(arrayProxy);
- assertEquals("[[Ljava.lang.Integer;", arrayProxy.getTypeProxy().getTypeName()); //$NON-NLS-1$
- assertEquals(2, arrayProxy.getLength());
-
- // Test first entry is an Integer[3]
- IArrayBeanProxy idx1 = (IArrayBeanProxy) arrayProxy.get(0);
-
- // Test set into array idx1, but retrieve from arrayProxy. Tests
- // 1) Set with one index into array from outer array[0]
- // 2) Get with multi index from outer array
- // 3) And that the same array is set that exists within the first array.
- idx1.set(anInt, 2);
- IBeanProxy idx3 = arrayProxy.get(new int[] {0, 2});
- assertNotNull(idx3);
- assertEquals("java.lang.Integer", idx3.getTypeProxy().getTypeName()); //$NON-NLS-1$
- assertEquals(anInt, idx3);
-
- // Inverse test of above, multi set, single get of same array.
- arrayProxy.set(anInt, new int[] {0,1});
- assertEquals(anInt, idx1.get(1));
- }
-
- public void testArraySnapshot2DimArray() throws ThrowableProxy {
- IArrayBeanTypeProxy arrayType = (IArrayBeanTypeProxy) proxyTypeFactory.getBeanTypeProxy("java.lang.Integer", 2); //$NON-NLS-1$
-
- IArrayBeanProxy arrayProxy = proxyFactory.createBeanProxyWith(arrayType, new int[] {2, 3});
- assertNotNull(arrayProxy);
-
- // Get the two entries which are Integer[3]
- IArrayBeanProxy idx0 = (IArrayBeanProxy) arrayProxy.get(0);
- IArrayBeanProxy idx1 = (IArrayBeanProxy) arrayProxy.get(1);
-
- // Now get the snapshot and see if the entries are idx0 and idx1.
- IBeanProxy[] snapshot = arrayProxy.getSnapshot();
- assertEquals(idx0, snapshot[0]);
- assertEquals(idx1, snapshot[1]);
- }
-
- public void testArraySnapshotPrimitiveArray() throws ThrowableProxy {
- IArrayBeanTypeProxy arrayType = (IArrayBeanTypeProxy) proxyTypeFactory.getBeanTypeProxy("int", 1); //$NON-NLS-1$
-
- IArrayBeanProxy arrayProxy = proxyFactory.createBeanProxyWith(arrayType, new int[] {2});
- assertNotNull(arrayProxy);
-
- // Set the two entries to int values.
- arrayProxy.set(proxyFactory.createBeanProxyWith(2), 0);
- arrayProxy.set(proxyFactory.createBeanProxyWith(3), 1);
- IIntegerBeanProxy idx0 = (IIntegerBeanProxy) arrayProxy.get(0);
- IIntegerBeanProxy idx1 = (IIntegerBeanProxy) arrayProxy.get(1);
- assertEquals(2, idx0.intValue());
- assertEquals(3, idx1.intValue());
-
- // Now get the snapshot and see if the entries are idx0 and idx1.
- IBeanProxy[] snapshot = arrayProxy.getSnapshot();
- assertEquals(idx0, snapshot[0]);
- assertEquals(idx1, snapshot[1]);
- }
-
- public void testEmptyArray() throws ThrowableProxy {
- IArrayBeanTypeProxy arrayType = (IArrayBeanTypeProxy) proxyTypeFactory.getBeanTypeProxy("java.lang.Integer", 1); //$NON-NLS-1$
-
- // Create an empty one dimensional array
- IArrayBeanProxy arrayProxy = proxyFactory.createBeanProxyWith(arrayType, null);
- assertNotNull(arrayProxy);
- assertEquals("[Ljava.lang.Integer;", arrayProxy.getTypeProxy().getTypeName()); //$NON-NLS-1$
- assertEquals(0, arrayProxy.getLength());
- }
-
- public void testEmpty2DArray() throws ThrowableProxy {
- // Create an emtpy two dimensional array
- IArrayBeanProxy arrayProxy = proxyFactory.createBeanProxyWith(proxyTypeFactory.getBeanTypeProxy("java.lang.Integer", 2), null); //$NON-NLS-1$
- assertNotNull(arrayProxy);
- assertEquals("[[Ljava.lang.Integer;", arrayProxy.getTypeProxy().getTypeName()); //$NON-NLS-1$
- assertEquals(0, arrayProxy.getLength());
- }
-
- public void test2DArray() throws ThrowableProxy {
- // Create a 2D array with three empty entries in dim 0.
- IArrayBeanProxy arrayProxy = proxyFactory.createBeanProxyWith(proxyTypeFactory.getBeanTypeProxy("java.lang.Integer", 2), 3); //$NON-NLS-1$
- assertNotNull(arrayProxy);
- assertEquals("[[Ljava.lang.Integer;", arrayProxy.getTypeProxy().getTypeName()); //$NON-NLS-1$
- assertEquals(3, arrayProxy.getLength());
- // Array entry should be empty.
- IArrayBeanProxy idx1 = (IArrayBeanProxy) arrayProxy.get(0);
- assertNull(idx1);
- }
-
- public void testPrimitiveArray() throws ThrowableProxy {
- // Make sure that if the final component type is an
- // int (primitive) that we get a primitive proxy back and not an Integer object.
- IArrayBeanTypeProxy arrayType = (IArrayBeanTypeProxy) proxyTypeFactory.getBeanTypeProxy("int", 1); //$NON-NLS-1$
- IArrayBeanProxy arrayProxy = proxyFactory.createBeanProxyWith(arrayType, 3);
- arrayProxy.set(proxyFactory.createBeanProxyWith(44), 1);
- IBeanProxy idx1 = arrayProxy.get(1);
- assertNotNull(idx1);
- assertEquals("int", idx1.getTypeProxy().getTypeName()); //$NON-NLS-1$
- assertEquals(44, ((IIntegerBeanProxy) idx1).intValue());
- }
-
- public void testCollections() throws ThrowableProxy {
- IBeanTypeProxy vectorType = proxyTypeFactory.getBeanTypeProxy("java.util.Vector"); //$NON-NLS-1$
- IBeanProxy vectorProxy = vectorType.newInstance();
- CollectionBeanProxyWrapper col = new CollectionBeanProxyWrapper(vectorProxy);
-
- // Test adding
- assertTrue(col.add(proxyFactory.createBeanProxyWith(33)));
- assertEquals(1, col.size());
-
- // Test toArray, first entry should be 33 and length should be 1.
- IArrayBeanProxy arrayOut = col.toArray();
- assertEquals(1, arrayOut.getLength());
- assertEquals(33, ((IIntegerBeanProxy) arrayOut.get(0)).intValue());
-
- // Test toArray(array).
- IArrayBeanProxy arrayInto = proxyFactory.createBeanProxyWith(arrayOut.getTypeProxy(), arrayOut.getLength()); //$NON-NLS-1$
- IArrayBeanProxy arrayOut2 = col.toArray(arrayInto);
- // It should of been the exact same array (arrayInto == arrayOut2 under the proxies).
- assertTrue(arrayInto.sameAs(arrayOut2));
- assertEquals(33, ((IIntegerBeanProxy) arrayOut.get(0)).intValue());
-
- // Test setting with wrong type throws exception.
- try {
- // Test the setting with wrong type throws an exception
- col = new CollectionBeanProxyWrapper(arrayOut);
- fail("ClassCastException should of been thrown.");
- } catch (ClassCastException e) {
- // If here, then the test was passed
- }
- }
-
- public void testIterator() throws ThrowableProxy {
- IBeanTypeProxy vectorType = proxyTypeFactory.getBeanTypeProxy("java.util.Vector"); //$NON-NLS-1$
- IBeanProxy vectorProxy = vectorType.newInstance();
- CollectionBeanProxyWrapper col = new CollectionBeanProxyWrapper(vectorProxy);
- col.add(proxyFactory.createBeanProxyWith(33));
-
- // See if the iterator interface works.
- IteratorBeanProxyWrapper itrProxy = col.iterator();
- assertNotNull(itrProxy);
- int iterations = 0;
- while (itrProxy.hasNext()) {
- iterations++;
- assertTrue(iterations < 2);
- IBeanProxy itrValue = itrProxy.next();
- assertEquals(33, ((IIntegerBeanProxy) itrValue).intValue());
- }
- }
-
- public void testListInterface() throws ThrowableProxy {
- IBeanTypeProxy vectorType = proxyTypeFactory.getBeanTypeProxy("java.util.Vector"); //$NON-NLS-1$
- IBeanProxy vectorProxy = vectorType.newInstance();
-
- // See if the list inteface works.
- ListBeanProxyWrapper list = new ListBeanProxyWrapper(vectorProxy);
- assertTrue(list.add(proxyFactory.createBeanProxyWith(33))); // First entry.
- list.add(0, proxyFactory.createBeanProxyWith(true)); // Now becomes first entry.
- assertEquals(2, list.size());
- assertEquals(true, ((IBooleanBeanProxy) list.get(0)).booleanValue());
- assertEquals(33, ((IIntegerBeanProxy) list.get(1)).intValue()); // Swapped to second entry due to add(0,...)
- }
-
- public void testListIterator() throws ThrowableProxy {
- IBeanTypeProxy vectorType = proxyTypeFactory.getBeanTypeProxy("java.util.Vector"); //$NON-NLS-1$
- IBeanProxy vectorProxy = vectorType.newInstance();
- ListBeanProxyWrapper list = new ListBeanProxyWrapper(vectorProxy);
- list.add(proxyFactory.createBeanProxyWith(33)); // First entry.
- list.add(0, proxyFactory.createBeanProxyWith(true)); // Now becomes first entry.
-
- // See if the ListIterator interface works
- ListIteratorBeanProxyWrapper lItrProxy = list.listIterator();
- assertNotNull(lItrProxy);
- assertTrue(lItrProxy.hasNext());
- IBooleanBeanProxy bool1 = (IBooleanBeanProxy) lItrProxy.next();
- assertEquals(true, bool1.booleanValue());
- IIntegerBeanProxy int1 = (IIntegerBeanProxy) lItrProxy.next();
- assertEquals(33, int1.intValue()); // Old first entry moved to second entry by add(0,...) above.
- assertFalse(lItrProxy.hasNext());
- assertEquals(1, lItrProxy.previousIndex());
- }
-
- public void testMethodAccessors() throws ThrowableProxy {
- IBeanTypeProxy integerType = proxyTypeFactory.getBeanTypeProxy("java.lang.Integer"); //$NON-NLS-1$
-
- // Test able to access beantype proxy and invoke methods on it. This isn't
- // the approved way of getting methods, but it tests that method proxies
- // are created correctly if returned from an invoke method.
- IBeanTypeProxy classTypeProxy = proxyTypeFactory.getBeanTypeProxy("java.lang.Class"); //$NON-NLS-1$
- IMethodProxy getMethodMethod = classTypeProxy.getMethodProxy("getMethod", new String[] {"java.lang.String", "[Ljava.lang.Class;"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- // Get the Integer.byteValue() method through an invoke instead of a method factory or bean type.
- IBeanProxy method = getMethodMethod.invoke(integerType, new IBeanProxy[] {
- proxyFactory.createBeanProxyWith("byteValue"), null}); //$NON-NLS-1$
- assertNotNull(method);
- assertTrue(method instanceof IMethodProxy);
-
- // Now invoke it to see if correct answer comes back.
- IBeanProxy byteValue = ((IMethodProxy) method).invoke(proxyFactory.createBeanProxyWith(new Integer(254)));
- assertNotNull(byteValue);
- assertEquals("byte", byteValue.getTypeProxy().getTypeName()); //$NON-NLS-1$
- assertEquals((byte)254, ((INumberBeanProxy) byteValue).byteValue());
- }
-
- public void testInvokableAccessors() throws ThrowableProxy {
- IBeanTypeProxy integerType = proxyTypeFactory.getBeanTypeProxy("java.lang.Integer"); //$NON-NLS-1$
-
- // Test able to access beantype proxy and invoke methods on it. This isn't
- // the approved way of getting methods, but it tests that method proxies
- // are created correctly if returned from an invoke method.
- IBeanTypeProxy classTypeProxy = proxyTypeFactory.getBeanTypeProxy("java.lang.Class"); //$NON-NLS-1$
- IInvokable getMethodInvokable = classTypeProxy.getInvokable("getMethod", new String[] {"java.lang.String", "[Ljava.lang.Class;"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- // Get the Integer.byteValue() method through an invoke instead of a method factory or bean type.
- IBeanProxy method = getMethodInvokable.invoke(integerType, new IBeanProxy[] {
- proxyFactory.createBeanProxyWith("byteValue"), null}); //$NON-NLS-1$
- assertNotNull(method);
- assertTrue(method instanceof IMethodProxy);
-
- // Now invoke it to see if correct answer comes back.
- IBeanProxy byteValue = ((IMethodProxy) method).invoke(proxyFactory.createBeanProxyWith(new Integer(254)));
- assertNotNull(byteValue);
- assertEquals("byte", byteValue.getTypeProxy().getTypeName()); //$NON-NLS-1$
- assertEquals((byte)254, ((INumberBeanProxy) byteValue).byteValue());
- }
-
- public void testCallback() throws ThrowableProxy {
- System.out.println("--- Starting the callback test ---"); //$NON-NLS-1$
- IBeanTypeProxy callbackType = proxyTypeFactory.getBeanTypeProxy("org.eclipse.jem.tests.proxy.vm.TestCallback"); //$NON-NLS-1$
- assertNotNull(callbackType);
- Object testObject = new Object();
- IBeanProxy callbackProxy = callbackType.newInstance();
- TestCallback cb = new TestCallback(testObject, registry);
- registry.getCallbackRegistry().registerCallback(callbackProxy, cb);
- IInvokable start = callbackType.getInvokable("start"); //$NON-NLS-1$
- IInvokable stop = callbackType.getInvokable("stop"); //$NON-NLS-1$
- synchronized(testObject) {
- start.invokeCatchThrowableExceptions(callbackProxy);
- try {
- testObject.wait(30000); // Should be done by 30 seconds.
- } catch (InterruptedException e) {
- }
- }
- stop.invokeCatchThrowableExceptions(callbackProxy);
- registry.getCallbackRegistry().deregisterCallback(callbackProxy);
- cb.testCompleted();
- System.out.println("If there is anything in the .log file, then the test failed."); //$NON-NLS-1$
- }
-
- public void testCallbackStream() throws ThrowableProxy, IOException {
- System.out.println("--- Starting the callback stream test ---"); //$NON-NLS-1$
- IBeanTypeProxy callbackType = proxyTypeFactory.getBeanTypeProxy("org.eclipse.jem.tests.proxy.vm.TestCallbackStream"); //$NON-NLS-1$
- assertNotNull(callbackType);
- Object testObject = new Object();
- IBeanProxy callbackProxy = callbackType.newInstance();
- TestCallbackStream cb = new TestCallbackStream(testObject);
- registry.getCallbackRegistry().registerCallback(callbackProxy, cb);
- IMethodProxy start = callbackType.getMethodProxy("start"); //$NON-NLS-1$
- synchronized(testObject) {
- start.invokeCatchThrowableExceptions(callbackProxy);
- try {
- testObject.wait(30000); // Should be done by 30 seconds.
- } catch (InterruptedException e) {
- }
- }
- registry.getCallbackRegistry().deregisterCallback(callbackProxy);
- cb.testComplete();
- System.out.println("If there is anything in the .log file, then the test failed."); //$NON-NLS-1$
- }
-
- public void testSimpleGetField() throws ThrowableProxy {
- IBeanTypeProxy integerType = proxyTypeFactory.getBeanTypeProxy("java.lang.Integer"); //$NON-NLS-1$
-
- // Get the public field.
- IFieldProxy field = integerType.getFieldProxy("MAX_VALUE"); //$NON-NLS-1$
- assertNotNull(field);
- }
-
- public void testSimpleGetDeclaredField() throws ThrowableProxy {
- IBeanTypeProxy integerType = proxyTypeFactory.getBeanTypeProxy("java.lang.Integer"); //$NON-NLS-1$
-
- // Get the public field.
- IFieldProxy field = integerType.getDeclaredFieldProxy("value"); //$NON-NLS-1$
- assertNotNull(field);
- }
-
- public void testGetFields() {
- IBeanTypeProxy testAccessType = proxyTypeFactory.getBeanTypeProxy("testPackage.TestAccess"); //$NON-NLS-1$
-
- // Get all fields.
- IFieldProxy[] fields = testAccessType.getFields();
- assertNotNull(fields);
- assertEquals(1, fields.length);
- }
-
- public void testGetDeclaredFields() {
- IBeanTypeProxy testAccessType = proxyTypeFactory.getBeanTypeProxy("testPackage.TestAccess"); //$NON-NLS-1$
-
- // Get all fields.
- IFieldProxy[] fields = testAccessType.getDeclaredFields();
- assertNotNull(fields);
- assertEquals(2, fields.length);
- }
-
- public void testSimpleGetMethod() throws ThrowableProxy {
- IBeanTypeProxy testAccessType = proxyTypeFactory.getBeanTypeProxy("testPackage.TestAccess"); //$NON-NLS-1$
-
- // Get the public field.
- IMethodProxy method = testAccessType.getMethodProxy("xyz"); //$NON-NLS-1$
- assertNotNull(method);
- }
-
- public void testSimpleGetDeclaredMethod() throws ThrowableProxy {
- IBeanTypeProxy testAccessType = proxyTypeFactory.getBeanTypeProxy("testPackage.TestAccess"); //$NON-NLS-1$
-
- // Get the public field.
- IMethodProxy method = testAccessType.getDeclaredMethodProxy("qxr", (String[]) null); //$NON-NLS-1$
- assertNotNull(method);
- }
-
- public void testGetMethods() {
- IBeanTypeProxy testAccessType = proxyTypeFactory.getBeanTypeProxy("testPackage.TestAccess"); //$NON-NLS-1$
- IBeanTypeProxy testObjectType = proxyTypeFactory.getBeanTypeProxy("java.lang.Object"); //$NON-NLS-1$
-
- // Get all methods. Need to get all of Object too since getMethods() gets them all including inherited. We will
- // then take the diff to show what's only at the local level.
- IMethodProxy[] methods = testAccessType.getMethods();
- IMethodProxy[] objectMethods = testObjectType.getMethods();
- assertNotNull(methods);
- assertNotNull(objectMethods);
- assertEquals(6, methods.length-objectMethods.length);
- }
-
- public void testGetDeclaredMethods() {
- IBeanTypeProxy testAccessType = proxyTypeFactory.getBeanTypeProxy("testPackage.TestAccess"); //$NON-NLS-1$
-
- // Get all fields.
- IMethodProxy[] methods = testAccessType.getDeclaredMethods();
- assertNotNull(methods);
- assertEquals(7, methods.length);
- }
-
- public void testFindCompatibleConstructor() throws AmbiguousMethodException, NoSuchMethodException {
- IBeanTypeProxy testAccessType = proxyTypeFactory.getBeanTypeProxy("testPackage.TestAccess"); //$NON-NLS-1$
-
- IConstructorProxy ctor = testAccessType.getCompatibleConstructor(new IBeanTypeProxy[] {proxyTypeFactory.getBeanTypeProxy("java.lang.ArrayStoreException")});
- IConstructorProxy comp = testAccessType.getDeclaredConstructorProxy(new IBeanTypeProxy[] {proxyTypeFactory.getBeanTypeProxy("java.lang.RuntimeException")});
-
- assertNotNull(ctor);
- assertNotNull(comp);
- assertEquals(ctor, comp);
- }
-
- public void testFindCompatibleMethod() throws AmbiguousMethodException, NoSuchMethodException {
- IBeanTypeProxy testAccessType = proxyTypeFactory.getBeanTypeProxy("testPackage.TestAccess"); //$NON-NLS-1$
-
- IMethodProxy method = testAccessType.getCompatibleMethod("xyz", new IBeanTypeProxy[] {proxyTypeFactory.getBeanTypeProxy("java.lang.Integer")});
- IMethodProxy comp = testAccessType.getDeclaredMethodProxy("xyz", new IBeanTypeProxy[] {proxyTypeFactory.getBeanTypeProxy("java.lang.Number")});
-
- assertNotNull(method);
- assertNotNull(comp);
- assertEquals(method, comp);
- }
-
- public void testFindAmbiguousMethod() throws NoSuchMethodException {
- IBeanTypeProxy testAccessType = proxyTypeFactory.getBeanTypeProxy("testPackage.TestAccess"); //$NON-NLS-1$
-
- try {
- testAccessType.getCompatibleMethod("ddd", new IBeanTypeProxy[] {proxyTypeFactory.getBeanTypeProxy("java.lang.Integer"), proxyTypeFactory.getBeanTypeProxy("java.lang.Integer")});
- fail("Should of been ambiguous");
- } catch (AmbiguousMethodException e) {
- }
- }
-}
diff --git a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/ide/IDEProxySuite.java b/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/ide/IDEProxySuite.java
deleted file mode 100644
index 71fbd648..00000000
--- a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/ide/IDEProxySuite.java
+++ /dev/null
@@ -1,93 +0,0 @@
-package org.eclipse.jem.tests.proxy.ide;
-/*******************************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * $RCSfile: IDEProxySuite.java,v $
- * $Revision: 1.3 $ $Date: 2005/02/15 23:00:16 $
- */
-import junit.extensions.TestSetup;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.eclipse.core.runtime.CoreException;
-
-import org.eclipse.jem.internal.proxy.core.IConfigurationContributor;
-import org.eclipse.jem.internal.proxy.core.ProxyFactoryRegistry;
-import org.eclipse.jem.internal.proxy.ide.IDERegistration;
-import org.eclipse.jem.tests.proxy.AbstractTestProxy;
-import org.eclipse.jem.tests.proxy.ProxySuite;
-
-/**
- * @author richkulp
- *
- * This is the true test suite for Remote Proxy Testing. The RemoteProxyTest will use this.
- */
-public class IDEProxySuite extends TestSetup {
-
- // Test cases to be include in the suite
- private static Class testsList[] = { ProxySuite.class, };
-
- private AbstractTestProxy.RegistryHandler registryHandler = new AbstractTestProxy.RegistryHandler() {
- private ProxyFactoryRegistry registry;
-
- public boolean isValid() {
- return true;
- }
- public ProxyFactoryRegistry getRegistry() throws CoreException {
- if (registry == null) {
- registry = IDERegistration.startAnImplementation(new IConfigurationContributor[] { ProxySuite.getProxySuiteContributor()}, true, null, "JUnit Tests for IDE Proxy", "org.eclipse.jem.tests", null); //$NON-NLS-1$ //$NON-NLS-2$
- }
- return registry;
- }
-
- public void destroyRegistry() {
- if (registry != null) {
- registry.terminateRegistry();
- registry = null;
- }
- }
- };
-
- public IDEProxySuite() {
- this("Test IDE Proxy Suite");
- }
-
- public IDEProxySuite(String name) {
- super(new TestSuite(name) {
- {
- for (int i = 0; i < testsList.length; i++) {
- // We may get some tests and suites.
- if (TestSuite.class.isAssignableFrom(testsList[i]) || TestSetup.class.isAssignableFrom(testsList[i])) {
- try {
- Test ts = (Test) testsList[i].newInstance();
- addTest(ts);
- } catch (Exception e) {
- e.printStackTrace();
- }
- } else
- addTestSuite(testsList[i]);
- }
-
- }
- });
-
- AbstractTestProxy.initRegistryHandler((TestSuite) getTest(), registryHandler);
- }
-
- public static Test suite() {
- return new IDEProxySuite();
- }
-
- protected void tearDown() throws Exception {
- registryHandler.destroyRegistry();
- }
-
-}
diff --git a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/AbstractInitParserTestCase.java b/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/AbstractInitParserTestCase.java
deleted file mode 100644
index 0748443a..00000000
--- a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/AbstractInitParserTestCase.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jem.tests.proxy.initParser;
-/*
- * $RCSfile: AbstractInitParserTestCase.java,v $
- * $Revision: 1.5 $ $Date: 2005/02/15 23:00:16 $
- */
-import java.util.Enumeration;
-
-import junit.framework.*;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-/**
- * @author richkulp
- *
- * To change the template for this generated type comment go to
- * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
- */
-public abstract class AbstractInitParserTestCase extends TestCase {
-
- /**
- * Initialize the test helper for all of the tests within the given suite.
- *
- * @param suite
- * @param testHelper
- *
- * @since 1.0.0
- */
- public static void initSuite(TestSuite suite, AbstractInitStringParserTestHelper testHelper) {
- Enumeration tests = suite.tests();
- while (tests.hasMoreElements()) {
- Test test = (Test) tests.nextElement();
- if (test instanceof AbstractInitParserTestCase)
- ((AbstractInitParserTestCase) test).setTestHelper(testHelper);
- else if (test instanceof TestSuite)
- initSuite((TestSuite) test, testHelper);
- }
- }
-
- public AbstractInitParserTestCase() {
- super();
- }
-
- public AbstractInitParserTestCase(String name) {
- super(name);
- }
-
- protected AbstractInitStringParserTestHelper testHelper;
-
- /**
- * Set the test helper to use.
- *
- * @param testHelper
- *
- * @since 1.0.0
- */
- public void setTestHelper(AbstractInitStringParserTestHelper testHelper) {
- this.testHelper = testHelper;
- }
-
-}
diff --git a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/AbstractInitStringParserTestHelper.java b/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/AbstractInitStringParserTestHelper.java
deleted file mode 100644
index 0a79dc7e..00000000
--- a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/AbstractInitStringParserTestHelper.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * $RCSfile: AbstractInitStringParserTestHelper.java,v $
- * $Revision: 1.2 $ $Date: 2005/02/15 23:00:16 $
- */
-package org.eclipse.jem.tests.proxy.initParser;
-
-/**
- * Interface for init string parser helper. Allows "InitString Parser" or "AST Parser" or some other kind of testing.
- *
- * @since 1.0.0
- */
-public abstract class AbstractInitStringParserTestHelper {
- /**
- * Test the given string against the given result. equalsOnly determines how exactly it matches.
- * If allowed to throw exceptions, then the exception as the result of evaluation will be squashed.
- *
- * @param aString
- * @param expectedResult
- * @param throwsException <code>true</code> if this is expected to throw an exception and such exception will not be passed on out and will return normal.
- * @param equalsOnly <code>true</code> means if must match either ==, equals(), or toString()'s match.
- * @throws Throwable
- *
- * @since 1.0.0
- */
- public abstract void testInitString(String aString, Object expectedResult, boolean throwsException, boolean equalsOnly)
- throws Throwable;
-
- /**
- * Test the given string against the given result. It must match either ==, equals(), or toString()'s match.
- * It should not throw exceptions. If it does, the exception will be passed out.
- *
- * @param aString
- * @param expectedResult
- * @throws Throwable
- *
- * @since 1.0.0
- */
- public void testInitString(String aString, Object expectedResult) throws Throwable {
- testInitString(aString, expectedResult, false, true);
- }
-
- /**
- * Test the given string against the given result. equalsOnly determines how exactly it matches
- * It should not throw exceptions. If it does, the exception will be passed out.
- *
- * @param aString
- * @param equalsOnly <code>true</code> means if must match either ==, equals(), or toString()'s match.
- * @param expectedResult
- * @throws Throwable
- *
- * @since 1.0.0
- */
- public void testInitString(String aString, boolean equalsOnly, Object expectedResult) throws Throwable {
- testInitString(aString, expectedResult, false, equalsOnly);
- }
-} \ No newline at end of file
diff --git a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/ArrayConstructorTest.java b/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/ArrayConstructorTest.java
deleted file mode 100644
index b36255bf..00000000
--- a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/ArrayConstructorTest.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jem.tests.proxy.initParser;
-/*
- * $RCSfile: ArrayConstructorTest.java,v $
- * $Revision: 1.3 $ $Date: 2005/02/15 23:00:16 $
- */
-
-/**
- * @author jmyers
- *
- * To change the template for this generated type comment go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-public class ArrayConstructorTest extends AbstractInitParserTestCase {
-
- /**
- * Constructor for ArrayContructorTest.
- * @param name
- */
- public ArrayConstructorTest(String name) {
- super(name);
- }
-
- public void testEmptyString1D() throws Throwable {
- testHelper.testInitString("new String[2]",new String[2]);
- }
- public void testEmptyString2D() throws Throwable {
- testHelper.testInitString("new String[2][2]",new String[2][2]);
- }
- public void testEmptyColor1D() throws Throwable {
- testHelper.testInitString("new java.awt.Color[3]",new java.awt.Color[3]);
- }
- public void testEmptyColor2D() throws Throwable {
- testHelper.testInitString("new java.awt.Color[3][4]",new java.awt.Color[3][4]);
- }
- public void testEmptyInt() throws Throwable {
- testHelper.testInitString("new int[3]", new int[3]);
- }
-
- // TODO: enable this test when this works
- /*
- public void testCalculatedSize() {
- testHelper.testInitString("new String[new Integer(3).intValue()]",new String[new Integer(3).intValue()]);
- }
- */
-
- public void testInitializedInts() throws Throwable {
- testHelper.testInitString("new int[] {-2,3}",new int[]{-2,3});
- }
- public void testInitializedIntsTrailingComma() throws Throwable {
- testHelper.testInitString("new int[] {-2,3,}",new int[]{-2,3,});
- }
- public void testInitializedDoubleParens() throws Throwable {
- testHelper.testInitString("new double[] {(-2), 3.0 }",new double[] {(-2), 3.0 });
- }
- public void testInitializedStringsTwo() throws Throwable {
- testHelper.testInitString("new String[] {\"1\",\"2\"}",new String[] {"1","2"});
- }
- public void testInitializedStringsThree() throws Throwable {
- testHelper.testInitString("new String[] {\"Frog\",\"Dog\",\"Cow\"}",new String[] {"Frog","Dog","Cow"});
- }
- public void testInitializedColors() throws Throwable {
- testHelper.testInitString("new java.awt.Color[] { java.awt.Color.red , new java.awt.Color(0,0,0) }",new java.awt.Color[] { java.awt.Color.red , new java.awt.Color(0,0,0) });
- }
- public void testInitalizedInts2D1() throws Throwable {
- testHelper.testInitString("new int[][] { { 2 , -3 } , { 4 , 5 } }",new int[][] { { 2 , -3 } , { 4 , 5 } });
- }
- public void testInitalizedInts2D2() throws Throwable {
- testHelper.testInitString("new int[][] {{1,2,3},{4,5,6}}",new int[][]{{1,2,3},{4,5,6}});
- }
- public void testInitalizedInts2DParensCommas() throws Throwable {
- // Much to my surprise, extra commands are valid syntax at the end of the arguments even without any following argument
- // the resolve that occurs by the Visual Editor actually inserts these, so we need tests to make sure we can deal with them correctly
- testHelper.testInitString("new int[][] { {2 ,(-3),} , { 4 , 5,}}",new int[][] { { 2 , (-3),} , { 4 , 5,}});
- }
- public void testInitalizedInts2DParensCommas2() throws Throwable {
- testHelper.testInitString("new int[][] { {2 ,(-3),} , { 4 , 5,},}",new int[][] { { 2 , (-3),} , { 4 , 5,},});
- }
- public void testInitalizedDoubles2D() throws Throwable {
- testHelper.testInitString("new double[][] { { 2 , 3 } , { 4 , 5 } }",new double[][] { { 2 , 3 } , { 4 , 5 } });
- }
- public void testInitalizedDoubles2DMany() throws Throwable {
- testHelper.testInitString("new double[][]{{ 5.0, -2.0, 5.0, -1.0, -1.0, 5.0, -2.0, 5.0 }, { 5.0, -2.0, 5.0, -2.0, 5.0, -1.0, 5.0, -2.0, 5.0 }}",new double[][]{{ 5.0, -2.0, 5.0, -1.0, -1.0, 5.0, -2.0, 5.0 }, { 5.0, -2.0, 5.0, -2.0, 5.0, -1.0, 5.0, -2.0, 5.0 }});
- }
- public void testInt2DParam() throws Throwable {
- testHelper.testInitString("new org.eclipse.jem.tests.proxy.initParser.NavigationParameters(new int[][] {{1,2,3},{3,4,5}})",new org.eclipse.jem.tests.proxy.initParser.NavigationParameters(new int[][] {{1,2,3},{3,4,5}}));
- }
- public void testInt2DParamCommas() throws Throwable {
- testHelper.testInitString("new org.eclipse.jem.tests.proxy.initParser.NavigationParameters(new int[][] {{1,2,3,},{3,4,5,}})",new org.eclipse.jem.tests.proxy.initParser.NavigationParameters(new int[][] {{1,2,3,},{3,4,5,}}));
- }
- public void testInt2DParamCommas2() throws Throwable {
- testHelper.testInitString("new org.eclipse.jem.tests.proxy.initParser.NavigationParameters(new int[][] {{1,2,3,},{3,4,5,},})",new org.eclipse.jem.tests.proxy.initParser.NavigationParameters(new int[][] {{1,2,3,},{3,4,5,},}));
- }
- public void testDoubleParam() throws Throwable {
- testHelper.testInitString("new org.eclipse.jem.tests.proxy.initParser.NavigationParameters(new double[]{1,2,3})",new org.eclipse.jem.tests.proxy.initParser.NavigationParameters(new double[]{1,2,3}));
- }
- public void testDoubleParam2() throws Throwable {
- testHelper.testInitString("new org.eclipse.jem.tests.proxy.initParser.NavigationParameters(new double[]{1.0,2,-3.5})",new org.eclipse.jem.tests.proxy.initParser.NavigationParameters(new double[]{1.0,2,-3.5}));
- }
- public void testDoubleParam3() throws Throwable {
- testHelper.testInitString("new org.eclipse.jem.tests.proxy.initParser.NavigationParameters(new double[]{-1,2,-0.5})",new org.eclipse.jem.tests.proxy.initParser.NavigationParameters(new double[]{-1,2,-0.5}));
- }
- public void testDouble2DParam() throws Throwable {
- // This test is one that is similar to the type of constructor used by TableLayout for SWA
- testHelper.testInitString("new org.eclipse.jem.tests.proxy.initParser.NavigationParameters(new double[][]{{ 5.0, -2.0, 5.0, -1.0, -1.0, 5.0, -2.0, 5.0 }, { 5.0, -2.0, 5.0, -2.0, 5.0, -1.0, 5.0, -2.0, 5.0 }})",
- new org.eclipse.jem.tests.proxy.initParser.NavigationParameters(new double[][]{{ 5.0, -2.0, 5.0, -1.0, -1.0, 5.0, -2.0, 5.0 }, { 5.0, -2.0, 5.0, -2.0, 5.0, -1.0, 5.0, -2.0, 5.0 }}));
- }
- public void testDouble2DParamCommas() throws Throwable {
- testHelper.testInitString("new org.eclipse.jem.tests.proxy.initParser.NavigationParameters(new double[][]{{ 5.0, -2.0, 5.0, -1.0, -1.0, 5.0, -2.0, 5.0 , }, { 5.0, -2.0, 5.0, -2.0, 5.0, -1.0, 5.0, -2.0, 5.0 , } , })",
- new org.eclipse.jem.tests.proxy.initParser.NavigationParameters(new double[][]{{ 5.0, -2.0, 5.0, -1.0, -1.0, 5.0, -2.0, 5.0 , }, { 5.0, -2.0, 5.0, -2.0, 5.0, -1.0, 5.0, -2.0, 5.0 , } , }));
- }
-
-
- // TODO: enable this test when the case is handled properly
- /*
- public void testInt3D() {
- // Needs fixing - We don't have dimensions greater than 2 working yet
- testHelper.testInitString("new int[][][] { { { 1 , 2 } , { 3 , 4 } }, { { 5 , 6 } , { 7 , 8 } } }",new int[][][] { { { 1 , 2 } , { 3 , 4 } }, { { 5 , 6 } , { 7 , 8 } } });
- }
- */
-}
diff --git a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/BlockTest.java b/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/BlockTest.java
deleted file mode 100644
index 5719cfa0..00000000
--- a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/BlockTest.java
+++ /dev/null
@@ -1,108 +0,0 @@
-package org.eclipse.jem.tests.proxy.initParser;
-/*******************************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * $RCSfile: BlockTest.java,v $
- * $Revision: 1.4 $ $Date: 2005/02/15 23:00:16 $
- */
-
-/**
- * @author jmyers
- *
- * To change the template for this generated type comment go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-public class BlockTest extends AbstractInitParserTestCase {
-
- /**
- * Constructor for BlockTest.
- * @param name
- */
- public BlockTest(String name) {
- super(name);
- }
-
-/*
- * TODO These three don't work for now. Later they may be fixed if it shows up as a general problem for customers. So far they haven't.
- public void testSetElements1() throws Throwable {
- testHelper.testInitString(
- "(((new org.eclipse.jem.tests.proxy.initParser.NavigationParameters(3)).setElemAt(\"accountStatementDetails\",0)).setElemAt(new org.eclipse.jem.tests.proxy.initParser.NavigationParameters(\"OpnBalance\",\"OpnBalance\",null,false,false,true,50),1)).setElemAt(new org.eclipse.jem.tests.proxy.initParser.NavigationParameters(\"OpnDate\",\"OpnDate\",null,false,false,true,50),2);",
- (((new org.eclipse.jem.tests.proxy.initParser.NavigationParameters(3)).setElemAt("accountStatementDetails",0)).setElemAt(new NavigationParameters("OpnBalance","OpnBalance",null,false,false,true,50),1)).setElemAt(new org.eclipse.jem.tests.proxy.initParser.NavigationParameters("OpnDate","OpnDate",null,false,false,true,50),2));
- }
- public void testSetElements2() throws Throwable {
- testHelper.testInitString(
- "(((new org.eclipse.jem.tests.proxy.initParser.NavigationParameters(3)).setElemAt(\"accountStatementDetails\",0)).setElemAt(new org.eclipse.jem.tests.proxy.initParser.NavigationParameters(\"OpnBalance\",\"OpnBalance\",null,false,false,true,50),1))",
- (((new org.eclipse.jem.tests.proxy.initParser.NavigationParameters(3)).setElemAt("accountStatementDetails",0)).setElemAt(new NavigationParameters("OpnBalance","OpnBalance",null,false,false,true,50),1)));
- }
- public void testSetElements3() throws Throwable {
- testHelper.testInitString(
- "((new org.eclipse.jem.tests.proxy.initParser.NavigationParameters(3)).setElemAt(new org.eclipse.jem.tests.proxy.initParser.NavigationParameters(\"OpnBalance\",\"OpnBalance\",null,false,false,true,50),1))",
- ((new org.eclipse.jem.tests.proxy.initParser.NavigationParameters(3)).setElemAt(new org.eclipse.jem.tests.proxy.initParser.NavigationParameters("OpnBalance","OpnBalance",null,false,false,true,50),1)));
- }
-*/
- public void testSetElement4() throws Throwable {
- testHelper.testInitString(
- "((new org.eclipse.jem.tests.proxy.initParser.NavigationParameters(3)).setElemAt(\"accountStatementDetails\",0))",
- ((new org.eclipse.jem.tests.proxy.initParser.NavigationParameters(3)).setElemAt("accountStatementDetails",0)));
- }
- public void testStringReplacement1() throws Throwable {
- testHelper.testInitString(
- "(((new String(\"Frog\")).replace('o','i')).replace('i','a')).replace('a','o')",
- (((new String("Frog")).replace('o','i')).replace('i','a')).replace('a','o'));
- }
- public void testStringReplacement2() throws Throwable {
- testHelper.testInitString(
- "((((new String(\"Frog\")).replace('o','i')).replace('i','a')).replace('a','o')).replace('o','e')",
- ((((new String("Frog")).replace('o','i')).replace('i','a')).replace('a','o')).replace('o','e'));
- }
- public void testStringCases1() throws Throwable {
- testHelper.testInitString(
- "(new String(\"Frog\").toLowerCase()).toUpperCase()",
- (new String("Frog").toLowerCase()).toUpperCase()
- );
- }
- public void testStringCases2() throws Throwable {
- testHelper.testInitString(
- "((new String(\"Frog\").toLowerCase()).toUpperCase()).toLowerCase()",
- ((new String("Frog").toLowerCase()).toUpperCase()).toLowerCase()
- );
- }
- public void testStringCases3() throws Throwable {
- testHelper.testInitString(
- "(((new String(\"Frog\").toLowerCase()).toUpperCase()).toLowerCase()).toUpperCase()",
- (((new String("Frog").toLowerCase()).toUpperCase()).toLowerCase()).toUpperCase()
- );
- }
- public void testStringConcat1() throws Throwable {
- testHelper.testInitString(
- "(new String(\"Frogs\").concat(\"are\")).concat(\"cool\")",
- (new String("Frogs").concat("are")).concat("cool")
- );
- }
- public void testStringConcat2() throws Throwable {
- testHelper.testInitString(
- "((new String(\"Frogs\").concat(\"are\")).concat(\"very\")).concat(\"cool\")",
- ((new String("Frogs").concat("are")).concat("very")).concat("cool")
- );
- }
- public void testStringConcat3() throws Throwable {
- testHelper.testInitString(
- "(((new String(\"Frogs\").concat(\"just\")).concat(\"rule\")).concat(\"cool\")).concat(\"kingdom\")",
- (((new String("Frogs").concat("just")).concat("rule")).concat("cool")).concat("kingdom")
- );
- }
- public void testStringConcat4() throws Throwable {
- testHelper.testInitString(
- "((new String(\"Frogs\").concat(\"just\")).concat(new String(\"totally\")).concat(new String(\"Rock\")))",
- ((new String("Frogs").concat("just")).concat(new String("totally")).concat(new String("Rock")))
- );
- }
-}
diff --git a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/BorderTest.java b/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/BorderTest.java
deleted file mode 100644
index 0a7b79ac..00000000
--- a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/BorderTest.java
+++ /dev/null
@@ -1,114 +0,0 @@
-package org.eclipse.jem.tests.proxy.initParser;
-/*******************************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * $RCSfile: BorderTest.java,v $
- * $Revision: 1.4 $ $Date: 2005/02/15 23:00:16 $
- */
-
-/**
- * @author jmyers
- *
- * To change the template for this generated type comment go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-public class BorderTest extends AbstractInitParserTestCase {
-
- /**
- * Constructor for BorderTest.
- * @param name
- */
- public BorderTest(String name) {
- super(name);
- }
-
- public void testEtchedRaised() throws Throwable {
- testHelper.testInitString(
- "javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED)" ,
- javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED));
- }
-
- public void testBevelRaised() throws Throwable {
- testHelper.testInitString(
- "javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED)",
- javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
- }
-
- public void testEmpty() throws Throwable {
- testHelper.testInitString(
- "javax.swing.BorderFactory.createEmptyBorder()",
- javax.swing.BorderFactory.createEmptyBorder());
- }
-
- public void testMatte() throws Throwable {
- testHelper.testInitString(
- "javax.swing.BorderFactory.createMatteBorder(2, 2, 2, 2, java.awt.Color.black)",
- false,
- javax.swing.BorderFactory.createMatteBorder(2, 2, 2, 2, java.awt.Color.black));
- }
-
- public void testSoftBevel() throws Throwable {
- testHelper.testInitString(
- "new javax.swing.border.SoftBevelBorder(0)",
- false,
- new javax.swing.border.SoftBevelBorder(0));
- }
-
- public void testEmptySize() throws Throwable {
- testHelper.testInitString(
- "javax.swing.BorderFactory.createEmptyBorder(2, 2, 2, 2)",
- false,
- javax.swing.BorderFactory.createEmptyBorder(2, 2, 2, 2));
- }
-
- public void testLine() throws Throwable {
- testHelper.testInitString(
- "javax.swing.BorderFactory.createLineBorder(java.awt.Color.black, 2)",
- false,
- javax.swing.BorderFactory.createLineBorder(java.awt.Color.black, 2));
- }
-
- public void testSoftBevelRaised() throws Throwable {
- testHelper.testInitString(
- "new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED)",
- false,
- new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
- }
-
- public void testTitledBasic() throws Throwable {
- testHelper.testInitString(
- "javax.swing.BorderFactory.createTitledBorder(null,\"frog\",2,0)",
- false,
- javax.swing.BorderFactory.createTitledBorder(null, "frog", 2, 0));
- }
-
- public void testCompoundBasic() throws Throwable {
- testHelper.testInitString(
- "new javax.swing.border.CompoundBorder(javax.swing.BorderFactory.createEmptyBorder(),javax.swing.BorderFactory.createEmptyBorder())",
- false,
- new javax.swing.border.CompoundBorder(javax.swing.BorderFactory.createEmptyBorder(),javax.swing.BorderFactory.createEmptyBorder()));
- }
-
- public void testCompoundMedium() throws Throwable {
- testHelper.testInitString(
- "javax.swing.BorderFactory.createCompoundBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED), javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED))",
- false,
- javax.swing.BorderFactory.createCompoundBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED), javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED)));
- }
-
-
- public void testTitledAdvanced() throws Throwable {
- testHelper.testInitString(
- "javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(java.awt.SystemColor.activeCaption,30), \"Hello\", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font(\"Dialog\", java.awt.Font.BOLD, 18), java.awt.Color.lightGray)",
- false,
- javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(java.awt.SystemColor.activeCaption,30), "Hello", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Dialog", java.awt.Font.BOLD, 18), java.awt.Color.lightGray));
- }
-}
diff --git a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/CastTest.java b/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/CastTest.java
deleted file mode 100644
index 3e61c468..00000000
--- a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/CastTest.java
+++ /dev/null
@@ -1,79 +0,0 @@
-package org.eclipse.jem.tests.proxy.initParser;
-/*******************************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * $RCSfile: CastTest.java,v $
- * $Revision: 1.3 $ $Date: 2005/02/15 23:00:16 $
- */
-
-/**
- * @author jmyers
- *
- * To change the template for this generated type comment go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-public class CastTest extends AbstractInitParserTestCase {
-
- /**
- * Constructor for CastTest.
- * @param name
- */
- public CastTest(String name) {
- super(name);
- }
-
- public void testIntToFloat() throws Throwable {
- testHelper.testInitString("new Float((float)10)", new Float((float) 10));
- }
- public void testIntToFloatSpace() throws Throwable {
- testHelper.testInitString("new Float( (float) 10 )", new Float((float) 10));
- }
- public void testFloatToFloat() throws Throwable {
- testHelper.testInitString("new Float((float)10.3)", new Float((float) 10.3));
- }
- public void testFloatToFloat2() throws Throwable {
- testHelper.testInitString("new Float((float)5.3)", new Float((float) 5.3));
- }
- public void testFloatToFloatSpace() throws Throwable {
- testHelper.testInitString("new Float( (float) 10.3 )", new Float((float) 10.3));
- }
- public void testNullToString() throws Throwable {
- testHelper.testInitString("(String)null", (String) null);
- }
- public void testStringLiteralToString() throws Throwable {
- testHelper.testInitString("(String)\"hi\"", (String) "hi");
- }
- public void testNullToStringParam() throws Throwable {
- testHelper.testInitString("new javax.swing.JLabel( (String) null)", new javax.swing.JLabel((String) null));
- }
- public void testIntToShort() throws Throwable {
- testHelper.testInitString("(short)10", new Short((short) 10));
- }
- public void testFloatToFloatPrim() throws Throwable {
- testHelper.testInitString("(float)10.3", new Float((float)10.3));
- }
-
- // Casts statements with qualified expression used to fail
- public void testQualifiedStringReturn() throws Throwable {
- testHelper.testInitString("(java.lang.String)org.eclipse.jem.tests.proxy.initParser.NavigationParameters.getReversed(\"Frog\")",(String)org.eclipse.jem.tests.proxy.initParser.NavigationParameters.getReversed("Frog"));
- }
- public void testStringReturn() throws Throwable {
- testHelper.testInitString("(String)org.eclipse.jem.tests.proxy.initParser.NavigationParameters.getReversed(\"Frog\")",(String)org.eclipse.jem.tests.proxy.initParser.NavigationParameters.getReversed("Frog"));
- }
- public void testQualifiedColorReturn() throws Throwable {
- testHelper.testInitString("(java.awt.Color)org.eclipse.jem.tests.proxy.initParser.NavigationParameters.getColor(\"red\")",org.eclipse.jem.tests.proxy.initParser.NavigationParameters.getColor("red"));
- }
-
- public void testCastUpColor() throws Throwable {
- // Test where the method is typed to return Color and we cast to the more generailized subclass of SystemColor
- testHelper.testInitString("(java.awt.SystemColor)org.eclipse.jem.tests.proxy.initParser.NavigationParameters.getColor(\"window\")",org.eclipse.jem.tests.proxy.initParser.NavigationParameters.getColor("window"));
- }
-}
diff --git a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/CharTest.java b/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/CharTest.java
deleted file mode 100644
index 29fe80a2..00000000
--- a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/CharTest.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package org.eclipse.jem.tests.proxy.initParser;
-/*******************************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * $RCSfile: CharTest.java,v $
- * $Revision: 1.3 $ $Date: 2005/02/15 23:00:16 $
- */
-
-/**
- * @author jmyers
- *
- * To change the template for this generated type comment go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-public class CharTest extends AbstractInitParserTestCase {
-
- /**
- * Constructor for CharTest.
- * @param name
- */
- public CharTest(String name) {
- super(name);
- }
-
- public void testChar() throws Throwable {
- testHelper.testInitString("'a'", new Character('a'));
- }
- public void testCharacter() throws Throwable {
- testHelper.testInitString("new Character('a')", new Character('a'));
- }
- public void testDoubleQuote() throws Throwable {
- testHelper.testInitString("'\"'", new Character('\"'));
- }
- public void testSingleQuote() throws Throwable {
- testHelper.testInitString("'\\''", new Character('\''));
- }
- public void testBackslash() throws Throwable {
- testHelper.testInitString("'\\\\'", new Character('\\'));
- }
- public void testCharException() throws Throwable {
- testHelper.testInitString("'asdf'", null, true, true);
- }
-}
diff --git a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/ExceptionTest.java b/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/ExceptionTest.java
deleted file mode 100644
index 12bcf0bf..00000000
--- a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/ExceptionTest.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package org.eclipse.jem.tests.proxy.initParser;
-/*******************************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * $RCSfile: ExceptionTest.java,v $
- * $Revision: 1.3 $ $Date: 2005/02/15 23:00:16 $
- */
-
-/**
- * @author jmyers
- *
- * To change the template for this generated type comment go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-public class ExceptionTest extends AbstractInitParserTestCase {
-
- /**
- * Constructor for ExceptionTest.
- * @param name
- */
- public ExceptionTest(String name) {
- super(name);
- }
-
- public void testTooManyParams() throws Throwable {
- testHelper.testInitString("new Integer(\"3,3\")", null, true, true);
- }
- public void testUnresolvedClass() throws Throwable {
- testHelper.testInitString("new ABCD(4)", null, true, true);
- }
- public void testUnresolvedMethod() throws Throwable {
- testHelper.testInitString("getMethod()",null,true, true);
- }
- public void testUnresolvedLiteral() throws Throwable {
- testHelper.testInitString("unresolvedLiteral",null,true, true);
- }
-}
diff --git a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/InitParserSuite.java b/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/InitParserSuite.java
deleted file mode 100644
index 0bc20d38..00000000
--- a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/InitParserSuite.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jem.tests.proxy.initParser;
-/*
- * $RCSfile: InitParserSuite.java,v $
- * $Revision: 1.6 $ $Date: 2005/02/15 23:00:16 $
- */
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-/**
- * @author jmyers
- *
- * To change the template for this generated type comment go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-public class InitParserSuite extends TestSuite {
-
- // Test cases to be include in the suite
- private static Class testsList[] = {
- NeedsCodingTest.class,
- BlockTest.class,
- ArrayConstructorTest.class,
- MultiArgStaticMethodTest.class,
- MultiArgConstructorTest.class,
- MultiArgInstanceTest.class,
- NumberTest.class,
- CastTest.class,
- ExceptionTest.class,
- LiteralTest.class,
- StringTest.class,
- CharTest.class,
- JFCTest.class,
- BorderTest.class,
- OverloadingTest.class,
- SameName46376Test.class
- } ;
- public static String pkgName = "org.eclipse.jem.tests.proxy.initParser" ;
-
- /**
- * Constructor for PackageSuite.
- */
- public InitParserSuite() {
- super();
- populateSuite() ;
- }
-
- /**
- * Constructor for PackageSuite.
- * @param theClass
- */
- public InitParserSuite(Class theClass) {
- super(theClass);
- populateSuite() ;
- }
-
- /**
- * Constructor for PackageSuite.
- * @param name
- */
- public InitParserSuite(String name) {
- super(name);
- populateSuite() ;
- }
-
- private void populateSuite () {
- for (int i=0; i<testsList.length; i++)
- addTestSuite(testsList[i]) ;
-
- AbstractInitParserTestCase.initSuite(this, new InitStringParserTestHelper(this.getClass().getClassLoader()));
- }
-
- public static Test suite() {
- return new InitParserSuite("Test for: "+pkgName);
- }
-
-}
diff --git a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/InitStringParserTestHelper.java b/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/InitStringParserTestHelper.java
deleted file mode 100644
index 685cb87b..00000000
--- a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/InitStringParserTestHelper.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jem.tests.proxy.initParser;
-/*
- * $RCSfile: InitStringParserTestHelper.java,v $
- * $Revision: 1.5 $ $Date: 2005/02/15 23:00:16 $
- */
-import java.lang.reflect.Array;
-
-import junit.framework.Assert;
-import org.eclipse.jem.internal.proxy.initParser.InitializationStringEvaluationException;
-import org.eclipse.jem.internal.proxy.initParser.InitializationStringParser;
-
-/**
- * @author jmyers
- *
- * To change the template for this generated type comment go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-public class InitStringParserTestHelper extends AbstractInitStringParserTestHelper {
-
- private final ClassLoader classLoader;
-
- public InitStringParserTestHelper() {
- this.classLoader = null;
- }
-
- public InitStringParserTestHelper(ClassLoader classLoader) {
- this.classLoader = classLoader;
- }
-
- /**
- * TestInitializationStringParser constructor comment.
- */
- public void testInitString(String aString, Object expectedResult, boolean throwsException, boolean equalsOnly) throws Throwable {
- // Equals only means accept if == or equals(), don't try to go on and say maybe equal.
-
- try {
- InitializationStringParser parser = InitializationStringParser.createParser(aString, classLoader);
- Object result = parser.evaluate();
- if (throwsException) {
- Assert.fail("It should of thrown an exception. Instead result=" + (result != null ? result.toString() : "null"));
- } else {
- if (result == expectedResult) {
- return;
- } else if (
- (result == null && expectedResult != null) || (expectedResult == null && result != null)) {
- Assert.fail("ExpectedResult=" + expectedResult + " result=" + result);
- } else if (result.equals(expectedResult)) {
- return;
- } else {
- // It may be that the equals expression is bad. If so use the toString() to do a partial comparison
- if (result.getClass() == expectedResult.getClass()) {
- if (result.toString().equals(expectedResult.toString())) {
- return;
- } else {
- // The toStrings do not match perfectly but the classes do.
- // Try and see how close the two strings are
- if ( expectedResult.getClass().isArray() && result.getClass().isArray()){
- Class expectedResultClass = expectedResult.getClass().getComponentType();
- Class resultClass = result.getClass().getComponentType();
- int resultLength = Array.getLength(result);
- int expectedLength = Array.getLength(expectedResult);
- if ( expectedLength == resultLength ){
- if ( resultClass == expectedResultClass ) {
- // TODO Should actually step in and check each element too.
- return;
- } else {
- Assert.fail( aString
- + " ExpectedResult="
- + expectedResult
- + " ActualResult="
- + result
- + " ExpectedClass="
- + expectedResult.getClass()
- + " ActualClass="
- + result.getClass());
- }
- } else {
- Assert.fail( aString
- + " ExpectedResult="
- + expectedResult
- + " ActualResult="
- + result
- + " ExpectedClass="
- + expectedResult.getClass()
- + " ActualClass="
- + result.getClass());
- }
- } else {
- if (equalsOnly)
- Assert.fail( aString
- + " ExpectedResult="
- + expectedResult
- + " ActualResult="
- + result
- + " ExpectedClass="
- + expectedResult.getClass()
- + " ActualClass="
- + result.getClass());
- return;
- }
- }
- } else {
- Assert.fail( aString
- + " ExpectedResult="
- + expectedResult
- + " ActualResult="
- + result
- + " ExpectedClass="
- + expectedResult.getClass()
- + " ActualClass="
- + result.getClass());
- }
- }
- }
- } catch (InitializationStringEvaluationException e) {
- if (throwsException) {
- return;
- } else {
- throw e.getOriginalException();
- }
- }
- }
-
-}
diff --git a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/JFCTest.java b/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/JFCTest.java
deleted file mode 100644
index d89efec2..00000000
--- a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/JFCTest.java
+++ /dev/null
@@ -1,136 +0,0 @@
-package org.eclipse.jem.tests.proxy.initParser;
-/*******************************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * $RCSfile: JFCTest.java,v $
- * $Revision: 1.3 $ $Date: 2005/02/15 23:00:16 $
- */
-
-/**
- * @author jmyers
- *
- * To change the template for this generated type comment go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-public class JFCTest extends AbstractInitParserTestCase {
-
- /**
- * Constructor for JFCTest.
- * @param name
- */
- public JFCTest(String name) {
- super(name);
- }
-
- public void testDimension() throws Throwable {
- testHelper.testInitString("new java.awt.Dimension(1,1)", new java.awt.Dimension(1, 1));
- }
- public void testDimensionNeg() throws Throwable {
- testHelper.testInitString("new java.awt.Dimension(-1,-1)", new java.awt.Dimension(-1, -1));
- }
- public void testColorConstant() throws Throwable {
- testHelper.testInitString("java.awt.Color.cyan", java.awt.Color.cyan);
- }
- public void testColorString() throws Throwable {
- testHelper.testInitString("java.awt.Color.cyan.toString()", java.awt.Color.cyan.toString());
- }
- public void testColorRGB() throws Throwable {
- testHelper.testInitString("new java.awt.Color(10,20,30)", new java.awt.Color(10, 20, 30));
- }
- public void testInteger() throws Throwable {
- testHelper.testInitString("new Integer(50)", new Integer(50));
- }
- public void testIntegerNegative() throws Throwable {
- testHelper.testInitString("new java.lang.Integer(-50)", new Integer(-50));
- }
- public void testShort() throws Throwable {
- testHelper.testInitString("new Short((short)50)", new Short((short)50));
- }
- public void testShortNegative() throws Throwable {
- testHelper.testInitString("new Short((short)-50)", new Short((short)-50));
- }
- public void testLong() throws Throwable {
- testHelper.testInitString("new Long(50L)", new Long(50L));
- }
- public void testLongNegative() throws Throwable {
- testHelper.testInitString("new java.lang.Long(-50L)", new Long(-50L));
- }
- public void testByte() throws Throwable {
- testHelper.testInitString("new Byte((byte)10)", new Byte((byte)10));
- }
- public void testByteNegative() throws Throwable {
- testHelper.testInitString("new Byte((byte)-10)", new Byte((byte)-10));
- }
- public void testFloat() throws Throwable {
-// TODO Need to fix this
-// It just doesn't work w/o java.lang on front. There is a problem with Contructor going closed too early because of the'.' in 3.5,
-// but if you fix that, then (new String("Frog").concat("xyz")).concat(... gets all messed up because it
-// tries to process String().concat() together, and how that should work doesn't work the way it does.
- testHelper.testInitString("new java.lang.Float(10.3F)", new Float(10.3F));
- }
- public void testDouble() throws Throwable {
-// TODO same problem as testFloat. Need java.lang for now.
- testHelper.testInitString("new java.lang.Double(10.3D)", new Double(10.3D));
- }
- public void testIntegerString() throws NumberFormatException, Throwable {
- testHelper.testInitString("new Integer(\"50\")", new Integer("50"));
- }
- public void testFlowLayout() throws Throwable {
- testHelper.testInitString("new java.awt.FlowLayout()", new java.awt.FlowLayout());
- }
- public void testImageIcon() throws Throwable {
- testHelper.testInitString("new javax.swing.ImageIcon( \"C:/WINNT/Zapotec.bmp\")",new javax.swing.ImageIcon( "C:/WINNT/Zapotec.bmp" ));
- }
- public void testRectangle() throws Throwable {
- testHelper.testInitString(
- "new java.awt.Rectangle( 10 , 20 , 30 , 40 )",
- new java.awt.Rectangle(10, 20, 30, 40));
-
- }
- public void testLocale() throws Throwable {
- testHelper.testInitString("new java.util.Locale(\"fr\",\"FR\")", new java.util.Locale("fr", "FR"));
- }
- public void testLocaleVariant() throws Throwable {
- testHelper.testInitString("new java.util.Locale(\"fr\",\"FR\",\"\")", new java.util.Locale("fr", "FR", ""));
- }
- public void testLocaleException() throws Throwable {
- //Locale constructor cannot take null as argument like this: new Java.util.Locale("fr", "FR", null)
- //so this is expected to fail
- testHelper.testInitString("new java.util.Locale(\"fr\",\"FR\",null)", null, true, true);
- }
- public void testDialog() throws Throwable {
- testHelper.testInitString("new java.awt.Dialog(new java.awt.Frame())", false, new java.awt.Dialog(new java.awt.Frame()));
- }
- public void testLength() throws Throwable {
- testHelper.testInitString("new Integer( 50 ).toString().length()", new Integer(new Integer( 50 ).toString().length()));
- }
- public void testSize() throws Throwable {
- testHelper.testInitString("new java.util.ArrayList().size()", new Integer(new java.util.ArrayList().size()));
- }
- public void testCursor() throws Throwable {
- testHelper.testInitString("new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)",new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
- }
- public void testPanel() throws Throwable {
- testHelper.testInitString("new java.awt.Panel(null)", false, new java.awt.Panel(null));
- }
-
- public void testComplexFont() throws Throwable {
- testHelper.testInitString(
- "new java.awt.Font(\"Dialog\", java.awt.Font.BOLD | java.awt.Font.ITALIC, 12)",
- new java.awt.Font("Dialog", java.awt.Font.BOLD | java.awt.Font.ITALIC, 12));
- }
-
- public void testKeyStroke() throws Throwable {
- testHelper.testInitString(
- "javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_H, java.awt.Event.ALT_MASK | java.awt.Event.CTRL_MASK | java.awt.Event.SHIFT_MASK, true)",
- javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_H, java.awt.Event.ALT_MASK | java.awt.Event.CTRL_MASK | java.awt.Event.SHIFT_MASK, true));
- }
-}
diff --git a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/LiteralTest.java b/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/LiteralTest.java
deleted file mode 100644
index 5c7e9325..00000000
--- a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/LiteralTest.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package org.eclipse.jem.tests.proxy.initParser;
-/*******************************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * $RCSfile: LiteralTest.java,v $
- * $Revision: 1.3 $ $Date: 2005/02/15 23:00:16 $
- */
-
-/**
- * @author jmyers
- *
- * To change the template for this generated type comment go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-public class LiteralTest extends AbstractInitParserTestCase {
-
- /**
- * Constructor for LiteralTest.
- * @param name
- */
- public LiteralTest(String name) {
- super(name);
- }
-
- public void testString() throws Throwable {
- testHelper.testInitString("\"Frog\"", "Frog");
- }
- public void testNull() throws Throwable {
- testHelper.testInitString("null", null);
- }
- public void testFalse() throws Throwable {
- testHelper.testInitString("false", Boolean.FALSE);
- }
- public void testTrue() throws Throwable {
- testHelper.testInitString("true", Boolean.TRUE);
- }
- public void testBooleanTrue() throws Throwable {
- testHelper.testInitString("Boolean.TRUE", Boolean.TRUE);
- }
-}
diff --git a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/MultiArgConstructorTest.java b/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/MultiArgConstructorTest.java
deleted file mode 100644
index 1b569ea3..00000000
--- a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/MultiArgConstructorTest.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jem.tests.proxy.initParser;
-/*
- * $RCSfile: MultiArgConstructorTest.java,v $
- * $Revision: 1.5 $ $Date: 2005/02/15 23:00:16 $
- */
-
-/**
- * @author jmyers
- *
- * To change the template for this generated type comment go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-public class MultiArgConstructorTest extends AbstractInitParserTestCase {
-
- /**
- * Constructor for MultiArgConstructorTest.
- * @param name
- */
- public MultiArgConstructorTest(String name) {
- super(name);
- }
-
- public void testTwoBooleans() throws Throwable {
- testHelper.testInitString("new org.eclipse.jem.tests.proxy.initParser.NavigationParameters(false, false)",new org.eclipse.jem.tests.proxy.initParser.NavigationParameters(false,false));
- }
- public void testTwoInts() throws Throwable {
- testHelper.testInitString("new org.eclipse.jem.tests.proxy.initParser.NavigationParameters(12, 24)",new org.eclipse.jem.tests.proxy.initParser.NavigationParameters(12,24));
- }
- public void testThreeFloats() throws Throwable {
- testHelper.testInitString("new org.eclipse.jem.tests.proxy.initParser.NavigationParameters((float)12,(float)24,(float)50)",new org.eclipse.jem.tests.proxy.initParser.NavigationParameters((float)12,(float)24,(float)50));
- }
- public void testTwoDoubles() throws Throwable {
- testHelper.testInitString("new org.eclipse.jem.tests.proxy.initParser.NavigationParameters(12.5d, 24.5d)",new org.eclipse.jem.tests.proxy.initParser.NavigationParameters(12.5d,24.5d));
- }
- public void testTwoStrings() throws Throwable {
- testHelper.testInitString("new org.eclipse.jem.tests.proxy.initParser.NavigationParameters(\"a\", \"b\")",new org.eclipse.jem.tests.proxy.initParser.NavigationParameters("a","b"));
- }
- public void testTwoColors() throws Throwable {
- testHelper.testInitString("new org.eclipse.jem.tests.proxy.initParser.NavigationParameters(java.awt.Color.red, java.awt.Color.red)",new org.eclipse.jem.tests.proxy.initParser.NavigationParameters(java.awt.Color.red,java.awt.Color.red));
- }
- public void testTwoNewColors() throws Throwable {
- testHelper.testInitString("new org.eclipse.jem.tests.proxy.initParser.NavigationParameters(new java.awt.Color(255,0,0), new java.awt.Color(255,0,0))",new org.eclipse.jem.tests.proxy.initParser.NavigationParameters(new java.awt.Color(255,0,0),new java.awt.Color(255,0,0)));
- }
- public void testLots() throws Throwable {
- testHelper.testInitString("new org.eclipse.jem.tests.proxy.initParser.NavigationParameters(\"processor\", 0, \"customerSearchClientOp\", 0, \"2343434\", \"3443234234\", \"depositRepFmt\", \"depositRepFmt\", \"\", \"\", 0, 0, 0, 0, false, false)",new org.eclipse.jem.tests.proxy.initParser.NavigationParameters("processor", 0, "customerSearchClientOp", 0, "2343434", "3443234234", "depositRepFmt", "depositRepFmt", "", "", 0, 0, 0, 0, false, false));
- }
-
-// Testcase for Bugzilla bug #58854 - not yet fixed.
-// public void testNestedNested() throws Throwable {
-// testHelper.testInitString("new org.eclipse.jem.tests.proxy.initParser.NavigationParameters(new java.lang.String(new String(\"s\")), \"a\")",new org.eclipse.jem.tests.proxy.initParser.NavigationParameters(new java.lang.String(new String("s")), "a"));
-// }
-}
diff --git a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/MultiArgInstanceTest.java b/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/MultiArgInstanceTest.java
deleted file mode 100644
index bb9ba529..00000000
--- a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/MultiArgInstanceTest.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package org.eclipse.jem.tests.proxy.initParser;
-/*******************************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * $RCSfile: MultiArgInstanceTest.java,v $
- * $Revision: 1.3 $ $Date: 2005/02/15 23:00:16 $
- */
-
-/**
- * @author jmyers
- *
- * To change the template for this generated type comment go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-public class MultiArgInstanceTest extends AbstractInitParserTestCase {
-
- /**
- * Constructor for MultiArgInstanceTest.
- * @param name
- */
- public MultiArgInstanceTest(String name) {
- super(name);
- }
-
- public void testTwoBooleans() throws Throwable {
- testHelper.testInitString("new org.eclipse.jem.tests.proxy.initParser.NavigationParameters().set(false, false)",new org.eclipse.jem.tests.proxy.initParser.NavigationParameters().set(false,false));
- }
- public void testTwoInts() throws Throwable {
- testHelper.testInitString("new org.eclipse.jem.tests.proxy.initParser.NavigationParameters().set(12, 24)",new org.eclipse.jem.tests.proxy.initParser.NavigationParameters().set(12,24));
- }
- public void testThreeFloats() throws Throwable {
- testHelper.testInitString("new org.eclipse.jem.tests.proxy.initParser.NavigationParameters().set((float)12,(float)24,(float)50)",new org.eclipse.jem.tests.proxy.initParser.NavigationParameters().set((float)12,(float)24,(float)50));
- }
- public void testTwoDoubles() throws Throwable {
- testHelper.testInitString("new org.eclipse.jem.tests.proxy.initParser.NavigationParameters().set(12.5d, 24.5d)",new org.eclipse.jem.tests.proxy.initParser.NavigationParameters().set(12.5d,24.5d));
- }
- public void testTwoStrings() throws Throwable {
- testHelper.testInitString("new org.eclipse.jem.tests.proxy.initParser.NavigationParameters().set(\"a\", \"b\")",new org.eclipse.jem.tests.proxy.initParser.NavigationParameters().set("a","b"));
- }
- public void testTwoColors() throws Throwable {
- testHelper.testInitString("new org.eclipse.jem.tests.proxy.initParser.NavigationParameters().set(java.awt.Color.red, java.awt.Color.red)",new org.eclipse.jem.tests.proxy.initParser.NavigationParameters().set(java.awt.Color.red,java.awt.Color.red));
- }
- public void testTwoNewColors() throws Throwable {
- testHelper.testInitString("new org.eclipse.jem.tests.proxy.initParser.NavigationParameters().set(new java.awt.Color(255,0,0), new java.awt.Color(255,0,0))",new org.eclipse.jem.tests.proxy.initParser.NavigationParameters().set(new java.awt.Color(255,0,0),new java.awt.Color(255,0,0)));
- }
-}
diff --git a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/MultiArgStaticMethodTest.java b/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/MultiArgStaticMethodTest.java
deleted file mode 100644
index 063d662b..00000000
--- a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/MultiArgStaticMethodTest.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package org.eclipse.jem.tests.proxy.initParser;
-/*******************************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * $RCSfile: MultiArgStaticMethodTest.java,v $
- * $Revision: 1.3 $ $Date: 2005/02/15 23:00:16 $
- */
-
-/**
- * @author jmyers
- *
- * To change the template for this generated type comment go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-public class MultiArgStaticMethodTest extends AbstractInitParserTestCase {
-
- /**
- * Constructor for MultiArgStaticMethodTest.
- * @param name
- */
- public MultiArgStaticMethodTest(String name) {
- super(name);
- }
-
- public void testTwoBooleans() throws Throwable {
- testHelper.testInitString("org.eclipse.jem.tests.proxy.initParser.NavigationParameters.get(false, false)",org.eclipse.jem.tests.proxy.initParser.NavigationParameters.get(false,false));
- }
- public void testTwoInts() throws Throwable {
- testHelper.testInitString("org.eclipse.jem.tests.proxy.initParser.NavigationParameters.get(12, 24)",org.eclipse.jem.tests.proxy.initParser.NavigationParameters.get(12,24));
- }
- public void testThreeFloats() throws Throwable {
- testHelper.testInitString("org.eclipse.jem.tests.proxy.initParser.NavigationParameters.get((float)12,(float)24,(float)50)",org.eclipse.jem.tests.proxy.initParser.NavigationParameters.get((float)12,(float)24,(float)50));
- }
- public void testTwoDoubles() throws Throwable {
- testHelper.testInitString("org.eclipse.jem.tests.proxy.initParser.NavigationParameters.get(12.5d, 24.5d)",org.eclipse.jem.tests.proxy.initParser.NavigationParameters.get(12.5d,24.5d));
- }
- public void testTwoStrings() throws Throwable {
- testHelper.testInitString("org.eclipse.jem.tests.proxy.initParser.NavigationParameters.get(\"a\", \"b\")",org.eclipse.jem.tests.proxy.initParser.NavigationParameters.get("a","b"));
- }
- public void testTwoColors() throws Throwable {
- testHelper.testInitString("org.eclipse.jem.tests.proxy.initParser.NavigationParameters.get(java.awt.Color.red, java.awt.Color.red)",org.eclipse.jem.tests.proxy.initParser.NavigationParameters.get(java.awt.Color.red,java.awt.Color.red));
- }
- public void testTwoNewColors() throws Throwable {
- testHelper.testInitString("org.eclipse.jem.tests.proxy.initParser.NavigationParameters.get(new java.awt.Color(255,0,0), new java.awt.Color(255,0,0))",org.eclipse.jem.tests.proxy.initParser.NavigationParameters.get(new java.awt.Color(255,0,0),new java.awt.Color(255,0,0)));
- }
-}
diff --git a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/NavigationParameters.java b/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/NavigationParameters.java
deleted file mode 100644
index 36ab8a92..00000000
--- a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/NavigationParameters.java
+++ /dev/null
@@ -1,238 +0,0 @@
-package org.eclipse.jem.tests.proxy.initParser;
-/*******************************************************************************
- * Copyright (c) 2001, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * $RCSfile: NavigationParameters.java,v $
- * $Revision: 1.2 $ $Date: 2005/02/15 23:00:16 $
- */
-
-import java.io.*;
-import java.lang.reflect.Field;
-import java.util.HashMap;
-import java.util.Map;
-import java.awt.*;
-
-/**
- * Test class for the initStrimg parser - This is there after the Spanish folks found some errors with initStrings
- * that showed up deficiencies where we had methods with multiple arguments and some of the expressions inside the
- * arguments were not being closed correctly. This class is designed to have lots of methods ( constructors and statics
- * and instance methods ) with multiple argument types to test these scenarios, and nice toString() methods so that we can
- * get good hit results on the test succeeding by a perfect toString() match
- */
-public class NavigationParameters implements java.io.Serializable {
- protected int x = Integer.MIN_VALUE;
- protected int y = Integer.MIN_VALUE;
- protected boolean boolA, boolB, boolC;
- protected Color colorA, colorB;
- protected String stringA, stringB, stringC;
- protected double d1 = Double.MIN_VALUE;
- protected double d2 = Double.MIN_VALUE;
- protected float f1 = Float.MIN_VALUE;
- protected float f2 = Float.MIN_VALUE;
- protected float f3 = Float.MIN_VALUE;
- protected int[][] fIntArray;
- protected double[][] fDoubleDoubleArray;
- protected double[] fDoubleArray;
- protected Map fElements;
-
-// The original constructor we broke on - left there for posterity
-public NavigationParameters(String newContextUsed, int newNavigation, String newOperationName, int newChainContext, String newViewName, String newViewSource, String newOutputMapFormat, String newInputMapFormat, String a, String b, int x, int y, int w, int h, boolean useP, boolean useS) {
-}
-public NavigationParameters(){
-}
-public NavigationParameters(int x){
- this.x = x;
- y = 100;
-}
-public NavigationParameters setElemAt(Object aKey, int aValue){
- if ( fElements == null ) {
- fElements = new HashMap(1);
- };
- fElements.put(aKey,new Integer(aValue));
- return this;
-}
-public NavigationParameters(String string1, String string2, String string3, boolean bool1, boolean bool2, boolean bool3, int x){
- stringA = string1;
- stringB = string2;
- stringC = string3;
- boolA = bool1;
- boolB = bool2;
- boolC = bool3;
- this.x = x;
-}
-public NavigationParameters(int[][] intArray){
- fIntArray = intArray;
-}
-public NavigationParameters(double[] doubleArray){
- fDoubleArray = doubleArray;
-}
-// Constructors with different combinations of arguments
-public NavigationParameters(boolean a, boolean b){
- boolA = a;
- boolB = b;
-}
-public NavigationParameters(int x, int y){
- this.x = x;
- this.y = y;
-}
-public NavigationParameters(float f1, float f2, float f3){
- this.f1 = f1;
- this.f2 = f2;
- this.f3 = f3;
-}
-public NavigationParameters(double[][] aDoubleDoubleArray){
- fDoubleDoubleArray = aDoubleDoubleArray;
-}
-public NavigationParameters(double d1, double d2){
- this.d1 = d1;
- this.d2 = d2;
-}
-public NavigationParameters(Color colorA, Color colorB){
- this.colorA = colorA;
- this.colorB = colorB;
-}
-public NavigationParameters(String stringA, String stringB){
- this.stringA = stringA;
- this.stringB = stringB;
-}
-// Static method calls with different combinations of arguments
-public static NavigationParameters get(boolean a, boolean b){
- return new NavigationParameters(a,b);
-}
-public static NavigationParameters get(int x, int y){
- return new NavigationParameters(x,y);
-}
-public static NavigationParameters get(float f1, float f2, float f3){
- return new NavigationParameters(f1,f2,f3);
-}
-public static NavigationParameters get(double d1, double d2){
- return new NavigationParameters(d1,d2);
-}
-public static NavigationParameters get(Color colorA, Color colorB){
- return new NavigationParameters(colorA,colorB);
-}
-public static NavigationParameters get(String stringA, String stringB){
- return new NavigationParameters(stringA,stringB);
-}
-public static Object getReversed(String arg){
- // Return the argument reversed
- StringBuffer buffer = new StringBuffer(arg.length());
- for (int i = arg.length()-1; i >= 0; i--) {
- buffer.append(arg.charAt(i));
- }
- return buffer.toString();
-}
-public static Color getColor(String colorName){
- // Return the colorName to test cast statements
- try {
- Field field = Color.class.getField(colorName);
- return (Color) field.get(Color.class);
- } catch ( NoSuchFieldException exc ) {
- try {
- // It is possible that the field is on SystemColor and not color
- Field field = SystemColor.class.getField(colorName);
- return (Color) field.get(Color.class);
- } catch ( Exception e ) {
- }
- } catch ( Exception exc ) {
- }
- return null;
-}
-// Instance method calls with different combinations of arguments
-public NavigationParameters set(boolean a, boolean b){
- boolA = a;
- boolB = b;
- return this;
-}
-public NavigationParameters set(int x, int y){
- this.x = x;
- this.y = y;
- return this;
-}
-public NavigationParameters set(float f1, float f2, float f3){
- this.f1 = f1;
- this.f2 = f2;
- this.f3 = f3;
- return this;
-}
-public NavigationParameters set(double d1, double d2){
- this.d1 = d1;
- this.d2 = d2;
- return this;
-}
-public NavigationParameters set(Color colorA, Color colorB){
- this.colorA = colorA;
- this.colorB = colorB;
- return this;
-}
-public NavigationParameters set(String stringA, String stringB){
- this.stringA = stringA;
- this.stringB = stringB;
- return this;
-}
-// To string method to help the tests be OK? with matching toString() results
-public String toString(){
- StringWriter writer = new StringWriter();
- writer.write("NavigationParameters(");
- if ( x != Integer.MIN_VALUE ) writer.write(new Integer(x).toString());
- if ( y != Integer.MIN_VALUE ) writer.write(new Integer(y).toString());
- writer.write("boolA=" + boolA);
- writer.write("boolA=" + boolB);
- writer.write("boolA=" + boolA);
- writer.write("boolC=" + boolC);
- if ( colorA != null ) writer.write("colorA=" + colorA);
- if ( colorB != null ) writer.write("colorB=" + colorB);
- if ( stringA != null ) writer.write("stringA=" + stringA);
- if ( stringB != null ) writer.write("stringB=" + stringB);
- if ( stringC != null ) writer.write("stringB=" + stringC);
- if ( d1 != Double.MIN_VALUE ) writer.write("d1=" + d1);
- if ( d2 != Double.MIN_VALUE ) writer.write("d1=" + d2);
- if ( f1 != Float.MIN_VALUE ) writer.write("f1=" + f1);
- if ( f2 != Float.MIN_VALUE ) writer.write("f2=" + f2);
- if ( f2 != Float.MIN_VALUE ) writer.write("f3=" + f3);
- if ( fIntArray != null ) {
- writer.write("int array=");
- for (int i = 0; i < fIntArray.length; i++) {
- writer.write("[");
- // The elements in the array are themselves arrays - it is two dimensional
- int[] elements = fIntArray[i];
- for (int j = 0; j < elements.length; j++) {
- writer.write(new Integer(elements[j]).toString());
- }
- writer.write("]");
- }
- }
- if ( fDoubleDoubleArray != null ) {
- writer.write("doubledouble array=");
- for (int i = 0; i < fDoubleDoubleArray.length; i++) {
- writer.write("[");
- // The elements in the array are themselves arrays - it is two dimensional
- double[] elements = fDoubleDoubleArray[i];
- for (int j = 0; j < elements.length; j++) {
- writer.write(new Double(elements[j]).toString());
- }
- writer.write("]");
- }
- }
-
- if ( fDoubleArray != null ) {
- writer.write("double array=");
- for (int i = 0; i < fDoubleArray.length; i++) {
- writer.write("(");
- writer.write(new Double(fDoubleArray[i]).toString());
- writer.write(")");
- }
- }
- writer.write(")");
- return writer.toString();
-}
-
-}
diff --git a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/NeedsCodingTest.java b/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/NeedsCodingTest.java
deleted file mode 100644
index 6707c776..00000000
--- a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/NeedsCodingTest.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package org.eclipse.jem.tests.proxy.initParser;
-/*******************************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * $RCSfile: NeedsCodingTest.java,v $
- * $Revision: 1.3 $ $Date: 2005/02/15 23:00:16 $
- */
-
-/**
- * @author jmyers
- *
- * To change the template for this generated type comment go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-public class NeedsCodingTest extends AbstractInitParserTestCase {
-
- /**
- * Constructor for NeedsCodingTest.
- * @param name
- */
- public NeedsCodingTest(String name) {
- super(name);
- }
-
- // TODO: enable this test when math works
- /*
- public void testMath() {
- // Doing math is not coded yet. We don't expect to encounter any strings like this as part of GA
- testHelper.testInitString("10 + 20", new Integer(10 + 20));
- }
- */
-
- public void testInnerClasses() throws Throwable {
- // Inner classes need coding but we have a test to make sure we throw an explicit exception
- testHelper.testInitString("new javax.swing.table.DefaultTableModel(){}",new javax.swing.table.DefaultTableModel(){},true, true);
- }
- public void testParamsThreeFloats() throws Throwable {
- testHelper.testInitString("org.eclipse.jem.tests.proxy.initParser.NavigationParameters.get((float)12,(float)24,(float)50)",org.eclipse.jem.tests.proxy.initParser.NavigationParameters.get((float)12,(float)24,(float)50));
- }
- public void testConstructThreeFloats() throws Throwable {
- testHelper.testInitString("new org.eclipse.jem.tests.proxy.initParser.NavigationParameters((float)12,(float)24,(float)50)",new org.eclipse.jem.tests.proxy.initParser.NavigationParameters((float)12,(float)24,(float)50));
- }
- public void testNewParamsThreeFloats() throws Throwable {
- testHelper.testInitString("new org.eclipse.jem.tests.proxy.initParser.NavigationParameters().set((float)12,(float)24,(float)50)",new org.eclipse.jem.tests.proxy.initParser.NavigationParameters().set((float)12,(float)24,(float)50));
- }
-}
diff --git a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/NumberTest.java b/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/NumberTest.java
deleted file mode 100644
index 1b7703e7..00000000
--- a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/NumberTest.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package org.eclipse.jem.tests.proxy.initParser;
-/*******************************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * $RCSfile: NumberTest.java,v $
- * $Revision: 1.3 $ $Date: 2005/02/15 23:00:16 $
- */
-
-/**
- * @author jmyers
- *
- * To change the template for this generated type comment go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-public class NumberTest extends AbstractInitParserTestCase {
-
- /**
- * Constructor for NumberTest.
- * @param name
- */
- public NumberTest(String name) {
- super(name);
- }
-
- public void testIntPrim() throws Throwable {
- testHelper.testInitString("10", new Integer(10));
- }
- public void testShortPrim() throws Throwable {
- testHelper.testInitString("(short)10", new Short((short)10));
- }
- public void testNegativeShortPrim() throws Throwable {
- testHelper.testInitString("(short)-10", new Short((short)-10));
- }
- public void testBytePrim() throws Throwable {
- testHelper.testInitString("(byte)10", new Byte((byte)10));
- }
- public void testDoublePrimExplicit() throws Throwable {
- testHelper.testInitString("10d", new Double(10d));
- }
- public void testNegativeDoublePrimExplicit() throws Throwable {
- testHelper.testInitString("-10d", new Double(-10d));
- }
- public void testFloatPrimExplicit() throws Throwable {
- testHelper.testInitString("10f", new Float(10f));
- }
- public void testLongPrimExplicit() throws Throwable {
- testHelper.testInitString("10l", new Long(10l));
- }
- public void testDoublePrimImplicit() throws Throwable {
- testHelper.testInitString("10.75", new Double(10.75));
- }
- public void testNegativeDoublePrimImplicit() throws Throwable {
- testHelper.testInitString("-10.75", new Double(-10.75));
- }
- public void testSpacedDoublePrimImplicit() throws Throwable {
- testHelper.testInitString(" 10.75 ", new Double(10.75));
- }
- public void testNegativeDoublePrimExplicit2() throws Throwable {
- testHelper.testInitString("-10.75d", new Double(-10.75d));
- }
-}
diff --git a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/OverloadingTest.java b/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/OverloadingTest.java
deleted file mode 100644
index 23e04970..00000000
--- a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/OverloadingTest.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jem.tests.proxy.initParser;
-/*
- * $RCSfile: OverloadingTest.java,v $
- * $Revision: 1.6 $ $Date: 2005/02/15 23:00:16 $
- */
-
-/**
- * Test that correct overloaded method is called.
- * @author jmyers
- *
- * To change the template for this generated type comment go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-public class OverloadingTest extends AbstractInitParserTestCase {
-
- /**
- * Constructor for OverloadingTest.
- * @param name
- */
- public OverloadingTest(String name) {
- super(name);
- }
-
- public void testOverloadString() throws Throwable {
- testHelper.testInitString("new Integer(\"3\")", new Integer(3));
- }
- public void testOverloadShort() throws Throwable {
- testHelper.testInitString("new Integer(5)", new Integer(5));
- }
-}
diff --git a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/SameName46376Test.java b/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/SameName46376Test.java
deleted file mode 100644
index 9d3795af..00000000
--- a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/SameName46376Test.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package org.eclipse.jem.tests.proxy.initParser;
-/*******************************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * $RCSfile: SameName46376Test.java,v $
- * $Revision: 1.2 $ $Date: 2005/02/15 23:00:16 $
- */
-
-/**
- * This is to test for defect [46376].
- *
- * SameName test. This is test where you have this:
- * InitParserTest46376.SameNameTestClass.java
- * InitParserTest46376.java
- *
- * and
- *
- * new org.eclipse.jem.tests.proxy.initParser.SameNameTestClass.RealClass()
- *
- * Before [46376] the Static parser would find SameNameTestClass.java instead of the RealClass and would of failed.
- * To compile in Eclipse we need to have one of the classes be in the default package. Eclipse complains if we didn't.
- * But there is nothing to stop this from happening with packages too if they are spread across compile groups.
- */
-public class SameName46376Test extends AbstractInitParserTestCase {
-
- public SameName46376Test(String name) {
- super(name);
- }
-
- public void test46376() throws Throwable {
- testHelper.testInitString("new initParserTest46376.SameNameTestClass()", new initParserTest46376.SameNameTestClass());
- }
-}
diff --git a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/StringTest.java b/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/StringTest.java
deleted file mode 100644
index 4ee0185d..00000000
--- a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/StringTest.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jem.tests.proxy.initParser;
-/*
- * $RCSfile: StringTest.java,v $
- * $Revision: 1.5 $ $Date: 2005/02/15 23:00:16 $
- */
-
-/**
- * @author jmyers
- *
- * To change the template for this generated type comment go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-public class StringTest extends AbstractInitParserTestCase {
-
- /**
- * Constructor for StringTest.
- * @param name
- */
- public StringTest(String name) {
- super(name);
- }
-
- public void testBasic() throws Throwable {
- testHelper.testInitString("\"Frog/123\"", "Frog/123");
- }
- public void testIntValue() throws Throwable {
- testHelper.testInitString("String.valueOf(10)", "10");
- }
- public void testParens() throws Throwable {
- testHelper.testInitString("\"Frog(123)prince\"", "Frog(123)prince");
- }
- public void testDoubleQuotes() throws Throwable {
- testHelper.testInitString("\"Frog\\\"prince\\\"123\"", "Frog\"prince\"123");
- }
- public void testBackSlashes() throws Throwable {
- testHelper.testInitString("\"Frog\\\\prince\\\\123\"", "Frog\\prince\\123");
- }
- public void testBackSlash() throws Throwable {
- testHelper.testInitString("\"\\\\Frog\"", "\\Frog");
- }
- public void testStringFunction() throws Throwable {
- testHelper.testInitString("\"Frog\".length()", new Integer(4));
- }
-}
diff --git a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/tree/ASTArraysTest.java b/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/tree/ASTArraysTest.java
deleted file mode 100644
index 9c8f9fcf..00000000
--- a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/tree/ASTArraysTest.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * $RCSfile: ASTArraysTest.java,v $
- * $Revision: 1.3 $ $Date: 2005/02/15 23:00:16 $
- */
-package org.eclipse.jem.tests.proxy.initParser.tree;
-
-import org.eclipse.jem.internal.proxy.core.IExpression;
-import org.eclipse.jem.tests.proxy.initParser.ArrayConstructorTest;
-
-/**
- * Test Arrays for AST.
- *
- * @since 1.0.0
- */
-public class ASTArraysTest extends ArrayConstructorTest {
-
- public ASTArraysTest(String name) {
- super(name);
- }
-
- protected ASTTreeInitStringParserTestHelper getTreeParser() {
- return (ASTTreeInitStringParserTestHelper) testHelper;
- }
-
- public void testUndefinedSecondDim() throws Throwable {
- IExpression exp = getTreeParser().getRegistry().getBeanProxyFactory().createExpression();
- exp.createArrayCreation(IExpression.ROOTEXPRESSION, "int[][]", 1);
- exp.createPrimitiveLiteral(IExpression.ARRAYCREATION_DIMENSION, 3);
- testHelper.testInitString("new int[3][]", exp.getExpressionValue());
- }
-
- public void testArrayAccess() throws Throwable {
- IExpression exp = getTreeParser().getRegistry().getBeanProxyFactory().createExpression();
- exp.createArrayAccess(IExpression.ROOTEXPRESSION, 1);
- exp.createArrayCreation(IExpression.ARRAYACCESS_ARRAY, "java.lang.Integer[]", 1);
- exp.createPrimitiveLiteral(IExpression.ARRAYCREATION_DIMENSION, 3);
- exp.createPrimitiveLiteral(IExpression.ARRAYACCESS_INDEX, 0);
- testHelper.testInitString("(new Integer[3])[0]", exp.getExpressionValue());
- }
-
- public void testMutltiArrayAccess() throws Throwable {
- IExpression exp = getTreeParser().getRegistry().getBeanProxyFactory().createExpression();
- exp.createArrayAccess(IExpression.ROOTEXPRESSION, 2);
- exp.createArrayCreation(IExpression.ARRAYACCESS_ARRAY, "int[][]", 0);
- exp.createArrayInitializer(2);
- exp.createArrayInitializer(1);
- exp.createPrimitiveLiteral(IExpression.ARRAYINITIALIZER_EXPRESSION, 2);
- exp.createArrayInitializer(1);
- exp.createPrimitiveLiteral(IExpression.ARRAYINITIALIZER_EXPRESSION, 4);
- exp.createPrimitiveLiteral(IExpression.ARRAYACCESS_INDEX, 0);
- exp.createPrimitiveLiteral(IExpression.ARRAYACCESS_INDEX, 0);
- testHelper.testInitString("(new int[][] {{2}, {4}})[0][0]", exp.getExpressionValue());
- }
-}
diff --git a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/tree/ASTFieldAccessTest.java b/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/tree/ASTFieldAccessTest.java
deleted file mode 100644
index df42115b..00000000
--- a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/tree/ASTFieldAccessTest.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * $RCSfile: ASTFieldAccessTest.java,v $
- * $Revision: 1.3 $ $Date: 2005/02/15 23:00:16 $
- */
-package org.eclipse.jem.tests.proxy.initParser.tree;
-
-import org.eclipse.jem.internal.proxy.core.IExpression;
-import org.eclipse.jem.tests.proxy.initParser.AbstractInitParserTestCase;
-
-/**
- *
- * @since 1.0.0
- */
-public class ASTFieldAccessTest extends AbstractInitParserTestCase {
-
- /**
- * Create with name.
- * @param name
- *
- * @since 1.0.0
- */
- public ASTFieldAccessTest(String name) {
- super(name);
- }
-
- protected ASTTreeInitStringParserTestHelper getTreeParser() {
- return (ASTTreeInitStringParserTestHelper) testHelper;
- }
-
- public void testNonQualifiedFieldAccess() throws Throwable {
- getTreeParser().testInitString("Color.red", new String[] {"java.awt.*"}, getTreeParser().getRegistry().getBeanTypeProxyFactory().getBeanTypeProxy("java.awt.Color").newInstance("java.awt.Color.red") );
- }
-
- public void testExpressionFieldAccess() throws Throwable {
- getTreeParser().testInitString("(Color.red).red", new String[] {"java.awt.*"}, getTreeParser().getRegistry().getBeanTypeProxyFactory().getBeanTypeProxy("java.awt.Color").newInstance("java.awt.Color.red") ); // Should not use this form, but it is valid, use valid form for expected results so no warnings.
- }
-
- public void testNestedFieldAccess() throws Throwable {
- getTreeParser().testInitString("ASTNestFieldAccessTestData.acolor.red", new String[] {"org.eclipse.jem.tests.proxy.initParser.tree.ASTNestFieldAccessTestData"}, getTreeParser().getRegistry().getBeanTypeProxyFactory().getBeanTypeProxy("java.awt.Color").newInstance("java.awt.Color.red")); // Should not use this form, but it is valid, use valid form for expected results so no warnings.
- }
-
- public void testNestedFieldExpressionAccess() throws Throwable {
- getTreeParser().testInitString("new ASTNestFieldAccessTestData().acolor.red", new String[] {"org.eclipse.jem.tests.proxy.initParser.tree.ASTNestFieldAccessTestData"}, getTreeParser().getRegistry().getBeanTypeProxyFactory().getBeanTypeProxy("java.awt.Color").newInstance("java.awt.Color.red")); // Should not use this form, but it is valid, use valid form for expected results so no warnings.
- }
-
- public void testNonstaticFieldAccess() throws Throwable {
- IExpression exp = getTreeParser().getRegistry().getBeanProxyFactory().createExpression();
- exp.createFieldAccess(IExpression.ROOTEXPRESSION, "arect", true);
- exp.createClassInstanceCreation(IExpression.FIELD_RECEIVER, "org.eclipse.jem.tests.proxy.initParser.tree.ASTNestFieldAccessTestData", 0);
- getTreeParser().testInitString("new ASTNestFieldAccessTestData().arect", new String[] {"org.eclipse.jem.tests.proxy.initParser.tree.ASTNestFieldAccessTestData"}, exp.getExpressionValue());
- }
-
- public void testNonstaticNestedFieldAccess() throws Throwable {
- IExpression exp = getTreeParser().getRegistry().getBeanProxyFactory().createExpression();
- exp.createFieldAccess(IExpression.ROOTEXPRESSION, "x", true);
- exp.createFieldAccess(IExpression.FIELD_RECEIVER, "arect", true);
- exp.createClassInstanceCreation(IExpression.FIELD_RECEIVER, "org.eclipse.jem.tests.proxy.initParser.tree.ASTNestFieldAccessTestData", 0);
- getTreeParser().testInitString("new ASTNestFieldAccessTestData().arect.x", new String[] {"org.eclipse.jem.tests.proxy.initParser.tree.ASTNestFieldAccessTestData"}, exp.getExpressionValue());
- }
-
-}
diff --git a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/tree/ASTInnerClassAccessTest.java b/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/tree/ASTInnerClassAccessTest.java
deleted file mode 100644
index fd68ef82..00000000
--- a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/tree/ASTInnerClassAccessTest.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * $RCSfile: ASTInnerClassAccessTest.java,v $
- * $Revision: 1.3 $ $Date: 2005/02/15 23:00:16 $
- */
-package org.eclipse.jem.tests.proxy.initParser.tree;
-
-import org.eclipse.jem.internal.proxy.core.IExpression;
-import org.eclipse.jem.tests.proxy.initParser.AbstractInitParserTestCase;
-
-/**
- * This is for testing inner class access.
- * @since 1.0.0
- */
-public class ASTInnerClassAccessTest extends AbstractInitParserTestCase {
-
- /**
- * Construct with name.
- * @param name
- *
- * @since 1.0.0
- */
- public ASTInnerClassAccessTest(String name) {
- super(name);
- }
-
- protected ASTTreeInitStringParserTestHelper getTreeParser() {
- return (ASTTreeInitStringParserTestHelper) testHelper;
- }
-
- public void testInnerFieldAccess() throws Throwable {
- IExpression exp = getTreeParser().getRegistry().getBeanProxyFactory().createExpression();
- exp.createFieldAccess(IExpression.ROOTEXPRESSION, "GREEN", true);
- exp.createTypeReceiver("org.eclipse.jem.tests.proxy.initParser.tree.InnerClassTestData$InnerInnerClass");
- getTreeParser().testInitString("InnerClassTestData.InnerInnerClass.GREEN", new String[] {"org.eclipse.jem.tests.proxy.initParser.tree.*"}, exp.getExpressionValue());
- }
-
- public void testInnerFieldAccess2() throws Throwable {
- IExpression exp = getTreeParser().getRegistry().getBeanProxyFactory().createExpression();
- exp.createFieldAccess(IExpression.ROOTEXPRESSION, "GREEN", true);
- exp.createTypeReceiver("org.eclipse.jem.tests.proxy.initParser.tree.InnerClassTestData$InnerInnerClass");
-
- // Test where the inner class is the top level listed.
- getTreeParser().testInitString("InnerInnerClass.GREEN", new String[] {"org.eclipse.jem.tests.proxy.initParser.tree.InnerClassTestData.InnerInnerClass"}, exp.getExpressionValue());
- }
-
- public void testInnerInnerFieldAccess() throws Throwable {
- IExpression exp = getTreeParser().getRegistry().getBeanProxyFactory().createExpression();
- exp.createFieldAccess(IExpression.ROOTEXPRESSION, "RED", true);
- exp.createTypeReceiver("org.eclipse.jem.tests.proxy.initParser.tree.InnerClassTestData$InnerInnerClass$InnerInnerInnerClass");
-
- getTreeParser().testInitString("InnerClassTestData.InnerInnerClass.InnerInnerInnerClass.RED", new String[] {"org.eclipse.jem.tests.proxy.initParser.tree.*"}, exp.getExpressionValue());
- }
-
- public void testInnerClassCreation() throws Throwable {
- IExpression exp = getTreeParser().getRegistry().getBeanProxyFactory().createExpression();
- exp.createClassInstanceCreation(IExpression.ROOTEXPRESSION, "org.eclipse.jem.tests.proxy.initParser.tree.InnerClassTestData$InnerInnerClass", 0);
- // Create static inner class
- getTreeParser().testInitString("new InnerClassTestData.InnerInnerClass()", new String[] {"org.eclipse.jem.tests.proxy.initParser.tree.*"}, exp.getExpressionValue());
- }
-
-}
diff --git a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/tree/ASTMiscTest.java b/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/tree/ASTMiscTest.java
deleted file mode 100644
index 30647b39..00000000
--- a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/tree/ASTMiscTest.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * $RCSfile: ASTMiscTest.java,v $
- * $Revision: 1.2 $ $Date: 2005/02/15 23:00:16 $
- */
-package org.eclipse.jem.tests.proxy.initParser.tree;
-
-import org.eclipse.jem.internal.instantiation.*;
-import org.eclipse.jem.internal.instantiation.InstantiationFactory;
-import org.eclipse.jem.internal.instantiation.PTCharacterLiteral;
-import org.eclipse.jem.tests.proxy.initParser.AbstractInitParserTestCase;
-
-/**
- * Some misc. tests.
- * @since 1.0.0
- */
-public class ASTMiscTest extends AbstractInitParserTestCase {
-
- /**
- * Construct with name.
- * @param name
- *
- * @since 1.0.0
- */
- public ASTMiscTest(String name) {
- super(name);
- }
-
- public void testCharLiteral() {
- PTCharacterLiteral cl = InstantiationFactory.eINSTANCE.createPTCharacterLiteral();
- cl.setEscapedValue("\'a\'");
- assertEquals('a', cl.getCharValue());
- cl.setCharValue('b');
- assertEquals("\'b\'", cl.getEscapedValue());
- cl.setEscapedValue("\'\\n\'");
- assertEquals('\n', cl.getCharValue());
- cl.setCharValue('\b');
- assertEquals("\'\\b\'", cl.getEscapedValue());
- cl.setEscapedValue("\'\\u0300\'");
- assertEquals('\u0300', cl.getCharValue());
- cl.setCharValue('\u0400');
- assertEquals("\'\\u0400\'", cl.getEscapedValue());
- }
-
- public void testStringLiteral() {
- PTStringLiteral sl = InstantiationFactory.eINSTANCE.createPTStringLiteral();
- sl.setEscapedValue("\"a\"");
- assertEquals("a", sl.getLiteralValue());
- sl.setLiteralValue("\b");
- assertEquals("\"\\b\"", sl.getEscapedValue());
- sl.setEscapedValue("\"\\n\"");
- assertEquals("\n", sl.getLiteralValue());
- sl.setLiteralValue("\b");
- assertEquals("\"\\b\"", sl.getEscapedValue());
- sl.setEscapedValue("\"\\u0300\"");
- assertEquals("\u0300", sl.getLiteralValue());
- sl.setLiteralValue("\u0400");
- assertEquals("\"\\u0400\"", sl.getEscapedValue());
- }
-
-}
diff --git a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/tree/ASTNestFieldAccessTestData.java b/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/tree/ASTNestFieldAccessTestData.java
deleted file mode 100644
index 9bede080..00000000
--- a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/tree/ASTNestFieldAccessTestData.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package org.eclipse.jem.tests.proxy.initParser.tree;
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * $RCSfile: ASTNestFieldAccessTestData.java,v $
- * $Revision: 1.2 $ $Date: 2005/02/15 23:00:16 $
- */
-
-import java.awt.Color;
-import java.awt.Rectangle;
-
-/**
- * This class is used in the testing of nested field access for Parse testing.
- * This is when you access a field, and then access a field of that.
- * In this case <code>ASTNestFieldAccessTestData.acolor.red</code>
- * @since 1.0.0
- */
-public class ASTNestFieldAccessTestData {
- public static Color acolor = Color.green;
- public Rectangle arect = new Rectangle(10,20,30,40);
-}
diff --git a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/tree/ASTOperationsTest.java b/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/tree/ASTOperationsTest.java
deleted file mode 100644
index 7e54cc33..00000000
--- a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/tree/ASTOperationsTest.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * $RCSfile: ASTOperationsTest.java,v $
- * $Revision: 1.3 $ $Date: 2005/02/15 23:00:16 $
- */
-package org.eclipse.jem.tests.proxy.initParser.tree;
-
-import org.eclipse.jem.tests.proxy.initParser.AbstractInitParserTestCase;
-
-/**
- *
- * @since 1.0.0
- */
-public class ASTOperationsTest extends AbstractInitParserTestCase {
-
- /**
- * Create with name.
- * @param name
- *
- * @since 1.0.0
- */
- public ASTOperationsTest(String name) {
- super(name);
- }
-
- protected ASTTreeInitStringParserTestHelper getTreeParser() {
- return (ASTTreeInitStringParserTestHelper) testHelper;
- }
-
- public void testTwoOpers() throws Throwable {
- testHelper.testInitString("3+4", getTreeParser().getRegistry().getBeanProxyFactory().createBeanProxyWith(3+4));
- }
-
- public void testFourOpersExtended() throws Throwable {
- testHelper.testInitString("3+4+5+6", getTreeParser().getRegistry().getBeanProxyFactory().createBeanProxyWith(3+4+5+6));
- }
-
- public void testMixedOpers() throws Throwable {
- testHelper.testInitString("3+4-5", getTreeParser().getRegistry().getBeanProxyFactory().createBeanProxyWith(3+4-5));
- }
-
- public void testMixedOpersPrecedence() throws Throwable {
- testHelper.testInitString("6 | 3+4 | 8", getTreeParser().getRegistry().getBeanProxyFactory().createBeanProxyWith(6 | 3+4 | 8));
- }
-
- public void testConditional() throws Throwable {
- testHelper.testInitString("java.awt.Color.red != null ? 3 : 5", getTreeParser().getRegistry().getBeanProxyFactory().createBeanProxyWith(java.awt.Color.red != null ? 3 : 5));
- }
-
- public void testInstanceof() throws Throwable {
- testHelper.testInitString("java.awt.Color.red instanceof java.awt.Color", getTreeParser().getRegistry().getBeanProxyFactory().createBeanProxyWith(java.awt.Color.red instanceof java.awt.Color));
- }
-
- public void testTypeLiteral() throws Throwable {
- testHelper.testInitString("Object.class", getTreeParser().getRegistry().getBeanTypeProxyFactory().getBeanTypeProxy("java.lang.Object"));
- }
-
- public void testStringPlusOperations() throws Throwable {
- testHelper.testInitString("3+\"a\"", getTreeParser().getRegistry().getBeanProxyFactory().createBeanProxyWith(3+"a"));
- }
-
- public void testStringPlusOperations1() throws Throwable {
- testHelper.testInitString("\"a\"+3", getTreeParser().getRegistry().getBeanProxyFactory().createBeanProxyWith("a"+3));
- }
-
- public void testStringPlusExtendedOperations() throws Throwable {
- testHelper.testInitString("3+4+\"a\"", getTreeParser().getRegistry().getBeanProxyFactory().createBeanProxyWith(3+4+"a"));
- }
-
- public void testStringPlusExtendedOperations1() throws Throwable {
- testHelper.testInitString("3+\"a\"+4", getTreeParser().getRegistry().getBeanProxyFactory().createBeanProxyWith(3+"a"+4));
- }
-
-
-}
diff --git a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/tree/ASTParserSuite.java b/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/tree/ASTParserSuite.java
deleted file mode 100644
index 4c47aaa8..00000000
--- a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/tree/ASTParserSuite.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jem.tests.proxy.initParser.tree;
-/*
- * $RCSfile: ASTParserSuite.java,v $
- * $Revision: 1.8 $ $Date: 2005/02/15 23:00:16 $
- */
-import junit.extensions.TestSetup;
-import junit.framework.*;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaCore;
-
-import org.eclipse.jem.internal.proxy.core.*;
-import org.eclipse.jem.tests.JavaProjectUtil;
-import org.eclipse.jem.tests.JavaTestsPlugin;
-import org.eclipse.jem.tests.proxy.ProxySuite;
-import org.eclipse.jem.tests.proxy.initParser.*;
-
-/**
- * @author jmyers
- *
- * To change the template for this generated type comment go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-public class ASTParserSuite extends TestSetup {
-
- // Test cases to be include in the suite
- private static Class testsList[] = {
- NeedsCodingTest.class,
- BlockTest.class,
- ASTFieldAccessTest.class,
- ASTArraysTest.class,
- MultiArgStaticMethodTest.class,
- MultiArgConstructorTest.class,
- MultiArgInstanceTest.class,
- NumberTest.class,
- CastTest.class,
-// ExceptionTest.class, // mixes parse error w/execution errors. Can't test parse errors. Need specific test for exec errors like method not found.
- LiteralTest.class,
- StringTest.class,
- CharTest.class,
- JFCTest.class,
- BorderTest.class,
- OverloadingTest.class,
- SameName46376Test.class,
- ASTOperationsTest.class,
- ASTInnerClassAccessTest.class,
- ASTMiscTest.class
- } ;
-
- public static String pkgName = "org.eclipse.jem.tests.proxy.initParser.tree" ;
-
- /**
- * Constructor for PackageSuite.
- */
- public ASTParserSuite() {
- this("AST Parser Suite");
- }
-
- /**
- * Constructor for PackageSuite.
- * @param name
- */
- public ASTParserSuite(String name) {
- super(new TestSuite(name));
- populateSuite() ;
- }
-
- ProxyFactoryRegistry registry;
-
- private void populateSuite () {
- TestSuite suite = (TestSuite) getTest();
- for (int i=0; i<testsList.length; i++)
- suite.addTestSuite(testsList[i]) ;
-
- try {
- IProject project = JavaProjectUtil.createEmptyJavaProject(ResourcesPlugin.getWorkspace(), new Path(AST_PROJECT), null);
- IJavaProject jproject = JavaCore.create(project);
- // Add javatests.jar (i.e. this plugins jar) so that the classes within the tests jar are available
- // to the jdt parser for referencing.
- JavaProjectUtil.addBundleJarToPath(JavaTestsPlugin.getPlugin().getBundle(), "javatests.jar", jproject, null);
-
- // We're going to use the remote proxy, because it is easier to start up, but we aren't really testing
- // the remote proxy expression evaluation. We are really testing AST->ParseTree->BeanProxy. If any expression
- // type errors show up (i.e. the proxy expression itself is not working correctly). Then that should be fixed
- // and a junit test in the proxy suite should be created instead.
- registry = ProxyLaunchSupport.startImplementation(
- project,
- "JUnit Parse Tree Test",
- new IConfigurationContributor[] { ProxySuite.getProxySuiteContributor()},
- new NullProgressMonitor());
-
- AbstractInitParserTestCase.initSuite(suite, new ASTTreeInitStringParserTestHelper(project, registry));
- } catch (CoreException e) {
- Assert.assertNotNull(e);
- }
- }
-
- public static Test suite() {
- return new ASTParserSuite("Test for: "+pkgName);
- }
-
- private static final String AST_PROJECT = "/AST tests/";
-
- /* (non-Javadoc)
- * @see junit.extensions.TestSetup#tearDown()
- */
- protected void tearDown() throws Exception {
- if (registry != null) {
- registry.terminateRegistry();
- Thread.sleep(5000); // Give it five seconds to REALLY go away. There is a small window between
- // terminate request and true shutdown of the remote vm. We return immediately and let a
- // job wait for the actual true termination.
- }
-
- JavaProjectUtil.deleteProject(JavaProjectUtil.getProject(AST_PROJECT));
- }
-
-}
diff --git a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/tree/ASTTreeInitStringParserTestHelper.java b/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/tree/ASTTreeInitStringParserTestHelper.java
deleted file mode 100644
index 5e9eb53c..00000000
--- a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/tree/ASTTreeInitStringParserTestHelper.java
+++ /dev/null
@@ -1,238 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * $RCSfile: ASTTreeInitStringParserTestHelper.java,v $
- * $Revision: 1.10 $ $Date: 2005/02/15 23:00:16 $
- */
-package org.eclipse.jem.tests.proxy.initParser.tree;
-
-import java.text.MessageFormat;
-
-import junit.framework.Assert;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jdt.core.*;
-import org.eclipse.jdt.core.compiler.IProblem;
-import org.eclipse.jdt.core.dom.*;
-
-import org.eclipse.jem.internal.instantiation.PTExpression;
-import org.eclipse.jem.internal.instantiation.base.*;
-import org.eclipse.jem.internal.proxy.core.*;
-import org.eclipse.jem.tests.proxy.initParser.AbstractInitStringParserTestHelper;
-import org.eclipse.jem.workbench.utility.*;
-
-/**
- * Init String parser helper for working with AST trees.
- *
- * @since 1.0.0
- */
-public class ASTTreeInitStringParserTestHelper extends AbstractInitStringParserTestHelper {
-
- private static final String TEMPLATE_CLASS = "public class TEMPLATE '{'\n public void test() '{'\n String.valueOf({0});\t// a line comment\n }\n}";
- private static final String TEMPLATE_CLASS_IMPORTS = "{0}\npublic class TEMPLATE '{'\n public void test() '{'\n String.valueOf({1});\n }\n}";
-
- private IJavaProject project;
- private ParseTreeCreationFromAST parser = new ParseTreeCreationFromAST(new ASTBoundResolver());
- private ProxyFactoryRegistry registry;
-
- public ASTTreeInitStringParserTestHelper() {
- }
-
- public ASTTreeInitStringParserTestHelper(IProject project, ProxyFactoryRegistry registry) {
- this.project = JavaCore.create(project);
- this.registry = registry;
- }
-
- public ASTTreeInitStringParserTestHelper(IProject project) {
- this(project, null);
- }
-
- public ProxyFactoryRegistry getRegistry() {
- return registry;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jem.tests.proxy.initParser.AbstractInitStringParserTestHelper#testInitString(java.lang.String, java.lang.Object, boolean, boolean)
- */
- public void testInitString(String aString, Object expectedResult, boolean throwsException, boolean equalsOnly) throws Throwable {
- String testClass = MessageFormat.format(TEMPLATE_CLASS, new Object[] {aString});
- ASTParser parser = ASTParser.newParser(AST.JLS2);
- parser.setSource(testClass.toCharArray());
- parser.setUnitName("TEMPLATE.java");
- if (project != null) {
- parser.setProject(project);
- parser.setResolveBindings(true);
- }
- CompilationUnit cu = (CompilationUnit) parser.createAST(new NullProgressMonitor());
-
- // This is the only method that is called from both init string and parse allocation. So we can be assume that
- // it is a straight init string. In that case we can go ahead and do regular proxy init string parsing to
- // get a proxy to pass into the parse testing.
- IBeanProxy expectedProxy = null;
- if (expectedResult instanceof IBeanProxy)
- expectedProxy = (IBeanProxy) expectedResult;
- else if (expectedResult != null && !throwsException && registry != null) {
- expectedProxy = registry.getBeanProxyFactory().createBeanProxyFrom(aString);
- }
- testInitString(aString, cu, expectedProxy, throwsException, equalsOnly);
- }
-
- public void testInitString(String aString, String[] imports, IBeanProxy expectedResult) throws Throwable {
- testInitString(aString, imports,expectedResult, false, true);
- }
-
- public void testInitString(String aString, String[] imports, IBeanProxy expectedResult, boolean throwsException, boolean equalsOnly) throws Throwable {
- StringBuffer importLines = new StringBuffer(100);
- for (int i = 0; i < imports.length; i++) {
- importLines.append("import ");
- importLines.append(imports[i]);
- importLines.append(";\n");
- }
- String testClass = MessageFormat.format(TEMPLATE_CLASS_IMPORTS, new Object[] {importLines, aString});
- ASTParser parser = ASTParser.newParser(AST.JLS2);
- parser.setSource(testClass.toCharArray());
- parser.setUnitName("TEMPLATE.java");
- if (project != null) {
- parser.setProject(project);
- parser.setResolveBindings(true);
- }
- CompilationUnit cu = (CompilationUnit) parser.createAST(null);
- testInitString(aString, cu, expectedResult, throwsException, equalsOnly);
- }
-
- protected void testInitString(
- String aString,
- CompilationUnit cu,
- IBeanProxy expectedResult,
- boolean throwsException,
- boolean equalsOnly)
- throws Throwable {
- IProblem[] problems = cu.getProblems();
- if (problems.length > 0) {
- boolean errors = false;
- StringBuffer buf = new StringBuffer(100);
- for (int i = 0; i < problems.length; i++) {
- errors = errors | problems[i].isError();
- buf.append(" " + problems[i].getMessage());
- }
- // If only warnings, try going on. Only errors should cause a failure.
- if (errors)
- if (!throwsException)
- Assert.fail("Problems with \"" + aString + "\": " + buf);
- else
- return; // Treat this as an exception.
- else {
- // Else just log the warnings.
- System.err.println("Warnings ocurred for \"" + aString + "\":" + buf);
- }
- }
-
- TypeDeclaration td = (TypeDeclaration) cu.types().get(0);
- ExpressionStatement es = (ExpressionStatement) td.getMethods()[0].getBody().statements().get(0);
- MethodInvocation mi = (MethodInvocation) es.getExpression();
- org.eclipse.jdt.core.dom.Expression exp = (org.eclipse.jdt.core.dom.Expression) mi.arguments().get(0);
- PTExpression parseExp = parser.createExpression(exp);
-
- if (registry != null) {
- ParseTreeAllocationInstantiationVisitor v = new ParseTreeAllocationInstantiationVisitor();
- try {
- IBeanProxy bean = v.getBeanProxy(parseExp, registry);
- if (throwsException)
- Assert.fail("Should of thrown exception. Instead result was \"" + (bean != null ? bean.toBeanString() : null) + "\"");
- if (bean == expectedResult)
- return;
- if ((bean == null && expectedResult != null) || (expectedResult == null && bean != null))
- Assert.fail(
- "ExpectedResult="
- + (expectedResult != null ? expectedResult.toBeanString() : null)
- + " result="
- + (bean != null ? bean.toBeanString() : null));
- if (bean.equals(expectedResult))
- return;
- // It may be that the equals expression is bad. If so use the toString() to do
- // a partial comparison
- if (bean.getTypeProxy() == expectedResult.getTypeProxy()) {
- if (bean.toBeanString().equals(expectedResult.toBeanString())) {
- return;
- } else {
- // The toStrings do not match perfectly but the classes do.
- // Try and see how close the two strings are
- if (expectedResult.getTypeProxy().isArray() && bean.getTypeProxy().isArray()) {
- IBeanTypeProxy expectedResultClass = ((IArrayBeanTypeProxy) expectedResult.getTypeProxy()).getComponentType();
- IBeanTypeProxy resultClass = ((IArrayBeanTypeProxy) bean.getTypeProxy()).getComponentType();
- int resultLength = ((IArrayBeanProxy) bean).getLength();
- int expectedLength = ((IArrayBeanProxy) expectedResult).getLength();
- if (expectedLength == resultLength) {
- if (resultClass == expectedResultClass) {
- // TODO Should actually step in and check each element too.
- return;
- } else {
- Assert.fail(
- aString
- + " ExpectedResult="
- + expectedResult.toBeanString()
- + " ActualResult="
- + bean.toBeanString()
- + " ExpectedClass="
- + expectedResult.getTypeProxy().getFormalTypeName()
- + " ActualClass="
- + bean.getTypeProxy().getFormalTypeName());
- }
- } else {
- Assert.fail(
- aString
- + " ExpectedResult="
- + expectedResult.toBeanString()
- + " ActualResult="
- + bean.toBeanString()
- + " ExpectedClass="
- + expectedResult.getTypeProxy().getFormalTypeName()
- + " ActualClass="
- + bean.getTypeProxy().getFormalTypeName());
- }
- } else {
- if (equalsOnly)
- Assert.fail(
- aString
- + " ExpectedResult="
- + expectedResult.toBeanString()
- + " ActualResult="
- + bean.toBeanString()
- + " ExpectedClass="
- + expectedResult.getTypeProxy().getFormalTypeName()
- + " ActualClass="
- + bean.getTypeProxy().getFormalTypeName());
- return;
- }
- }
- } else {
- Assert.fail(
- aString
- + " ExpectedResult="
- + expectedResult.toBeanString()
- + " ActualResult="
- + bean.toBeanString()
- + " ExpectedClass="
- + expectedResult.getTypeProxy().getFormalTypeName()
- + " ActualClass="
- + bean.getTypeProxy().getFormalTypeName());
- }
- } catch (Exception e) {
- if (throwsException)
- return; // This is ok, it should of thrown exception.
- else
- throw e;
- }
- }
- }
-
-}
diff --git a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/tree/InnerClassTestData.java b/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/tree/InnerClassTestData.java
deleted file mode 100644
index 08035d9e..00000000
--- a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/initParser/tree/InnerClassTestData.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * $RCSfile: InnerClassTestData.java,v $
- * $Revision: 1.3 $ $Date: 2005/02/15 23:00:16 $
- */
-package org.eclipse.jem.tests.proxy.initParser.tree;
-
-import java.awt.Color;
-
-/**
- * This is for testing inner class access.
- * @since 1.0.0
- */
-public class InnerClassTestData {
-
- /**
- *
- * @since 1.0.0
- */
- public static class InnerInnerClass extends Object {
- public final static Color GREEN = Color.green;
-
- /**
- *
- * @since 1.0.0
- */
- public static class InnerInnerInnerClass extends Object {
- public final static Color RED = Color.red;
-
- /**
- *
- * @since 1.0.0
- */
- public class InnerInnerInnerInnerClass {
-
- /* (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals(Object obj) {
- return super.equals(obj) || obj instanceof InnerInnerInnerInnerClass;
- }
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals(Object obj) {
- return super.equals(obj) || obj instanceof InnerInnerInnerClass;
- }
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals(Object obj) {
- return super.equals(obj) || obj instanceof InnerInnerClass;
- }
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals(Object obj) {
- return super.equals(obj) || obj instanceof InnerClassTestData;
- }
-
-} \ No newline at end of file
diff --git a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/remote/RemoteProxySuite.java b/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/remote/RemoteProxySuite.java
deleted file mode 100644
index 5a40946c..00000000
--- a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/remote/RemoteProxySuite.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jem.tests.proxy.remote;
-/*
- * $RCSfile: RemoteProxySuite.java,v $
- * $Revision: 1.7 $ $Date: 2005/02/15 23:00:16 $
- */
-import java.net.URL;
-
-import junit.extensions.TestSetup;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.*;
-
-import org.eclipse.jem.internal.proxy.core.*;
-import org.eclipse.jem.tests.JavaProjectUtil;
-import org.eclipse.jem.tests.JavaTestsPlugin;
-import org.eclipse.jem.tests.proxy.AbstractTestProxy;
-import org.eclipse.jem.tests.proxy.ProxySuite;
-
-/**
- * @author richkulp
- *
- * This is the true test suite for Remote Proxy Testing. The RemoteProxyTest will use this.
- */
-public class RemoteProxySuite extends TestSetup {
-
- // Test cases to be include in the suite
- private static final Class testsList[] = { ProxySuite.class, TestProjectAccess.class, };
-
- private IProject project; // The project to start the proxy factory on.
- private AbstractTestProxy.RegistryHandler registryHandler = new AbstractTestProxy.RegistryHandler() {
- private ProxyFactoryRegistry registry;
-
- public boolean isValid() {
- return project != null;
- }
- public ProxyFactoryRegistry getRegistry() throws CoreException {
- if (registry == null) {
- registry =
- ProxyLaunchSupport.startImplementation(
- project,
- "JUnit Remote Proxy Test",
- new IConfigurationContributor[] { ProxySuite.getProxySuiteContributor()},
- new NullProgressMonitor());
- }
- return registry;
- }
-
- public void destroyRegistry() {
- if (registry != null) {
- registry.terminateRegistry();
- registry = null;
- }
- }
- };
-
- public RemoteProxySuite() {
- this("Test Remote Proxy Suite");
- }
-
- public RemoteProxySuite(String name) {
- super(new TestSuite(name) {
- {
- for (int i = 0; i < testsList.length; i++) {
- // We may get some tests and suites.
- if (TestSuite.class.isAssignableFrom(testsList[i]) || TestSetup.class.isAssignableFrom(testsList[i])) {
- try {
- Test ts = (Test) testsList[i].newInstance();
- addTest(ts);
- } catch (Exception e) {
- e.printStackTrace();
- }
- } else
- addTestSuite(testsList[i]);
- }
- }
- });
-
- AbstractTestProxy.initRegistryHandler((TestSuite) this.getTest(), registryHandler);
- }
-
- public static Test suite() {
- return new RemoteProxySuite();
- }
-
- private final static String TEST_PROJECT_NAME = "Test Remote Proxy";
- private boolean oldAutoBuildingState; // autoBuilding state before we started.
- protected void setUp() throws Exception {
- System.out.println("-- Initializing the Proxy Remote test data --"); //$NON-NLS-1$
- oldAutoBuildingState = JavaProjectUtil.setAutoBuild(true);
- String zipPath =
- Platform
- .asLocalURL(new URL(JavaTestsPlugin.getPlugin().getBundle().getEntry("/"), "testdata/testremoteproject.zip"))
- .getFile();
- IProject[] projects = JavaProjectUtil.importProjects(new String[] { TEST_PROJECT_NAME }, new String[] { zipPath });
- assertNotNull(projects[0]);
- JavaProjectUtil.waitForAutoBuild();
- project = projects[0];
- System.out.println("-- Data initialized --"); //$NON-NLS-1$
-
- }
-
- protected void tearDown() throws Exception {
- registryHandler.destroyRegistry();
- if (project != null) {
- project.delete(true, false, null); // Get rid of the project and the files themselves.
- project = null;
- }
- JavaProjectUtil.setAutoBuild(oldAutoBuildingState);
- }
-
-}
diff --git a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/remote/TestProjectAccess.java b/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/remote/TestProjectAccess.java
deleted file mode 100644
index 871badb0..00000000
--- a/tests/org.eclipse.jem.tests/javatests/org/eclipse/jem/tests/proxy/remote/TestProjectAccess.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package org.eclipse.jem.tests.proxy.remote;
-/*******************************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * $RCSfile: TestProjectAccess.java,v $
- * $Revision: 1.3 $ $Date: 2005/02/15 23:00:16 $
- */
-import org.eclipse.jem.internal.proxy.core.*;
-import org.eclipse.jem.internal.proxy.core.IBeanProxy;
-import org.eclipse.jem.internal.proxy.core.IBeanTypeProxy;
-import org.eclipse.jem.tests.proxy.AbstractTestProxy;
-
-/**
- * @author richkulp
- *
- * Test Project Access.
- */
-public class TestProjectAccess extends AbstractTestProxy {
-
- public TestProjectAccess() {
- super();
- }
-
- public TestProjectAccess(String name) {
- super(name);
- }
-
- public void testClassFromProject() {
- IBeanTypeProxy testClassType = proxyTypeFactory.getBeanTypeProxy("org.eclipse.jem.testing.proxy.remote.TestClass"); //$NON-NLS-1$
- assertNotNull(testClassType);
- }
-
- public void testProjectClassInstantiation() throws ThrowableProxy {
- IBeanTypeProxy testClassType = proxyTypeFactory.getBeanTypeProxy("org.eclipse.jem.testing.proxy.remote.TestClass"); //$NON-NLS-1$
- IBeanProxy testClass = testClassType.newInstance();
- assertNotNull(testClass);
- }
-
- public void testProjectClassMethod() throws ThrowableProxy {
- IBeanTypeProxy testClassType = proxyTypeFactory.getBeanTypeProxy("org.eclipse.jem.testing.proxy.remote.TestClass"); //$NON-NLS-1$
- IMethodProxy testMethod = testClassType.getMethodProxy("getTestString"); //$NON-NLS-1$
- assertNotNull(testMethod);
- }
-
- public void testProjectClassMethodInvoke() throws ThrowableProxy {
- IBeanTypeProxy testClassType = proxyTypeFactory.getBeanTypeProxy("org.eclipse.jem.testing.proxy.remote.TestClass"); //$NON-NLS-1$
- IMethodProxy testMethod = testClassType.getMethodProxy("getTestString"); //$NON-NLS-1$
- IBeanProxy testClass = testClassType.newInstance();
- IStringBeanProxy aString = (IStringBeanProxy) testMethod.invoke(testClass);
- assertNotNull(aString);
- assertEquals("TESTSTRING", aString.stringValue());
- }
-
-}

Back to the top