Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2020-02-11 07:24:07 +0000
committerAlexander Kurtakov2020-02-11 07:24:07 +0000
commite4f3868ae8573bb929302ccdab51c05aa8646476 (patch)
tree38cb6ea8e4f05c8a67773b23d5903233ede26c82 /bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/repository
parent92414ec9b8d97154c74e6232cdd6057ec9a059ab (diff)
downloadrt.equinox.p2-e4f3868ae8573bb929302ccdab51c05aa8646476.tar.gz
rt.equinox.p2-e4f3868ae8573bb929302ccdab51c05aa8646476.tar.xz
rt.equinox.p2-e4f3868ae8573bb929302ccdab51c05aa8646476.zip
Convert p2.tests to JUnit 4.
Chunk 2. All direct TestCase children handled. Change-Id: I0866834dc92e01f7968bf3445818c5b2ada2f007 Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/repository')
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/repository/CacheManagerTest.java20
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/repository/RepositoryHelperTest.java13
2 files changed, 22 insertions, 11 deletions
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/repository/CacheManagerTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/repository/CacheManagerTest.java
index 245ab1551..20ccc0762 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/repository/CacheManagerTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/repository/CacheManagerTest.java
@@ -10,10 +10,12 @@
******************************************************************************/
package org.eclipse.equinox.p2.tests.repository;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
import java.io.File;
import java.io.IOException;
import java.net.URI;
-import junit.framework.TestCase;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
@@ -24,10 +26,13 @@ import org.eclipse.equinox.p2.core.IAgentLocation;
import org.eclipse.equinox.p2.core.IProvisioningAgent;
import org.eclipse.equinox.p2.core.IProvisioningAgentProvider;
import org.eclipse.equinox.p2.core.ProvisionException;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
-public class CacheManagerTest extends TestCase {
+public class CacheManagerTest {
private static final int ONE_HOUR = 3600000;
private URI repositoryLocation;
@@ -35,8 +40,8 @@ public class CacheManagerTest extends TestCase {
private CacheManager cacheManager;
private final String cachePrefix = "content"; //$NON-NLS-1$
- @Override
- protected void setUp() throws Exception {
+ @Before
+ public void setUp() throws Exception {
repositoryLocation = createRepistory();
BundleContext bundle = Platform.getBundle("org.eclipse.equinox.p2.repository").getBundleContext();
ServiceReference<IProvisioningAgentProvider> serviceReference = bundle.getServiceReference(IProvisioningAgentProvider.class);
@@ -46,12 +51,13 @@ public class CacheManagerTest extends TestCase {
cacheManager = new CacheManager(new AgentLocationMock(), transport);
}
- @Override
- protected void tearDown() throws Exception {
+ @After
+ public void tearDown() throws Exception {
Path repositoryLocationPath = new Path(repositoryLocation.getPath());
deleteFileOrDirectory(repositoryLocationPath.toFile());
}
+ @Test
public void testRepositoryDowngraded() throws ProvisionException, IOException {
File cache = cacheManager.createCache(repositoryLocation, cachePrefix, new NullProgressMonitor());
long lastModifiedInitial = cache.lastModified();
@@ -65,6 +71,7 @@ public class CacheManagerTest extends TestCase {
lastModifiedInitial == cache2.lastModified());
}
+ @Test
public void testClientDifferentTimeZone() throws ProvisionException, IOException {
File cache = cacheManager.createCache(repositoryLocation, cachePrefix, new NullProgressMonitor());
long lastModifiedInitial = cache.lastModified();
@@ -79,6 +86,7 @@ public class CacheManagerTest extends TestCase {
lastModifiedInitial + ONE_HOUR == cache2.lastModified());
}
+ @Test
public void testRepositoryUpdate() throws ProvisionException, IOException {
File cache = cacheManager.createCache(repositoryLocation, cachePrefix, new NullProgressMonitor());
long lastModifiedInitial = cache.lastModified();
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/repository/RepositoryHelperTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/repository/RepositoryHelperTest.java
index 916a2f113..0da2613d7 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/repository/RepositoryHelperTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/repository/RepositoryHelperTest.java
@@ -1,30 +1,33 @@
/*******************************************************************************
* Copyright (c) 2009 Cloudsmith Inc and others.
*
- * This program and the accompanying materials
+ * This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Cloudsmith Inc - initial API and implementation
*******************************************************************************/
package org.eclipse.equinox.p2.tests.repository;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
import java.net.URI;
import java.net.URISyntaxException;
-import junit.framework.TestCase;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.equinox.internal.p2.repository.helpers.RepositoryHelper;
+import org.junit.Test;
/**
* Tests RepositoryHandler
*/
-public class RepositoryHelperTest extends TestCase {
-
+public class RepositoryHelperTest {
+ @Test
public void testURISyntaxChecker() throws URISyntaxException {
URI location = new URI("http://somwhere.com/path");
IStatus result = RepositoryHelper.checkRepositoryLocationSyntax(location);

Back to the top