Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrik Lindberg2009-04-16 17:15:55 +0000
committerHenrik Lindberg2009-04-16 17:15:55 +0000
commit15368340fd39182acd45af0b8041ffc2694f9ded (patch)
tree062a0faae36cf6cda193d82e40f282decd5ba450 /bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/repository
parent07db8e7607dbdfa82f4f8484e2f211264a5c1398 (diff)
downloadrt.equinox.p2-15368340fd39182acd45af0b8041ffc2694f9ded.tar.gz
rt.equinox.p2-15368340fd39182acd45af0b8041ffc2694f9ded.tar.xz
rt.equinox.p2-15368340fd39182acd45af0b8041ffc2694f9ded.zip
Bug 272530 [repository] Add location validation method suitable for use by UI
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/AllTests.java25
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/repository/RepositoryHelperTest.java46
2 files changed, 71 insertions, 0 deletions
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/repository/AllTests.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/repository/AllTests.java
new file mode 100644
index 000000000..e67cb15dc
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/repository/AllTests.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Cloudsmith Inc 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:
+ * Cloudsmith Inc - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.p2.tests.repository;
+
+import junit.framework.*;
+
+/**
+ * Performs all automated repository bundle tests.
+ */
+public class AllTests extends TestCase {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(AllTests.class.getName());
+ suite.addTestSuite(RepositoryHelperTest.class);
+ return suite;
+ }
+}
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
new file mode 100644
index 000000000..a4fb9e4c8
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/repository/RepositoryHelperTest.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Cloudsmith Inc 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:
+ * Cloudsmith Inc - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.equinox.p2.tests.repository;
+
+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;
+
+/**
+ * Tests RepositoryHandler
+ */
+public class RepositoryHelperTest extends TestCase {
+
+ public void testURISyntaxChecker() throws URISyntaxException {
+ URI location = new URI("http://somwhere.com/path");
+ IStatus result = RepositoryHelper.checkRepositoryLocationSyntax(location);
+ assertTrue("1.0 Valid URI should be ok", result.isOK());
+
+ location = new URI("ftp://somwhere.com/path");
+ result = RepositoryHelper.checkRepositoryLocationSyntax(location);
+ assertTrue("2.0 Valid URI should be ok", result.isOK());
+
+ location = new URI("https://somwhere.com/path");
+ result = RepositoryHelper.checkRepositoryLocationSyntax(location);
+ assertTrue("2.0 Valid URI should be ok", result.isOK());
+
+ location = new URI("htp://somwhere.com/path");
+ result = RepositoryHelper.checkRepositoryLocationSyntax(location);
+ assertFalse("1.0 Invalid URI should not be ok", result.isOK());
+
+ location = new URI("/somwhere.com/path");
+ result = RepositoryHelper.checkRepositoryLocationSyntax(location);
+ assertFalse("2.0 Invalid URI should not be ok", result.isOK());
+ }
+}

Back to the top