Search in sources :

Example 1 with AaModule

use of com.google.startupos.tools.reviewer.aa.AaModule 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 AaModule

use of com.google.startupos.tools.reviewer.aa.AaModule 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)

Example 3 with AaModule

use of com.google.startupos.tools.reviewer.aa.AaModule in project startup-os by google.

the class WorkspaceCommandTest method setup.

@Before
public void setup() throws IOException {
    // XXX parametrize test
    FileSystem fileSystem = Jimfs.newFileSystem(Configuration.unix());
    TestComponent component = DaggerWorkspaceCommandTest_TestComponent.builder().commonModule(new CommonModule() {

        @Override
        @Provides
        @Singleton
        public FileSystem provideDefaultFileSystem() {
            return fileSystem;
        }
    }).aaModule(new AaModule() {

        @Override
        @Provides
        @Singleton
        @Named("Base path")
        public String provideBasePath(FileUtils fileUtils) {
            return "/base";
        }
    }).build();
    fileUtils = component.getFileUtils();
    initEmptyWorkspace();
    workspaceCommand = component.getCommand();
    outContent = new ByteArrayOutputStream();
    errContent = new ByteArrayOutputStream();
    System.setOut(new PrintStream(outContent));
    System.setErr(new PrintStream(errContent));
    Flags.resetForTesting();
    WorkspaceCommand.force.resetValueForTesting();
}
Also used : PrintStream(java.io.PrintStream) AaModule(com.google.startupos.tools.reviewer.aa.AaModule) FileUtils(com.google.startupos.common.FileUtils) Singleton(javax.inject.Singleton) FileSystem(java.nio.file.FileSystem) CommonModule(com.google.startupos.common.CommonModule) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Provides(dagger.Provides) Before(org.junit.Before)

Aggregations

FileUtils (com.google.startupos.common.FileUtils)3 AaModule (com.google.startupos.tools.reviewer.aa.AaModule)3 Provides (dagger.Provides)3 Singleton (javax.inject.Singleton)3 Before (org.junit.Before)3 AuthService (com.google.startupos.tools.reviewer.local_server.service.AuthService)2 CodeReviewService (com.google.startupos.tools.reviewer.local_server.service.CodeReviewService)2 Named (javax.inject.Named)2 CommonModule (com.google.startupos.common.CommonModule)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 PrintStream (java.io.PrintStream)1 FileSystem (java.nio.file.FileSystem)1