Package com.google.devtools.moe.client.codebase

Examples of com.google.devtools.moe.client.codebase.CodebaseCreator


    // Short-circuit Utils.filterFiles for ignore_files_re.
    expect(AppContext.RUN.fileSystem.findFiles(new File("/dummy/path/45")))
        .andReturn(ImmutableSet.<File>of());

    control.replay();
    CodebaseCreator cc = new SvnCodebaseCreator("testing", mockConfig, revisionHistory);
    Codebase r = cc.create(ImmutableMap.of("revision", "46"));
    assertEquals("/dummy/path/45", r.getPath().getAbsolutePath());
    assertEquals("internal", r.getProjectSpace());
    control.verify();
  }
View Full Code Here


  }

  @Override
  public Codebase createCodebase(ProjectContext context) throws CodebaseCreationError {
    String repositoryName = term.identifier;
    CodebaseCreator cc;
    if (repositoryName.equals("file")) {
      cc = new FileCodebaseCreator();
    } else {
      Repository repo = context.repositories.get(repositoryName);
      if (repo == null) {
        throw new CodebaseCreationError("no repository " + repositoryName);
      }
      cc = repo.codebaseCreator;
    }

    Ui.Task createTask = AppContext.RUN.ui.pushTask(
        "create_codebase", "Creating from '" + toString() + "'");
    Codebase c = cc.create(term.options);
    AppContext.RUN.ui.popTaskAndPersist(createTask, c.getPath());
    return c;
  }
View Full Code Here

      projectSpace = "public";
    }

    RevisionHistory revisionHistory = new DummyRevisionHistory(repositoryName);

    CodebaseCreator codebaseCreator = new DummyCodebaseCreator(repositoryName, projectSpace);

    WriterCreator writerCreator = new DummyWriterCreator(repositoryName);

    return new Repository(repositoryName, revisionHistory, codebaseCreator, writerCreator);
  }
View Full Code Here

    }
  }

  public void testParseAndEvaluate() throws Exception {
    IMocksControl control = EasyMock.createControl();
    CodebaseCreator cc = control.createMock(CodebaseCreator.class);
    Editor e = control.createMock(Editor.class);
    Editor translatorEditor = control.createMock(Editor.class);

    File firstDir = new File("/first");
    File secondDir = new File("/second");
    File finalDir = new File("/final");

    TranslatorPath tPath = new TranslatorPath("foo", "public");
    Translator t = new ForwardTranslator(ImmutableList.<TranslatorStep>of(
        new TranslatorStep("quux", translatorEditor)));
   
    ProjectContext context = ProjectContext.builder()
        .withRepositories(ImmutableMap.of("foo", new Repository("foo", null, cc, null)))
        .withTranslators(ImmutableMap.of(tPath, t))
        .withEditors(ImmutableMap.of("bar", e)).build();

    Codebase firstCb = new Codebase(new File("/first"), "foo",
        new RepositoryExpression(new Term("foo", EMPTY_MAP)));
   
    Codebase secondCb = new Codebase(new File("/second"), "public",
        new RepositoryExpression(new Term("foo2", EMPTY_MAP)));
   
    Codebase finalCb = new Codebase(new File("/final"), "public",
        new RepositoryExpression(new Term("foo3", EMPTY_MAP)));

    expect(cc.create(EMPTY_MAP)).andReturn(firstCb);
    expect(translatorEditor.edit(firstCb, context, EMPTY_MAP)).andReturn(secondCb);
    expect(e.getDescription()).andReturn("");
    expect(e.edit(secondCb, context, EMPTY_MAP)).andReturn(finalCb);

    control.replay();
View Full Code Here

TOP

Related Classes of com.google.devtools.moe.client.codebase.CodebaseCreator

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.