Package org.zanata.webtrans.shared.auth

Examples of org.zanata.webtrans.shared.auth.EditorClientId


                Matchers.equalTo(personId));
    }

    @Test
    public void canRemoveClient() {
        EditorClientId editorClientId = new EditorClientId("sessionId", 1);
        PersonId personId = new PersonId("personId");
        translationWorkspace.addEditorClient("sessionId", editorClientId,
                personId);
        assertThat(translationWorkspace.getUsers(),
                Matchers.hasKey(editorClientId));
View Full Code Here


    @Test
    public void canRemoveClientsWithSameSessionId() {
        // Given: 2 client share same http session id
        String httpSessionId = "sessionId";
        EditorClientId editorClientId1 = new EditorClientId(httpSessionId, 1);
        EditorClientId editorClientId2 = new EditorClientId(httpSessionId, 2);
        PersonId personId = new PersonId("personId");
        translationWorkspace.addEditorClient(httpSessionId, editorClientId1,
                personId);
        translationWorkspace.addEditorClient(httpSessionId, editorClientId2,
                personId);
View Full Code Here

        // assertThat(translationWorkspace.getUsers(), is(anEmptyMap()));
    }

    @Test
    public void canUpdateUserSelection() {
        EditorClientId editorClientId = new EditorClientId("sessionId", 1);
        translationWorkspace.addEditorClient("sessionId", editorClientId,
                new PersonId("personId"));
        TransUnit selectedTransUnit = TestFixture.makeTransUnit(1);

        translationWorkspace.updateUserSelection(editorClientId,
View Full Code Here

    @Test
    public void onTimeoutRemove() {
        ConcurrentMap<EditorClientId, PersonId> sessions =
                new MapMaker().makeMap();
        sessions.put(new EditorClientId("a", 1), new PersonId("person a"));
        sessions.put(new EditorClientId("b", 1), new PersonId("person b"));

        sessions.remove(new EditorClientId("a", 1));
    }
View Full Code Here

    @Test
    public void testExecute() throws Exception {
        Person person = TestFixture.person();
        TransUnit selectedTransUnit = TestFixture.makeTransUnit(1);
        WorkspaceId workspaceId = TestFixture.workspaceId();
        EditorClientId editorClientId = new EditorClientId("sessionId", 1);
        TransUnitEditAction action =
                new TransUnitEditAction(person, selectedTransUnit.getId());
        action.setWorkspaceId(workspaceId);
        action.setEditorClientId(editorClientId);
        when(translationWorkspaceManager.getOrRegisterWorkspace(workspaceId))
View Full Code Here

        jaHLocale = getEm().find(HLocale.class, 3L);
    }

    private void prepareActionAndMockLocaleService(GetTransUnitList action) {
        action.setEditorClientId(new EditorClientId("sessionId", 1));
        action.setWorkspaceId(TestFixture.workspaceId(localeId, "plurals",
                "master", ProjectType.Podir));
        ProjectIterationId projectIterationId =
                action.getWorkspaceId().getProjectIterationId();
        when(
View Full Code Here

        ActivateWorkspaceResult result = handler.execute(action, null);

        verify(identity).checkLoggedIn();
        verify(translationWorkspace).addEditorClient(eq(HTTP_SESSION_ID),
                editorClientIdCaptor.capture(), eq(person.getId()));
        EditorClientId editorClientId = editorClientIdCaptor.getValue();
        assertThat(editorClientId.getHttpSessionId(),
                Matchers.equalTo(HTTP_SESSION_ID));

        verify(translationWorkspace).publish(
                enterWorkspaceEventCaptor.capture());
        EnterWorkspace enterWorkspace = enterWorkspaceEventCaptor.getValue();
View Full Code Here

    }

    @Test
    public void testExecute() throws Exception {
        Person person = TestFixture.person();
        EditorClientId editorClientId = new EditorClientId("sessionId", 1);
        WorkspaceId workspaceId = TestFixture.workspaceId();
        when(translationWorkspaceManager.getOrRegisterWorkspace(workspaceId))
                .thenReturn(translationWorkspace);
        ExitWorkspaceAction action = new ExitWorkspaceAction(person);
        action.setEditorClientId(editorClientId);
View Full Code Here

    }

    @Test
    public void testExecute() throws ActionException {
        WorkspaceId workspaceId = TestFixture.workspaceId();
        EditorClientId editorClientId = new EditorClientId("sessionId", 1);
        EventServiceConnectedAction action =
                new EventServiceConnectedAction("connectionId");
        action.setWorkspaceId(workspaceId);
        action.setEditorClientId(editorClientId);
        when(translationWorkspaceManager.getOrRegisterWorkspace(workspaceId))
View Full Code Here

TOP

Related Classes of org.zanata.webtrans.shared.auth.EditorClientId

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.