Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: d37277369ca45497bd65b68f3046444d825e0e38 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*******************************************************************************
 * Copyright (c) 2015, 2018 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.osgi.tests.bundles;

import java.awt.image.ImageProducer;
import java.io.IOException;
import java.net.URL;
import junit.framework.Test;
import junit.framework.TestSuite;
import org.osgi.framework.Bundle;

public class URLHandlerTests extends AbstractBundleTests {
	public static Test suite() {
		return new TestSuite(URLHandlerTests.class);
	}

	public void testURLHandlerUnregister() throws Exception {
		Bundle test = installer.installBundle("test.protocol.handler"); //$NON-NLS-1$
		test.start();
		URL testURL = new URL("testing1://test");
		testURL.openConnection().connect();
		test.stop();
		test.start();
		testURL = new URL("testing1://test");
		testURL.openConnection().connect();
	}

	public void testImageProducer() throws IOException {
		URL testImage = getClass().getResource("debug.gif");
		Object content = testImage.getContent();
		assertTrue("Wrong content type: " + content.getClass().getName(), content instanceof ImageProducer);
	}

}

Back to the top