@@ -0,0 +1,2769 @@
+/**%0A%0A   Copyright 2010 OpenEngSB Division, Vienna University of Technology%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%0A */%0Apackage org.openengsb.core.common;%0A%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0Aimport org.openengsb.core.common.context.ContextService;%0Aimport org.osgi.framework.BundleContext;%0Aimport org.osgi.framework.InvalidSyntaxException;%0Aimport org.osgi.framework.ServiceReference;%0A%0Aimport static org.mockito.Matchers.anyString;%0Aimport static org.mockito.Matchers.contains;%0A%0Aimport static org.mockito.Mockito.mock;%0Aimport static org.mockito.Mockito.when;%0A%0Aimport static org.junit.Assert.assertTrue;%0A%0Apublic class DomainProxyFactoryTest %7B%0A%0A    public interface TestInterface extends Domain %7B%0A        boolean methodx();%0A    %7D%0A%0A    public class DefaultImpl implements TestInterface %7B%0A        public boolean methodx() %7B%0A            return true;%0A        %7D%0A    %7D%0A%0A    private DefaultImpl targetService;%0A    private ContextService contextMock;%0A    private BundleContext bundleContextMock;%0A%0A    @Before%0A    public void setUp() throws Exception %7B%0A        targetService = new DefaultImpl();%0A        setupContextMock();%0A        setupBundleContextMock();%0A    %7D%0A%0A    private void setupBundleContextMock() throws InvalidSyntaxException %7B%0A        bundleContextMock = mock(BundleContext.class);%0A        ServiceReference serviceRefMock = mock(ServiceReference.class);%0A        when(bundleContextMock.getServiceReferences(anyString(), contains(%22testService%22))).thenReturn(%0A                new ServiceReference%5B%5D %7B serviceRefMock %7D);%0A        when(bundleContextMock.getService(serviceRefMock)).thenReturn(targetService);%0A    %7D%0A%0A    private void setupContextMock() %7B%0A        contextMock = mock(ContextService.class);%0A        when(contextMock.getValue(anyString())).thenReturn(%22testService%22);%0A    %7D%0A%0A    @Test%0A    public void testSelectCorrectConnector() throws Exception %7B%0A        DefaultDomainProxyFactoryBean factory = new DefaultDomainProxyFactoryBean();%0A        factory.setDomainInterface(TestInterface.class);%0A        factory.setContext(contextMock);%0A        factory.setDomainName(%22testDomain%22);%0A        factory.setBundleContext(bundleContextMock);%0A%0A        TestInterface obj = (TestInterface) factory.getObject();%0A%0A        assertTrue(obj.methodx());%0A    %7D%0A%0A%7D%0A

add test for DomainProxyFactory