]> git.uio.no Git - ifi-stolz-refaktor.git/commitdiff
New project with unit test for refactoring.
authorVolker Stolz <stolz@ifi.uio.no>
Thu, 7 Mar 2013 10:52:33 +0000 (11:52 +0100)
committerVolker Stolz <stolz@ifi.uio.no>
Thu, 7 Mar 2013 10:52:33 +0000 (11:52 +0100)
software/no.uio.ifi.refaktor.tests/.classpath [new file with mode: 0644]
software/no.uio.ifi.refaktor.tests/.project [new file with mode: 0644]
software/no.uio.ifi.refaktor.tests/ExtractTest.launch [new file with mode: 0644]
software/no.uio.ifi.refaktor.tests/META-INF/MANIFEST.MF [new file with mode: 0644]
software/no.uio.ifi.refaktor.tests/build.properties [new file with mode: 0644]
software/no.uio.ifi.refaktor.tests/src/no/uio/ifi/refaktor/tests/ExtractTest.java [new file with mode: 0644]

diff --git a/software/no.uio.ifi.refaktor.tests/.classpath b/software/no.uio.ifi.refaktor.tests/.classpath
new file mode 100644 (file)
index 0000000..ad32c83
--- /dev/null
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+       <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+       <classpathentry kind="src" path="src"/>
+       <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/software/no.uio.ifi.refaktor.tests/.project b/software/no.uio.ifi.refaktor.tests/.project
new file mode 100644 (file)
index 0000000..47fef4d
--- /dev/null
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>no.uio.ifi.refaktor.tests</name>
+       <comment></comment>
+       <projects>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>org.eclipse.jdt.core.javabuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.pde.ManifestBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.pde.SchemaBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>org.eclipse.pde.PluginNature</nature>
+               <nature>org.eclipse.jdt.core.javanature</nature>
+       </natures>
+</projectDescription>
diff --git a/software/no.uio.ifi.refaktor.tests/ExtractTest.launch b/software/no.uio.ifi.refaktor.tests/ExtractTest.launch
new file mode 100644 (file)
index 0000000..8aab36e
--- /dev/null
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.pde.ui.JunitLaunchConfig">
+<booleanAttribute key="append.args" value="true"/>
+<stringAttribute key="application" value="org.eclipse.pde.junit.runtime.coretestapplication"/>
+<booleanAttribute key="askclear" value="false"/>
+<booleanAttribute key="automaticAdd" value="true"/>
+<booleanAttribute key="automaticValidate" value="false"/>
+<stringAttribute key="bootstrap" value=""/>
+<stringAttribute key="checked" value="[NONE]"/>
+<booleanAttribute key="clearConfig" value="true"/>
+<booleanAttribute key="clearws" value="true"/>
+<booleanAttribute key="clearwslog" value="false"/>
+<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/>
+<booleanAttribute key="default" value="true"/>
+<booleanAttribute key="includeOptional" value="true"/>
+<stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/no.uio.ifi.refaktor.tests/src/no/uio/ifi/refaktor/tests/ExtractTest.java"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="1"/>
+</listAttribute>
+<booleanAttribute key="org.eclipse.debug.core.capture_output" value="false"/>
+<booleanAttribute key="org.eclipse.debug.ui.ATTR_CONSOLE_OUTPUT_ON" value="false"/>
+<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
+<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
+<listEntry value="org.eclipse.debug.ui.launchGroup.run"/>
+</listAttribute>
+<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
+<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
+<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
+<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="no.uio.ifi.refaktor.tests.ExtractTest"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="no.uio.ifi.refaktor.tests"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms40m -Xmx512m -ea"/>
+<stringAttribute key="pde.version" value="3.3"/>
+<stringAttribute key="product" value="org.eclipse.sdk.ide"/>
+<booleanAttribute key="run_in_ui_thread" value="true"/>
+<booleanAttribute key="show_selected_only" value="false"/>
+<booleanAttribute key="tracing" value="false"/>
+<booleanAttribute key="useCustomFeatures" value="false"/>
+<booleanAttribute key="useDefaultConfig" value="true"/>
+<booleanAttribute key="useDefaultConfigArea" value="false"/>
+<booleanAttribute key="useProduct" value="false"/>
+</launchConfiguration>
diff --git a/software/no.uio.ifi.refaktor.tests/META-INF/MANIFEST.MF b/software/no.uio.ifi.refaktor.tests/META-INF/MANIFEST.MF
new file mode 100644 (file)
index 0000000..7105bcf
--- /dev/null
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Tests
+Bundle-SymbolicName: no.uio.ifi.refaktor.tests
+Bundle-Version: 1.0.0.qualifier
+Fragment-Host: RefactoringTestOne
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Require-Bundle: no.uio.ifi.refaktor.examples,
+ org.junit,
+ org.eclipse.ui.ide
+Import-Package: org.eclipse.jdt.internal.ui.dialogs
diff --git a/software/no.uio.ifi.refaktor.tests/build.properties b/software/no.uio.ifi.refaktor.tests/build.properties
new file mode 100644 (file)
index 0000000..34d2e4d
--- /dev/null
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+               .
diff --git a/software/no.uio.ifi.refaktor.tests/src/no/uio/ifi/refaktor/tests/ExtractTest.java b/software/no.uio.ifi.refaktor.tests/src/no/uio/ifi/refaktor/tests/ExtractTest.java
new file mode 100644 (file)
index 0000000..bfbfc44
--- /dev/null
@@ -0,0 +1,37 @@
+package no.uio.ifi.refaktor.tests;
+
+import java.lang.reflect.InvocationTargetException;
+
+import no.uio.ifi.refaktor.examples.wizard.LoadExample;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.ltk.core.refactoring.PerformChangeOperation;
+import org.eclipse.ui.actions.WorkspaceModifyOperation;
+import org.junit.Test;
+
+import refactoringtestone.handlers.RefactoringHandler;
+
+public class ExtractTest {
+
+       final static String FRAGMENT_ID = "no.uio.ifi.refaktor.tests";
+
+       @Test
+       public void testLoadFileFromBundleToProject() throws Exception {
+               WorkspaceModifyOperation op = new WorkspaceModifyOperation(){
+
+                       @Override
+                       protected void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException {
+                               new LoadExample().loadFileFromBundleToProject(monitor, LoadExample.PLUGIN_ID, LoadExample.PARENT_FOLDER_NAME, LoadExample.NEWPROJECT_PREFIX, false);
+                               // TODO: assert that the project has actually been created.
+                               /* Do something with the extracted code,
+                                * then assert that something useful has indeed happened:
+                                */
+                               PerformChangeOperation performChangeOperation = new PerformChangeOperation(RefactoringHandler.makeCreateChangeOperation());
+                               performChangeOperation.run(monitor);
+                       }};
+                       op.run(new NullProgressMonitor());
+       }
+
+}