Examples of canHandle()


Examples of gov.nasa.arc.mct.gui.menu.ImportMenu.ObjectsImportMenu.canHandle()

       
       
        // Second, Objects's Import menu
        // Null selections - should disallow
        Mockito.when(mockContext.getSelectedManifestations()).thenReturn(null);
        Assert.assertFalse(objsMenu.canHandle(mockContext));

        // Empty selections - should disallow
        Mockito.when(mockContext.getSelectedManifestations())
            .thenReturn(Collections.<View>emptyList());
        Assert.assertFalse(objsMenu.canHandle(mockContext));
View Full Code Here

Examples of gov.nasa.arc.mct.gui.menu.ImportMenu.ThisImportMenu.canHandle()

        Mockito.when(mockPlatform.getPolicyManager()).thenReturn(mockPolicy);
       
        // First, This's Import menu
        // No window active - should disallow
        Mockito.when(mockContext.getWindowManifestation()).thenReturn(null);
        Assert.assertFalse(thisMenu.canHandle(mockContext));
       
        // Active window but component is null - should disallow
        Mockito.when(mockContext.getWindowManifestation()).thenReturn(mockView);
        Mockito.when(mockView.getManifestedComponent()).thenReturn(null);
        Assert.assertFalse(thisMenu.canHandle(mockContext));
View Full Code Here

Examples of org.apache.ace.authentication.api.AuthenticationProcessor.canHandle()

       
        List<AuthenticationProcessor> result = new ArrayList<AuthenticationProcessor>(size);
        for (int i = 0; i < size; i++) {
            AuthenticationProcessor authenticationProcessor = processors.get(i).getAuthenticationProcessor();
            // Can be null if it is already GC'd for some reason...
            if ((authenticationProcessor != null) && authenticationProcessor.canHandle(context)) {
                result.add(authenticationProcessor);
            }
        }

        return result;
View Full Code Here

Examples of org.apache.ace.authentication.api.AuthenticationProcessor.canHandle()

    @Test(groups = { UNIT })
    public void testAuthenticateFailsWithSingleAuthProcessorAndWrongContext() {
        AuthenticationServiceImpl authService = createAuthenticationService();
       
        AuthenticationProcessor authProc = mock(AuthenticationProcessor.class);
        when(authProc.canHandle(anyString())).thenReturn(Boolean.TRUE);

        registerAuthProcessor(authService, authProc);

        assert authService.authenticate("foo", "bar") == null;
    }
View Full Code Here

Examples of org.apache.ace.authentication.api.AuthenticationProcessor.canHandle()

       
        User user1 = mock(User.class);
        User user2 = mock(User.class);

        AuthenticationProcessor authProc1 = mock(AuthenticationProcessor.class);
        when(authProc1.canHandle(any())).thenAnswer(new Answer<Boolean>() {
            public Boolean answer(InvocationOnMock invocation) throws Throwable {
                Object[] args = invocation.getArguments();
                return (args.length == 1 && args[0] instanceof Date);
            }
        });
View Full Code Here

Examples of org.apache.ace.authentication.api.AuthenticationProcessor.canHandle()

            }
        });
        when(authProc1.authenticate(Mockito.<UserAdmin>any(), eq(now))).thenReturn(user1);

        AuthenticationProcessor authProc2 = mock(AuthenticationProcessor.class);
        when(authProc2.canHandle(anyString())).thenAnswer(new Answer<Boolean>() {
            public Boolean answer(InvocationOnMock invocation) throws Throwable {
                Object[] args = invocation.getArguments();
                return (args.length == 1 && args[0] instanceof String);
            }
        });
View Full Code Here

Examples of org.apache.ace.authentication.api.AuthenticationProcessor.canHandle()

        AuthenticationServiceImpl authService = createAuthenticationService();

        User user = mock(User.class);

        AuthenticationProcessor authProc = mock(AuthenticationProcessor.class);
        when(authProc.canHandle(anyString())).thenReturn(Boolean.TRUE);
        when(authProc.authenticate(Mockito.<UserAdmin>any(), eq("foo"))).thenReturn(user);

        registerAuthProcessor(authService, authProc);

        assert authService.authenticate("foo") != null;
View Full Code Here

Examples of org.apache.ace.authentication.api.AuthenticationProcessor.canHandle()

       
        User user1 = mock(User.class);
        User user2 = mock(User.class);

        AuthenticationProcessor authProc1 = mock(AuthenticationProcessor.class);
        when(authProc1.canHandle(any())).thenAnswer(new Answer<Boolean>() {
            public Boolean answer(InvocationOnMock invocation) throws Throwable {
                Object[] args = invocation.getArguments();
                return (args.length == 1 && args[0] instanceof Date);
            }
        });
View Full Code Here

Examples of org.apache.ace.authentication.api.AuthenticationProcessor.canHandle()

            }
        });
        when(authProc1.authenticate(Mockito.<UserAdmin>any(), eq(now))).thenReturn(user1);

        AuthenticationProcessor authProc2 = mock(AuthenticationProcessor.class);
        when(authProc2.canHandle(anyString())).thenAnswer(new Answer<Boolean>() {
            public Boolean answer(InvocationOnMock invocation) throws Throwable {
                Object[] args = invocation.getArguments();
                return (args.length == 1 && args[0] instanceof String);
            }
        });
View Full Code Here

Examples of org.apache.ace.client.repository.helper.ArtifactRecognizer.canHandle()

        String foundMimetype = null;
        for (ServiceReference ref : refs) {
            ArtifactRecognizer candidate = (ArtifactRecognizer) m_context.getService(ref);
            try {
                if (mimetype != null) {
                    if (candidate.canHandle(mimetype)) {
                        recognizer = candidate;
                        break;
                    }
                }
                else {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.