Return-Path: Delivered-To: apmail-incubator-sling-commits-archive@locus.apache.org Received: (qmail 57917 invoked from network); 4 Jan 2008 16:41:42 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 4 Jan 2008 16:41:42 -0000 Received: (qmail 54293 invoked by uid 500); 4 Jan 2008 16:41:31 -0000 Delivered-To: apmail-incubator-sling-commits-archive@incubator.apache.org Received: (qmail 54266 invoked by uid 500); 4 Jan 2008 16:41:31 -0000 Mailing-List: contact sling-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: sling-dev@incubator.apache.org Delivered-To: mailing list sling-commits@incubator.apache.org Received: (qmail 54257 invoked by uid 99); 4 Jan 2008 16:41:31 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Jan 2008 08:41:31 -0800 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Jan 2008 16:41:27 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id F009C1A983A; Fri, 4 Jan 2008 08:41:18 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r608914 [2/2] - in /incubator/sling/whiteboard/fmeschbe/resource/osgi/commons: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/sling/ src/main/java/org/apache/sling/osgi/ src/main/java/... Date: Fri, 04 Jan 2008 16:41:10 -0000 To: sling-commits@incubator.apache.org From: fmeschbe@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080104164118.F009C1A983A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Added: incubator/sling/whiteboard/fmeschbe/resource/osgi/commons/src/test/java/org/apache/sling/osgi/commons/mock/MockComponentContext.java URL: http://svn.apache.org/viewvc/incubator/sling/whiteboard/fmeschbe/resource/osgi/commons/src/test/java/org/apache/sling/osgi/commons/mock/MockComponentContext.java?rev=608914&view=auto ============================================================================== --- incubator/sling/whiteboard/fmeschbe/resource/osgi/commons/src/test/java/org/apache/sling/osgi/commons/mock/MockComponentContext.java (added) +++ incubator/sling/whiteboard/fmeschbe/resource/osgi/commons/src/test/java/org/apache/sling/osgi/commons/mock/MockComponentContext.java Fri Jan 4 08:41:06 2008 @@ -0,0 +1,79 @@ +/* + * 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.sling.osgi.commons.mock; + +import java.util.Dictionary; +import java.util.HashMap; +import java.util.Map; + +import org.apache.sling.osgi.commons.AdapterFactory; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceReference; +import org.osgi.service.component.ComponentContext; +import org.osgi.service.component.ComponentInstance; + +public class MockComponentContext implements ComponentContext { + + private Map services = new HashMap(); + + public Object locateService(String name, ServiceReference reference) { + AdapterFactory af = services.get(reference); + if (af == null) { + af = new MockAdapterFactory(); + services.put(reference, af); + } + return af; + } + + public void disableComponent(String name) { + } + + public void enableComponent(String name) { + } + + public BundleContext getBundleContext() { + return null; + } + + public ComponentInstance getComponentInstance() { + return null; + } + + public Dictionary getProperties() { + return null; + } + + public ServiceReference getServiceReference() { + return null; + } + + public Bundle getUsingBundle() { + return null; + } + + public Object locateService(String name) { + return null; + } + + public Object[] locateServices(String name) { + return null; + } + +} Propchange: incubator/sling/whiteboard/fmeschbe/resource/osgi/commons/src/test/java/org/apache/sling/osgi/commons/mock/MockComponentContext.java ------------------------------------------------------------------------------ svn:eol-style = native Added: incubator/sling/whiteboard/fmeschbe/resource/osgi/commons/src/test/java/org/apache/sling/osgi/commons/mock/MockServiceReference.java URL: http://svn.apache.org/viewvc/incubator/sling/whiteboard/fmeschbe/resource/osgi/commons/src/test/java/org/apache/sling/osgi/commons/mock/MockServiceReference.java?rev=608914&view=auto ============================================================================== --- incubator/sling/whiteboard/fmeschbe/resource/osgi/commons/src/test/java/org/apache/sling/osgi/commons/mock/MockServiceReference.java (added) +++ incubator/sling/whiteboard/fmeschbe/resource/osgi/commons/src/test/java/org/apache/sling/osgi/commons/mock/MockServiceReference.java Fri Jan 4 08:41:06 2008 @@ -0,0 +1,62 @@ +/* + * 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.sling.osgi.commons.mock; + +import java.util.Collections; +import java.util.Dictionary; +import java.util.Hashtable; + +import org.osgi.framework.Bundle; +import org.osgi.framework.ServiceReference; + +public class MockServiceReference implements ServiceReference { + + private Bundle bundle; + private Dictionary props; + + public MockServiceReference(Bundle bundle) { + this.bundle = bundle; + this.props = new Hashtable(); + } + + public Bundle getBundle() { + return bundle; + } + + public void setProperty(String key, Object value) { + props.put(key, value); + } + + public Object getProperty(String key) { + return props.get(key); + } + + public String[] getPropertyKeys() { + return Collections.list(props.keys()).toArray(new String[props.size()]); + } + + public Bundle[] getUsingBundles() { + return null; + } + + public boolean isAssignableTo(Bundle bundle, String className) { + return false; + } + +} Propchange: incubator/sling/whiteboard/fmeschbe/resource/osgi/commons/src/test/java/org/apache/sling/osgi/commons/mock/MockServiceReference.java ------------------------------------------------------------------------------ svn:eol-style = native