@@ -0,0 +1,3511 @@
+/**%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.itests.exam;%0A%0Aimport static org.hamcrest.CoreMatchers.is;%0Aimport static org.junit.Assert.assertThat;%0A%0Aimport java.util.Hashtable;%0A%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0Aimport org.openengsb.core.common.AbstractOpenEngSBService;%0Aimport org.openengsb.core.common.AliveState;%0Aimport org.openengsb.core.common.DomainEndpointFactory;%0Aimport org.openengsb.core.common.context.ContextHolder;%0Aimport org.openengsb.domain.example.ExampleDomain;%0Aimport org.openengsb.domain.example.event.LogEvent;%0Aimport org.openengsb.itests.util.AbstractExamTestHelper;%0Aimport org.ops4j.pax.exam.junit.JUnit4TestRunner;%0Aimport org.osgi.framework.Constants;%0A%0A@RunWith(JUnit4TestRunner.class)%0Apublic class DomainEndpointFactoryIT extends AbstractExamTestHelper %7B%0A    private static class DummyService extends AbstractOpenEngSBService implements ExampleDomain %7B%0A%0A        public DummyService(String instanceId) %7B%0A            super(instanceId);%0A        %7D%0A%0A        @Override%0A        public String doSomething(ExampleEnum exampleEnum) %7B%0A            throw new UnsupportedOperationException(%22Not yet implemented%22);%0A        %7D%0A%0A        @Override%0A        public String doSomething(String message) %7B%0A            throw new UnsupportedOperationException(%22Not yet implemented%22);%0A        %7D%0A%0A        @Override%0A        public String doSomethingWithLogEvent(LogEvent event) %7B%0A            throw new UnsupportedOperationException(%22Not yet implemented%22);%0A        %7D%0A%0A        @Override%0A        public AliveState getAliveState() %7B%0A            throw new UnsupportedOperationException(%22Not yet implemented%22);%0A        %7D%0A%0A    %7D%0A%0A    @Test%0A    public void testSingleMethodProxies() throws Exception %7B%0A        ExampleDomain service = new DummyService(%22test%22);%0A        Hashtable%3CString, Object%3E properties = new Hashtable%3CString, Object%3E();%0A        properties.put(%22id%22, %22test%22);%0A        properties.put(Constants.SERVICE_RANKING, -1);%0A        properties.put(%22location.root%22, %22foo%22);%0A        getBundleContext().registerService(ExampleDomain.class.getName(), service, properties);%0A%0A        ContextHolder.get().setCurrentContextId(%22foo%22);%0A        ExampleDomain domainEndpoint = DomainEndpointFactory.getDomainEndpoint(ExampleDomain.class, %22foo%22);%0A        assertThat(domainEndpoint.getInstanceId(), is(%22test%22));%0A%0A        service = new DummyService(%22test2%22);%0A        properties = new Hashtable%3CString, Object%3E();%0A        properties.put(%22id%22, %22test2%22);%0A        properties.put(%22location.foo%22, %22foo2%22);%0A        properties.put(Constants.SERVICE_RANKING, 1);%0A%0A        /* create the proxy before the service is registered */%0A        ExampleDomain domainEndpoint2 = DomainEndpointFactory.getDomainEndpoint(ExampleDomain.class, %22foo2%22);%0A        getBundleContext().registerService(ExampleDomain.class.getName(), service, properties);%0A%0A        assertThat(domainEndpoint2.getInstanceId(), is(%22test2%22));%0A    %7D%0A%7D%0A

add integrationtest