Package org.openengsb.core.test

Examples of org.openengsb.core.test.NullDomainImpl


        tester.assertRenderedPage(ServiceListPage.class);
    }

    @Test
    public void testVerifyListViews_shouldShowServiceStatus() throws Exception {
        NullDomainImpl domainService = new NullDomainImpl();
        domainService.setAliveState(AliveState.CONNECTING);

        Dictionary<String, Object> props = new Hashtable<String, Object>();
        props.put(org.osgi.framework.Constants.SERVICE_PID, "test-service");
        props.put("testprop", "42");
        registerService(domainService, props, NullDomain.class, Domain.class, OpenEngSBService.class);
View Full Code Here


    public void testCreateConnectorWithSkipDomainType_shouldNotInvokeSetDomainType() throws Exception {
        Map<String, String> attributes = new HashMap<String, String>();
        attributes.put(Constants.SKIP_SET_DOMAIN_TYPE, "true");
        Map<String, Object> properties = new Hashtable<String, Object>();
        properties.put("foo", "bar");
        NullDomainImpl mock2 = mock(NullDomainImpl.class);
        when(factory.createNewInstance(anyString())).thenReturn(mock2);
        ConnectorDescription connectorDescription = new ConnectorDescription("test", "testc", attributes, properties);
        connectorManager.create(connectorDescription);
        verify(mock2, never()).setDomainId(anyString());
        verify(mock2, never()).setConnectorId(anyString());
View Full Code Here

    }

    @SuppressWarnings("unchecked")
    private void registerMockedFactory() throws Exception {
        factory = mock(ConnectorInstanceFactory.class);
        when(factory.createNewInstance(anyString())).thenReturn(new NullDomainImpl());
        when(factory.applyAttributes(any(Connector.class), anyMap())).thenAnswer(new Answer<Connector>() {
            @Override
            public Connector answer(InvocationOnMock invocation) throws Throwable {
                return (Connector) invocation.getArguments()[0];
            }
View Full Code Here

    @Before
    public void init() {
        osgiServiceMock = mock(DefaultOsgiUtilsService.class);
        final List<DomainProvider> domainProviders = new ArrayList<DomainProvider>();
        final List<Domain> domainEndpoints = new ArrayList<Domain>();
        Domain domainEndpoint = new NullDomainImpl("id");
        domainEndpoints.add(domainEndpoint);
        DomainProvider domainProviderMock = mock(DomainProvider.class);
        when(domainProviderMock.getDomainInterface()).thenAnswer(new Answer<Class<? extends Domain>>() {
            @Override
            public Class<? extends Domain> answer(InvocationOnMock invocationOnMock) throws Throwable {
View Full Code Here

        assertThat(accessControl.checkAccess("admin", invocation), Matchers.is(Access.GRANTED));
    }

    @Test
    public void testCheckServiceAccess_shouldGrant() throws Exception {
        NullDomainImpl nullDomainImpl = new NullDomainImpl("foo");
        MethodInvocation invocation = MethodInvocationUtils.create(nullDomainImpl, "nullMethod");

        userManager.addPermissionToUser("testuser", new ServicePermission(NullDomain.class.getName()));

        assertThat(accessControl.checkAccess("testuser", invocation), Matchers.is(Access.GRANTED));
View Full Code Here

        assertThat(accessControl.checkAccess("testuser", invocation), Matchers.is(Access.GRANTED));
    }

    @Test
    public void testCheckServiceAccessByName_shouldGrant() throws Exception {
        NullDomainImpl nullDomainImpl = new NullDomainImpl("foo");
        MethodInvocation invocation = MethodInvocationUtils.create(nullDomainImpl, "nullMethod");

        userManager.addPermissionToUser("testuser", new ServicePermission("NULL"));

        assertThat(accessControl.checkAccess("testuser", invocation), Matchers.is(Access.GRANTED));
View Full Code Here

        assertThat(accessControl.checkAccess("testuser", invocation), Matchers.is(Access.GRANTED));
    }

    @Test
    public void testCheckMethodAccessByName_shouldGrant() throws Exception {
        NullDomainImpl nullDomainImpl = new NullDomainImpl("foo");
        MethodInvocation invocation = MethodInvocationUtils.create(nullDomainImpl, "nullMethod", new Object());

        userManager.addPermissionToUser("testuser", new ServicePermission("NULL", "READ_NULL"));

        assertThat(accessControl.checkAccess("testuser", invocation), Matchers.is(Access.GRANTED));
View Full Code Here

        assertThat(accessControl.checkAccess("testuser", invocation), Matchers.is(Access.GRANTED));
    }

    @Test
    public void testCheckMethodAccessByWrongName_shouldDeny() throws Exception {
        NullDomainImpl nullDomainImpl = new NullDomainImpl("foo");
        MethodInvocation invocation = MethodInvocationUtils.create(nullDomainImpl, "nullMethod", new Object());

        userManager.addPermissionToUser("testuser", new ServicePermission("NULL", "GET_NULL"));

        assertThat(accessControl.checkAccess("testuser", invocation), Matchers.is(Access.ABSTAINED));
View Full Code Here

        assertThat(accessControl.checkAccess("testuser", invocation), Matchers.is(Access.ABSTAINED));
    }

    @Test
    public void testCheckMethodAccessByMethodName_shouldGrant() throws Exception {
        NullDomainImpl nullDomainImpl = new NullDomainImpl("foo");
        MethodInvocation invocation = MethodInvocationUtils.create(nullDomainImpl, "nullMethod", new Object());

        userManager.addPermissionToUser("testuser", new ServicePermission("NULL", "nullMethod"));

        assertThat(accessControl.checkAccess("testuser", invocation), Matchers.is(Access.GRANTED));
View Full Code Here

        assertThat(accessControl.checkAccess("testuser", invocation), Matchers.is(Access.GRANTED));
    }

    @Test
    public void testCheckServiceInstanceAccessById_shouldGrant() throws Exception {
        NullDomainImpl nullDomainImpl = new NullDomainImpl("foo");
        MethodInvocation invocation = MethodInvocationUtils.create(nullDomainImpl, "nullMethod", new Object());

        attributeStore.putAttribute(nullDomainImpl, new SecurityAttributeEntry("name", "service.foo"));

        ServicePermission permission = new ServicePermission();
View Full Code Here

TOP

Related Classes of org.openengsb.core.test.NullDomainImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.