Search in sources :

Example 1 with CodeReviewService

use of com.google.startupos.tools.reviewer.local_server.service.CodeReviewService in project startup-os by google.

the class CodeReviewServiceTextDiffTest method setup.

@Before
public void setup() throws IOException {
    Flags.parse(new String[0], AuthService.class.getPackage(), CodeReviewService.class.getPackage());
    String testFolder = Files.createTempDirectory("temp").toAbsolutePath().toString();
    final String initialRepoFolder = joinToAbsolutePath(testFolder, "initial_repo");
    aaBaseFolder = joinToAbsolutePath(testFolder, "base_folder");
    component = DaggerCodeReviewServiceTextDiffTest_TestComponent.builder().aaModule(new AaModule() {

        @Provides
        @Singleton
        @Override
        @Named("Base path")
        public String provideBasePath(FileUtils fileUtils) {
            return aaBaseFolder;
        }
    }).build();
    gitRepoFactory = component.getGitRepoFactory();
    fileUtils = component.getFileUtils();
    codeReviewService = new CodeReviewService(component.getAuthService(), fileUtils, aaBaseFolder, gitRepoFactory, component.getTextDifferencer());
    createInitialRepo(initialRepoFolder);
    initAaBase(initialRepoFolder, aaBaseFolder);
    createAaWorkspace(TEST_WORKSPACE);
    createBlockingStub();
    writeFile(TEST_FILE_CONTENTS);
    testFileCommitId = repo.commit(repo.getUncommittedFiles(), COMMIT_MESSAGE).getId();
}
Also used : Named(javax.inject.Named) AaModule(com.google.startupos.tools.reviewer.aa.AaModule) FileUtils(com.google.startupos.common.FileUtils) Singleton(javax.inject.Singleton) AuthService(com.google.startupos.tools.reviewer.local_server.service.AuthService) CodeReviewService(com.google.startupos.tools.reviewer.local_server.service.CodeReviewService) Provides(dagger.Provides) Before(org.junit.Before)

Example 2 with CodeReviewService

use of com.google.startupos.tools.reviewer.local_server.service.CodeReviewService in project startup-os by google.

the class CodeReviewServiceGetDiffFilesTest method setup.

@Before
public void setup() throws IOException {
    Flags.parse(new String[0], AuthService.class.getPackage(), CodeReviewService.class.getPackage());
    component = DaggerCodeReviewServiceGetDiffFilesTest_TestComponent.builder().aaModule(new AaModule() {

        @Provides
        @Singleton
        @Override
        @Named("Base path")
        public String provideBasePath(FileUtils fileUtils) {
            return aaBaseFolder;
        }
    }).build();
    gitRepoFactory = component.getGitRepoFactory();
    fileUtils = component.getFileUtils();
    String testFolder = Files.createTempDirectory("temp").toAbsolutePath().toString();
    String initialRepoFolder = fileUtils.joinToAbsolutePath(testFolder, "initial_repo");
    aaBaseFolder = fileUtils.joinToAbsolutePath(testFolder, "base_folder");
    codeReviewService = new CodeReviewService(component.getAuthService(), fileUtils, aaBaseFolder, gitRepoFactory, component.getTextDifferencer());
    createInitialRepo(initialRepoFolder);
    initAaBase(initialRepoFolder, aaBaseFolder);
    createAaWorkspace(TEST_WORKSPACE);
    createBlockingStub();
    writeFile(TEST_FILE_CONTENTS);
    testFileCommitId = repo.commit(repo.getUncommittedFiles(), COMMIT_MESSAGE).getId();
    mockFirestoreClientMethods();
}
Also used : Named(javax.inject.Named) AaModule(com.google.startupos.tools.reviewer.aa.AaModule) FileUtils(com.google.startupos.common.FileUtils) Singleton(javax.inject.Singleton) AuthService(com.google.startupos.tools.reviewer.local_server.service.AuthService) CodeReviewService(com.google.startupos.tools.reviewer.local_server.service.CodeReviewService) Provides(dagger.Provides) Before(org.junit.Before)

Aggregations

FileUtils (com.google.startupos.common.FileUtils)2 AaModule (com.google.startupos.tools.reviewer.aa.AaModule)2 AuthService (com.google.startupos.tools.reviewer.local_server.service.AuthService)2 CodeReviewService (com.google.startupos.tools.reviewer.local_server.service.CodeReviewService)2 Provides (dagger.Provides)2 Named (javax.inject.Named)2 Singleton (javax.inject.Singleton)2 Before (org.junit.Before)2