Package org.zanata.seam

Examples of org.zanata.seam.SeamAutowire


    }

    @Override
    protected void prepareResources() {
        MockitoAnnotations.initMocks(this);
        SeamAutowire seamAutowire = getSeamAutowire();
        seamAutowire.use("entityManager", getEm()).use("session", getSession())
                .use("identity", Mockito.mock(ZanataIdentity.class))
                .useImpl(LocaleServiceImpl.class)
                .useImpl(CopyTransServiceImpl.class)
                .useImpl(DocumentServiceImpl.class)
                .useImpl(TranslationServiceImpl.class)
                .useImpl(ValidationServiceImpl.class)
                .useImpl(VersionStateCacheImpl.class)
                .useImpl(TranslationStateCacheImpl.class);

        SourceDocResourceService sourceDocResourceService =
                seamAutowire.autowire(SourceDocResourceService.class);
        TranslatedDocResourceService translatedDocResourceService =
                seamAutowire.autowire(TranslatedDocResourceService.class);

        resources.add(sourceDocResourceService);
        resources.add(translatedDocResourceService);
    }
View Full Code Here


                true);
        ZanataCredentials credentials = new ZanataCredentials();
        credentials.setUsername("testuser");
        when(mockIdentity.getCredentials()).thenReturn(credentials);

        SeamAutowire seamAutowire = getSeamAutowire();
        seamAutowire.use("session", getSession()).use("identity", mockIdentity)
                .useImpl(CopyTransServiceImpl.class)
                .useImpl(LocaleServiceImpl.class)
                .simulateSessionContext(true);

        CopyTransResource copyTransResource =
                seamAutowire.autowire(CopyTransResourceService.class);

        resources.add(copyTransResource);
    }
View Full Code Here

                DatabaseOperation.CLEAN_INSERT));
    }

    @Override
    protected void prepareResources() {
        SeamAutowire seamAutowire = getSeamAutowire();
        seamAutowire.use("session", getSession()).use("identity", mockIdentity);

        ProjectService projectService =
                seamAutowire.autowire(ProjectService.class);

        resources.add(projectService);
    }
View Full Code Here

                DatabaseOperation.CLEAN_INSERT));
    }

    @Override
    protected void prepareResources() {
        SeamAutowire seamAutowire = getSeamAutowire();
        seamAutowire.use("session", getSession());

        ProjectIterationService projectIterationService =
                seamAutowire.autowire(ProjectIterationService.class);

        resources.add(projectIterationService);
    }
View Full Code Here

                DatabaseOperation.CLEAN_INSERT));
    }

    @Override
    protected void prepareResources() {
        SeamAutowire seamAutowire = getSeamAutowire();
        // @formatter:off
      seamAutowire.ignoreNonResolvable()
            .use("session", getSession())
            .use("identity", mockIdentity)
            .useImpl(LocaleServiceImpl.class)
            .useImpl(GlossaryFileServiceImpl.class);
      // @formatter:on

        GlossaryService glossaryService =
                seamAutowire.autowire(GlossaryService.class);

        resources.add(glossaryService);
    }
View Full Code Here

    ClientRequestFactory clientRequestFactory;
    IProjectsResource projectService;

    @Override
    protected void prepareResources() {
        SeamAutowire seamAutowire = getSeamAutowire();
        seamAutowire.use("session", getSession());

        ProjectsService projectsService =
                seamAutowire.autowire(ProjectsService.class);

        resources.add(projectsService);
    }
View Full Code Here

    @Override
    protected void prepareResources() {
        MockitoAnnotations.initMocks(this);

        SeamAutowire seamAutowire = getSeamAutowire();
        seamAutowire.use("session", getSession()).use("entityManager", getEm())
                .use("identity", mockIdentity).useImpl(LocaleServiceImpl.class)
                .useImpl(CopyTransServiceImpl.class)
                .useImpl(DocumentServiceImpl.class)
                .useImpl(VersionStateCacheImpl.class)
                .useImpl(TranslationStateCacheImpl.class);

        SourceDocResourceService sourceDocResourceService =
                seamAutowire.autowire(SourceDocResourceService.class);
        TranslatedDocResourceService translatedDocResourceService =
                seamAutowire.autowire(TranslatedDocResourceService.class);

        resources.add(sourceDocResourceService);
        resources.add(translatedDocResourceService);
    }
View Full Code Here

    }

    @SuppressWarnings("serial")
    @Override
    protected void prepareResources() {
        SeamAutowire seamAutowire = getSeamAutowire();
        seamAutowire.use("session", getSession()).use("identity", mockIdentity)
                .use("translationWorkspaceManager", transWorspaceManager)
                .use("entityManager", super.getEm())
                .useImpl(CopyTransServiceImpl.class)
                .useImpl(TranslationServiceImpl.class)
                .useImpl(LocaleServiceImpl.class)
                .useImpl(DocumentServiceImpl.class)
                .useImpl(ResourceUtils.class)
                .useImpl(SecurityServiceImpl.class)
                .useImpl(ValidationServiceImpl.class)
                .useImpl(VersionStateCacheImpl.class)
                .useImpl(TranslationStateCacheImpl.class);

        TranslatedDocResourceService translatedDocResourceService =
                seamAutowire.autowire(TranslatedDocResourceService.class);
        SourceDocResourceService sourceDocResourceService =
                seamAutowire.autowire(SourceDocResourceService.class);

        resources.add(sourceDocResourceService);
        resources.add(translatedDocResourceService);
    }
View Full Code Here

     */
    private void simulateWebEditorTranslation(String projectSlug,
            String iterationSlug, String docId, String textFlowContent,
            HAccount translator, LocaleId localeId, String translation,
            ContentState translationState) throws Exception {
        SeamAutowire seamAutowire = getSeamAutowire();

        // Mock certain objects
        TranslationWorkspace transWorkspace = mock(TranslationWorkspace.class);

        WorkspaceId workspaceId =
                new WorkspaceId(new ProjectIterationId(projectSlug,
                        iterationSlug, ProjectType.Podir), localeId);

        // Set mock expectations
        when(
                transWorspaceManager
                        .getOrRegisterWorkspace(any(WorkspaceId.class)))
                .thenReturn(transWorkspace);

        seamAutowire.use(JpaIdentityStore.AUTHENTICATED_USER, translator); // use
                                                                           // a
                                                                           // given
                                                                           // authenticated
                                                                           // account
        seamAutowire.use("translationServiceImpl",
                seamAutowire.autowire(TranslationServiceImpl.class));// TODO
                                                                     // because
                                                                     // translationService
                                                                     // component
                                                                     // has
                                                                     // already
                                                                     // been
                                                                     // created
                                                                     // in
                                                                     // prepareResource
                                                                     // and have
                                                                     // a wrong
                                                                     // HAccount
                                                                     // injected

        UpdateTransUnitHandler transUnitHandler =
                seamAutowire.autowire(UpdateTransUnitHandler.class);

        // Translation unit id to update
        HTextFlow hTextFlow =
                (HTextFlow) getSession()
                        .createQuery(
View Full Code Here

    @BeforeTest
    public void prepareSeam() {
        ValidatorFactory validatorFactory =
                Validation.buildDefaultValidatorFactory();

        SeamAutowire seam = SeamAutowire.instance();
        restUtils =
                seam.reset().use("validatorFactory", validatorFactory)
                        .use("validator", validatorFactory.getValidator())
                        .autowire(RestUtils.class);
    }
View Full Code Here

TOP

Related Classes of org.zanata.seam.SeamAutowire

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.