Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Hallgren2010-02-05 17:07:01 -0500
committerThomas Hallgren2010-02-05 17:07:01 -0500
commit9faaed06625f31f3e4f26f65c3cffe4e947604fd (patch)
tree162a1267d4429ff85e188de84970455c138abfa6 /bundles/org.eclipse.equinox.p2.tests.optimizers
parente640f35a91169ce4ad67d674ba7b150b42450478 (diff)
downloadrt.equinox.p2-9faaed06625f31f3e4f26f65c3cffe4e947604fd.tar.gz
rt.equinox.p2-9faaed06625f31f3e4f26f65c3cffe4e947604fd.tar.xz
rt.equinox.p2-9faaed06625f31f3e4f26f65c3cffe4e947604fd.zip
299987 : Removal of p2 services in favor of always using an agent.
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.tests.optimizers')
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/JBDiffStepTest.java14
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/JBDiffZipStepTest.java14
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/JarDeltaOptimizerTest.java14
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/OptimizerTest.java22
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/processors/JBPatchStepTest.java15
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/processors/JBPatchZipStepTest.java15
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/processors/JarDeltaProcessorTest.java15
7 files changed, 55 insertions, 54 deletions
diff --git a/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/JBDiffStepTest.java b/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/JBDiffStepTest.java
index 5e06e758a..ca98076fa 100644
--- a/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/JBDiffStepTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/JBDiffStepTest.java
@@ -10,29 +10,25 @@
*******************************************************************************/
package org.eclipse.equinox.p2.tests.artifact.optimizers;
-import org.eclipse.equinox.p2.metadata.Version;
-
-import org.eclipse.equinox.p2.repository.artifact.spi.ProcessingStepDescriptor;
-
-import org.eclipse.equinox.p2.repository.artifact.IProcessingStepDescriptor;
-
import java.io.*;
import java.util.Arrays;
-import junit.framework.TestCase;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.equinox.internal.p2.artifact.optimizers.jbdiff.JBDiffStep;
import org.eclipse.equinox.internal.p2.core.helpers.FileUtils;
import org.eclipse.equinox.internal.p2.metadata.ArtifactKey;
import org.eclipse.equinox.p2.metadata.IArtifactKey;
+import org.eclipse.equinox.p2.metadata.Version;
import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository;
+import org.eclipse.equinox.p2.repository.artifact.IProcessingStepDescriptor;
import org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor;
+import org.eclipse.equinox.p2.repository.artifact.spi.ProcessingStepDescriptor;
import org.eclipse.equinox.p2.tests.artifact.processors.ArtifactRepositoryMock;
import org.eclipse.equinox.p2.tests.optimizers.TestData;
/**
* Test the <code>JBDiffStepTest</code> processing step.
*/
-public class JBDiffStepTest extends TestCase {
+public class JBDiffStepTest extends OptimizerTest {
// public void testGenerateTestDataExe32To33() throws IOException {
// File exe32 = TestData.getTempFile("optimizers", "eclipse-3.2.exe");
@@ -53,7 +49,7 @@ public class JBDiffStepTest extends TestCase {
IProcessingStepDescriptor stepDescriptor = new ProcessingStepDescriptor("id", "ns,cl,id1,1.0", true);
IArtifactKey key = new ArtifactKey("cl", "id1", Version.create("1.1"));
ArtifactDescriptor descriptor = new ArtifactDescriptor(key);
- differ.initialize(stepDescriptor, descriptor);
+ differ.initialize(getAgent(), stepDescriptor, descriptor);
ByteArrayOutputStream destination = new ByteArrayOutputStream();
differ.link(destination, new NullProgressMonitor());
diff --git a/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/JBDiffZipStepTest.java b/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/JBDiffZipStepTest.java
index b654cc923..9a0a818e7 100644
--- a/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/JBDiffZipStepTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/JBDiffZipStepTest.java
@@ -10,29 +10,25 @@
*******************************************************************************/
package org.eclipse.equinox.p2.tests.artifact.optimizers;
-import org.eclipse.equinox.p2.metadata.Version;
-
-import org.eclipse.equinox.p2.repository.artifact.spi.ProcessingStepDescriptor;
-
-import org.eclipse.equinox.p2.repository.artifact.IProcessingStepDescriptor;
-
import java.io.*;
import java.util.Arrays;
-import junit.framework.TestCase;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.equinox.internal.p2.artifact.optimizers.jbdiff.JBDiffZipStep;
import org.eclipse.equinox.internal.p2.core.helpers.FileUtils;
import org.eclipse.equinox.internal.p2.metadata.ArtifactKey;
import org.eclipse.equinox.p2.metadata.IArtifactKey;
+import org.eclipse.equinox.p2.metadata.Version;
import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository;
+import org.eclipse.equinox.p2.repository.artifact.IProcessingStepDescriptor;
import org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor;
+import org.eclipse.equinox.p2.repository.artifact.spi.ProcessingStepDescriptor;
import org.eclipse.equinox.p2.tests.artifact.processors.ArtifactRepositoryMock;
import org.eclipse.equinox.p2.tests.optimizers.TestData;
/**
* Test the <code>JBDiffZipTest</code> processing step.
*/
-public class JBDiffZipStepTest extends TestCase {
+public class JBDiffZipStepTest extends OptimizerTest {
/**
* Test diffing the <b>normalized</b> jars. This is indicated by the extension ".njar".
@@ -45,7 +41,7 @@ public class JBDiffZipStepTest extends TestCase {
IProcessingStepDescriptor stepDescriptor = new ProcessingStepDescriptor("id", "ns,cl,id1,1.0", true);
IArtifactKey key = new ArtifactKey("cl", "id1", Version.create("1.1"));
ArtifactDescriptor descriptor = new ArtifactDescriptor(key);
- differ.initialize(stepDescriptor, descriptor);
+ differ.initialize(getAgent(), stepDescriptor, descriptor);
ByteArrayOutputStream destination = new ByteArrayOutputStream();
differ.link(destination, new NullProgressMonitor());
diff --git a/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/JarDeltaOptimizerTest.java b/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/JarDeltaOptimizerTest.java
index a53fc4cbc..ea17138c8 100644
--- a/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/JarDeltaOptimizerTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/JarDeltaOptimizerTest.java
@@ -11,30 +11,26 @@
*******************************************************************************/
package org.eclipse.equinox.p2.tests.artifact.optimizers;
-import org.eclipse.equinox.p2.metadata.Version;
-
-import org.eclipse.equinox.p2.repository.artifact.spi.ProcessingStepDescriptor;
-
-import org.eclipse.equinox.p2.repository.artifact.IProcessingStepDescriptor;
-
import java.io.*;
import java.util.zip.ZipInputStream;
-import junit.framework.TestCase;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.equinox.internal.p2.artifact.optimizers.jardelta.JarDeltaOptimizerStep;
import org.eclipse.equinox.internal.p2.core.helpers.FileUtils;
import org.eclipse.equinox.internal.p2.metadata.ArtifactKey;
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.processing.ProcessingStep;
import org.eclipse.equinox.p2.metadata.IArtifactKey;
+import org.eclipse.equinox.p2.metadata.Version;
import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository;
+import org.eclipse.equinox.p2.repository.artifact.IProcessingStepDescriptor;
import org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor;
+import org.eclipse.equinox.p2.repository.artifact.spi.ProcessingStepDescriptor;
import org.eclipse.equinox.p2.tests.artifact.processors.ArtifactRepositoryMock;
import org.eclipse.equinox.p2.tests.optimizers.TestData;
/**
* Test the <code>JarDelta</code> processing step.
*/
-public class JarDeltaOptimizerTest extends TestCase {
+public class JarDeltaOptimizerTest extends OptimizerTest {
// public void testPrepare() throws IOException {
// IArtifactRepository repoMock = ArtifactRepositoryMock.getMock("testData/optimizers/testdata_1.0.0.1.jar");
@@ -61,7 +57,7 @@ public class JarDeltaOptimizerTest extends TestCase {
IProcessingStepDescriptor stepDescriptor = new ProcessingStepDescriptor("id", "ns,cl,id1,1.0.0.1", true);
IArtifactKey key = new ArtifactKey("cl", "id1", Version.create("1.0.0.2"));
ArtifactDescriptor descriptor = new ArtifactDescriptor(key);
- step.initialize(stepDescriptor, descriptor);
+ step.initialize(getAgent(), stepDescriptor, descriptor);
ByteArrayOutputStream destination = new ByteArrayOutputStream();
step.link(destination, new NullProgressMonitor());
diff --git a/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/OptimizerTest.java b/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/OptimizerTest.java
new file mode 100644
index 000000000..7e9bb3987
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/OptimizerTest.java
@@ -0,0 +1,22 @@
+package org.eclipse.equinox.p2.tests.artifact.optimizers;
+
+import junit.framework.TestCase;
+import org.eclipse.equinox.internal.p2.artifact.optimizers.Activator;
+import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
+import org.eclipse.equinox.p2.core.IProvisioningAgent;
+
+public abstract class OptimizerTest extends TestCase {
+ public OptimizerTest(String name) {
+ super(name);
+ }
+
+ public OptimizerTest() {
+ super();
+ }
+
+ protected static IProvisioningAgent getAgent() {
+ //get the global agent for the currently running system
+ return (IProvisioningAgent) ServiceHelper.getService(Activator.getContext(), IProvisioningAgent.SERVICE_NAME);
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/processors/JBPatchStepTest.java b/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/processors/JBPatchStepTest.java
index 29a6b2162..1405e12c2 100644
--- a/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/processors/JBPatchStepTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/processors/JBPatchStepTest.java
@@ -10,30 +10,27 @@
*******************************************************************************/
package org.eclipse.equinox.p2.tests.artifact.processors;
-import org.eclipse.equinox.p2.metadata.Version;
-
-import org.eclipse.equinox.p2.repository.artifact.spi.ProcessingStepDescriptor;
-
-import org.eclipse.equinox.p2.repository.artifact.IProcessingStepDescriptor;
-
import java.io.*;
import java.util.Arrays;
-import junit.framework.TestCase;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.equinox.internal.p2.artifact.processors.jbdiff.JBPatchStep;
import org.eclipse.equinox.internal.p2.core.helpers.FileUtils;
import org.eclipse.equinox.internal.p2.metadata.ArtifactKey;
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.processing.ProcessingStep;
import org.eclipse.equinox.p2.metadata.IArtifactKey;
+import org.eclipse.equinox.p2.metadata.Version;
import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository;
+import org.eclipse.equinox.p2.repository.artifact.IProcessingStepDescriptor;
import org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor;
+import org.eclipse.equinox.p2.repository.artifact.spi.ProcessingStepDescriptor;
+import org.eclipse.equinox.p2.tests.artifact.optimizers.OptimizerTest;
import org.eclipse.equinox.p2.tests.optimizers.TestData;
/**
* Test the <code>JBPatchStep</code>
*
*/
-public class JBPatchStepTest extends TestCase {
+public class JBPatchStepTest extends OptimizerTest {
public void testPatchEclipseExe32to33() throws IOException {
IArtifactRepository repoMock = ArtifactRepositoryMock.getMock("testData/optimizers/eclipse-3.2.exe");
@@ -41,7 +38,7 @@ public class JBPatchStepTest extends TestCase {
IProcessingStepDescriptor descriptor = new ProcessingStepDescriptor("id", "ns,cl,id1,1.0", true);
IArtifactKey key = new ArtifactKey("cl", "id1", Version.create("1.1"));
ArtifactDescriptor context = new ArtifactDescriptor(key);
- patcher.initialize(descriptor, context);
+ patcher.initialize(getAgent(), descriptor, context);
ByteArrayOutputStream destination = new ByteArrayOutputStream();
patcher.link(destination, new NullProgressMonitor());
diff --git a/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/processors/JBPatchZipStepTest.java b/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/processors/JBPatchZipStepTest.java
index 61e0a92ed..c5c921916 100644
--- a/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/processors/JBPatchZipStepTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/processors/JBPatchZipStepTest.java
@@ -10,29 +10,26 @@
*******************************************************************************/
package org.eclipse.equinox.p2.tests.artifact.processors;
-import org.eclipse.equinox.p2.metadata.Version;
-
-import org.eclipse.equinox.p2.repository.artifact.spi.ProcessingStepDescriptor;
-
-import org.eclipse.equinox.p2.repository.artifact.IProcessingStepDescriptor;
-
import java.io.*;
import java.util.Arrays;
-import junit.framework.TestCase;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.equinox.internal.p2.artifact.processors.jbdiff.JBPatchZipStep;
import org.eclipse.equinox.internal.p2.core.helpers.FileUtils;
import org.eclipse.equinox.internal.p2.metadata.ArtifactKey;
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.processing.ProcessingStep;
import org.eclipse.equinox.p2.metadata.IArtifactKey;
+import org.eclipse.equinox.p2.metadata.Version;
import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository;
+import org.eclipse.equinox.p2.repository.artifact.IProcessingStepDescriptor;
import org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor;
+import org.eclipse.equinox.p2.repository.artifact.spi.ProcessingStepDescriptor;
+import org.eclipse.equinox.p2.tests.artifact.optimizers.OptimizerTest;
import org.eclipse.equinox.p2.tests.optimizers.TestData;
/**
* Test the <code>JBPatchZipStep</code> processing step.
*/
-public class JBPatchZipStepTest extends TestCase {
+public class JBPatchZipStepTest extends OptimizerTest {
// /**
// * This is a disabled "unit test" that was used to generate the data needed for real test.
@@ -59,7 +56,7 @@ public class JBPatchZipStepTest extends TestCase {
IProcessingStepDescriptor descriptor = new ProcessingStepDescriptor("id", "ns,cl,id1,1.0", true);
IArtifactKey key = new ArtifactKey("cl", "id1", Version.create("1.1"));
ArtifactDescriptor context = new ArtifactDescriptor(key);
- patcher.initialize(descriptor, context);
+ patcher.initialize(getAgent(), descriptor, context);
ByteArrayOutputStream destination = new ByteArrayOutputStream();
patcher.link(destination, new NullProgressMonitor());
diff --git a/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/processors/JarDeltaProcessorTest.java b/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/processors/JarDeltaProcessorTest.java
index 8654d61e8..7ec8dc3c7 100644
--- a/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/processors/JarDeltaProcessorTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/processors/JarDeltaProcessorTest.java
@@ -11,26 +11,23 @@
*******************************************************************************/
package org.eclipse.equinox.p2.tests.artifact.processors;
-import org.eclipse.equinox.p2.metadata.Version;
-
-import org.eclipse.equinox.p2.repository.artifact.spi.ProcessingStepDescriptor;
-
-import org.eclipse.equinox.p2.repository.artifact.IProcessingStepDescriptor;
-
import java.io.*;
import java.util.zip.ZipInputStream;
-import junit.framework.TestCase;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.equinox.internal.p2.artifact.processors.jardelta.JarDeltaProcessorStep;
import org.eclipse.equinox.internal.p2.core.helpers.FileUtils;
import org.eclipse.equinox.internal.p2.metadata.ArtifactKey;
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.processing.ProcessingStep;
import org.eclipse.equinox.p2.metadata.IArtifactKey;
+import org.eclipse.equinox.p2.metadata.Version;
import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository;
+import org.eclipse.equinox.p2.repository.artifact.IProcessingStepDescriptor;
import org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor;
+import org.eclipse.equinox.p2.repository.artifact.spi.ProcessingStepDescriptor;
+import org.eclipse.equinox.p2.tests.artifact.optimizers.OptimizerTest;
import org.eclipse.equinox.p2.tests.optimizers.TestData;
-public class JarDeltaProcessorTest extends TestCase {
+public class JarDeltaProcessorTest extends OptimizerTest {
public JarDeltaProcessorTest(String name) {
super(name);
@@ -46,7 +43,7 @@ public class JarDeltaProcessorTest extends TestCase {
IProcessingStepDescriptor stepDescriptor = new ProcessingStepDescriptor("id", "ns,cl,id1,1.0.0.1", true);
IArtifactKey key = new ArtifactKey("cl", "id1", Version.create("1.0.0.2"));
ArtifactDescriptor descriptor = new ArtifactDescriptor(key);
- step.initialize(stepDescriptor, descriptor);
+ step.initialize(getAgent(), stepDescriptor, descriptor);
ByteArrayOutputStream destination = new ByteArrayOutputStream();
step.link(destination, new NullProgressMonitor());

Back to the top