Author: rickhall
Date: Fri Feb 13 20:25:49 2009
New Revision: 744230
URL: http://svn.apache.org/viewvc?rev=744230&view=rev
Log:
Added a boot delegation test for the framework.
Added:
felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.bootdelegation/
(with props)
felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.bootdelegation/bnd.bnd
felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.bootdelegation/build.xml
felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.bootdelegation/src/
felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.bootdelegation/src/org/
felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.bootdelegation/src/org/apache/
felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.bootdelegation/src/org/apache/felix/
felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.bootdelegation/src/org/apache/felix/framework/
felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.bootdelegation/src/org/apache/felix/framework/bootdelegation/
felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.bootdelegation/src/org/apache/felix/framework/bootdelegation/BootDelegationTest.java
Propchange:
felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.bootdelegation/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Feb 13 20:25:49 2009
@@ -0,0 +1,23 @@
+tmp
+classes
+target
+*.log
+*.ipr
+*.iws
+*.iml
+lib
+bundle
+dist
+.project
+.classpath
+bin
+build
+.settings
+.wtpmodules
+.deployables
+nbbuild.xml
+nbproject
+*.patch
+.externalToolBuilders
+maven-eclipse.xml
+
Added:
felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.bootdelegation/bnd.bnd
URL:
http://svn.apache.org/viewvc/felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.bootdelegation/bnd.bnd?rev=744230&view=auto
==============================================================================
---
felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.bootdelegation/bnd.bnd
(added)
+++
felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.bootdelegation/bnd.bnd
Fri Feb 13 20:25:49 2009
@@ -0,0 +1,12 @@
+Private-Package: ${p}
+
+-buildpath: \
+ org.osgi.core; version=1.2.0, \
+ org.osgi.foundation; version=1.2.0, \
+ junit.junit
+
+
+-runproperties: report=true, \
+ org.osgi.framework.bootdelegation="javax.swing.text.html.*"
+
+Test-Cases = ${classes;extending;*TestCase}
Added:
felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.bootdelegation/build.xml
URL:
http://svn.apache.org/viewvc/felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.bootdelegation/build.xml?rev=744230&view=auto
==============================================================================
---
felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.bootdelegation/build.xml
(added)
+++
felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.bootdelegation/build.xml
Fri Feb 13 20:25:49 2009
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="project" default="publish">
+ <import file="../cnf/build.xml"/>
+</project>
Added:
felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.bootdelegation/src/org/apache/felix/framework/bootdelegation/BootDelegationTest.java
URL:
http://svn.apache.org/viewvc/felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.bootdelegation/src/org/apache/felix/framework/bootdelegation/BootDelegationTest.java?rev=744230&view=auto
==============================================================================
---
felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.bootdelegation/src/org/apache/felix/framework/bootdelegation/BootDelegationTest.java
(added)
+++
felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.bootdelegation/src/org/apache/felix/framework/bootdelegation/BootDelegationTest.java
Fri Feb 13 20:25:49 2009
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.framework.bootdelegation;
+
+import junit.framework.TestCase;
+import org.osgi.framework.BundleContext;
+
+public class BootDelegationTest extends TestCase
+{
+ private volatile BundleContext m_context;
+
+ public void setBundleContext(BundleContext context)
+ {
+ m_context = context;
+ }
+
+ public void testBootDelegation() throws Exception
+ {
+ // This test has configured the framework to boot delegate
+ // java.* (by default) and javax.swing.text.html.*.
+ Class clazz = null;
+
+ // Should NOT throw an exception.
+ clazz = Class.forName("java.util.Map");
+ // SHOULD throw an exception.
+ try
+ {
+ clazz = Class.forName("javax.swing.JComponent");
+ throw new Exception("Class should not be visible: " + clazz);
+ }
+ catch (ClassNotFoundException ex)
+ {
+ // Ignore.
+ }
+ // Should NOT throw an exception.
+ clazz = Class.forName("javax.swing.text.html.BlockView");
+ // Should NOT throw an exception.
+ clazz = Class.forName("javax.swing.text.html.parser.AttributeList");
+ // SHOULD throw an exception.
+ try
+ {
+ clazz = Class.forName("javax.swing.text.Document");
+ throw new Exception("Class should not be visible: " + clazz);
+ }
+ catch (ClassNotFoundException ex)
+ {
+ // Ignore.
+ }
+ }
+}
\ No newline at end of file