Skip to content

Package: MultiSegmentConverter_ITest

MultiSegmentConverter_ITest

nameinstructionbranchcomplexitylinemethod
MultiSegmentConverter_ITest()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
testServiceRegistrationAndType()
M: 0 C: 49
100%
M: 1 C: 3
75%
M: 1 C: 2
67%
M: 0 C: 17
100%
M: 0 C: 1
100%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2011-2018 EclipseSource Muenchen GmbH and others.
3: *
4: * All rights reserved. This program and the accompanying materials
5: * are made available under the terms of the Eclipse Public License 2.0
6: * which accompanies this distribution, and is available at
7: * https://www.eclipse.org/legal/epl-2.0/
8: *
9: * SPDX-License-Identifier: EPL-2.0
10: *
11: * Contributors:
12: * Lucas Koehler - initial API and implementation
13: ******************************************************************************/
14: package org.eclipse.emfforms.internal.core.services.segments.multi;
15:
16: import static org.junit.Assert.assertNotNull;
17:
18: import java.util.Collection;
19:
20: import org.eclipse.emfforms.spi.core.services.databinding.emf.DomainModelReferenceSegmentConverterEMF;
21: import org.junit.Test;
22: import org.osgi.framework.BundleContext;
23: import org.osgi.framework.FrameworkUtil;
24: import org.osgi.framework.InvalidSyntaxException;
25: import org.osgi.framework.ServiceReference;
26:
27: /**
28: * All JUnit integration tests for {@link MultiSegmentConverter}.
29: *
30: * @author Lucas Koehler
31: *
32: */
33: public class MultiSegmentConverter_ITest {
34:
35:         @Test
36:         public void testServiceRegistrationAndType() throws InvalidSyntaxException {
37:                 final BundleContext bundleContext = FrameworkUtil
38:                         .getBundle(MultiSegmentConverter_ITest.class)
39:                         .getBundleContext();
40:
41:                 final Collection<ServiceReference<DomainModelReferenceSegmentConverterEMF>> serviceReferences = bundleContext
42:                         .getServiceReferences(DomainModelReferenceSegmentConverterEMF.class, null);
43:                 DomainModelReferenceSegmentConverterEMF multiConverter = null;
44:                 ServiceReference<DomainModelReferenceSegmentConverterEMF> serviceReference = null;
45:•                for (final ServiceReference<DomainModelReferenceSegmentConverterEMF> curRef : serviceReferences) {
46:                         final DomainModelReferenceSegmentConverterEMF curService = bundleContext.getService(curRef);
47:•                        if (MultiSegmentConverter.class.isInstance(curService)) {
48:                                 multiConverter = curService;
49:                                 serviceReference = curRef;
50:                                 break;
51:                         }
52:                         bundleContext.ungetService(curRef);
53:                 }
54:
55:                 assertNotNull(multiConverter);
56:                 bundleContext.ungetService(serviceReference);
57:         }
58:
59: }