@@ -0,0 +1,2366 @@
+/*%0A * Copyright (c) IBM Corporation (2009). All Rights Reserved.%0A * %0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *      http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage org.osgi.test.cases.webcontainer.handler;%0A%0Aimport java.util.Dictionary;%0Aimport java.util.Hashtable;%0A%0Aimport org.osgi.framework.BundleActivator;%0Aimport org.osgi.framework.BundleContext;%0Aimport org.osgi.service.event.Event;%0Aimport org.osgi.service.event.EventConstants;%0Aimport org.osgi.service.event.EventHandler;%0A%0A/**%0A * @version $Rev$ $Date$%0A * %0A *          TestEventHandler to verify Events are published by the web extender%0A *          bundle at certain situations defined by rfc 66%0A */%0Apublic class ExtenderTestEventHandler implements EventHandler, BundleActivator %7B%0A%0A    static Event eventPrevious;%0A    static Event eventCurrent;%0A    final static String%5B%5D topics = new String%5B%5D %7B%0A            %22org/osgi/service/web/STARTING%22,%0A            %22org/osgi/service/web/STARTED%22,%0A            %22org/osgi/service/web/STOPPING%22,%0A            %22org/osgi/service/web/STOPPED%22,%0A            %22org/osgi/service/web/FAILED%22 %7D;%0A%0A    public void start(BundleContext context) %7B%0A        Dictionary d = new Hashtable();%0A        d.put(EventConstants.EVENT_TOPIC, topics);%0A        d.put(EventConstants.EVENT_FILTER, %22(bundle.symbolicName=org.osgi.test.cases.webcontainer.tw*)%22);%0A        context.registerService(EventHandler.class.getName(), this, d);%0A    %7D%0A%0A    public void stop(BundleContext context) throws Exception %7B%0A    %7D%0A%0A    public void handleEvent(Event event) %7B%0A        // let's record the event%0A        eventPrevious = eventCurrent;%0A        eventCurrent = event;%0A    %7D%0A    %0A    public static Event getCurrentEvent() %7B%0A        return eventCurrent;%0A    %7D%0A%0A    public static Event getPreviousEvent() %7B%0A        return eventPrevious;%0A    %7D%0A    %0A    public static void clearEvents() %7B%0A        eventCurrent = null;%0A        eventPrevious = null;%0A    %7D%0A%7D%0A

add test cases to test the newly defined web extender integration with event admin service