@Test
 public void jpaDataStore() {
   final StandaloneConfig config =
       ConfigReader.parse(
           ConfigReaderTest.class.getResourceAsStream("/simplepush-jpa-config.json"));
   assertThat(config.dataStore(), is(instanceOf(JpaDataStore.class)));
 }
 @BeforeClass
 public static void parseConfigFile() {
   standaloneConfig =
       ConfigReader.parse(
           ConfigReaderTest.class.getResourceAsStream("/simplepush-test-config.json"));
   simplePushServerConfig = standaloneConfig.simplePushServerConfig();
   sockJsConfig = standaloneConfig.sockJsConfig();
 }
 @Test
 public void sampleConfig() {
   final StandaloneConfig config =
       ConfigReader.parse(ConfigReaderTest.class.getResourceAsStream("/simplepush-config.json"));
   assertThat(config.simplePushServerConfig().host(), equalTo("0.0.0.0"));
   assertThat(config.simplePushServerConfig().port(), is(7777));
   assertThat(config.simplePushServerConfig().password(), is(notNullValue()));
   assertThat(config.dataStore(), is(instanceOf(InMemoryDataStore.class)));
 }
Beispiel #4
0
  public static void main(String[] args) throws AnalysisException, IOException {
    StandaloneConfig config = new StandaloneConfig();
    config.parseCommandLine(args);

    MemoryStatisticsCollector statistics = null;
    if (config.getPrintStatistics()) {
      statistics = new MemoryStatisticsCollector();
    }

    List<String> compilation = config.getCompilation();
    if (compilation.size() > 1) {
      System.err.println("Java indexer received too many arguments; got " + compilation);
      usage(1);
    }

    CompilationDescription desc = null;
    if (!Strings.isNullOrEmpty(config.getIndexPackRoot())) {
      // java_indexer --index_pack=archive-root unit-key
      desc = new Archive(config.getIndexPackRoot()).readDescription(compilation.get(0));
    } else {
      // java_indexer kindex-file
      desc = IndexInfoUtils.readIndexInfoFromFile(compilation.get(0));
    }

    if (desc == null) {
      throw new IllegalStateException("Unknown error reading CompilationDescription");
    }
    if (!desc.getFileContents().iterator().hasNext()) {
      return;
    }

    try (OutputStream stream =
        Strings.isNullOrEmpty(config.getOutputPath())
            ? System.out
            : new BufferedOutputStream(new FileOutputStream(config.getOutputPath()))) {
      new JavacAnalysisDriver()
          .analyze(
              new KytheJavacAnalyzer(
                  config,
                  new StreamFactEmitter(stream),
                  statistics == null ? NullStatisticsCollector.getInstance() : statistics),
              desc.getCompilationUnit(),
              new FileDataCache(desc.getFileContents()),
              false);
    }

    if (statistics != null) {
      statistics.printStatistics(System.err);
    }
  }
 @Test
 public void inMemoryDataStore() {
   assertThat(standaloneConfig.dataStore(), is(instanceOf(InMemoryDataStore.class)));
 }