List of usage examples for com.google.common.collect ImmutableMap of
public static <K, V> ImmutableMap<K, V> of(K k1, V v1)
From source file:com.facebook.presto.plugin.geospatial.GeoQueryRunner.java
public static void main(String[] args) throws Exception { Logging.initialize();//from w w w . j a v a 2 s.c om DistributedQueryRunner queryRunner = createQueryRunner(ImmutableMap.of("http-server.http.port", "8080")); Logger log = Logger.get(GeoQueryRunner.class); log.info("======== SERVER STARTED ========"); log.info("\n====\n%s\n====", queryRunner.getCoordinator().getBaseUrl()); }
From source file:nz.co.testamation.core.mock.requestmatcher.AttributeRequestMatcher.java
public static void main(String[] args) { ImmutableMap<String, ImmutableMap<String, String>> map = ImmutableMap.of("k1", ImmutableMap.of("v1", "actual")); System.out.println("k1".split("\\.")[0]); String[] elExpression = "k1.v1".split("\\."); System.out.println(Lists.newArrayList(elExpression)); Object value = map;//from ww w. ja v a 2 s. c om for (String s : elExpression) { value = ((Map) value).get(s); } System.out.println("value: " + value); }
From source file:io.prestosql.plugin.blackhole.BlackHoleQueryRunner.java
public static void main(String[] args) throws Exception { Logging.initialize();/*from w w w . ja v a 2s. c om*/ DistributedQueryRunner queryRunner = createQueryRunner(ImmutableMap.of("http-server.http.port", "8080")); Thread.sleep(10); Logger log = Logger.get(BlackHoleQueryRunner.class); log.info("======== SERVER STARTED ========"); log.info("\n====\n%s\n====", queryRunner.getCoordinator().getBaseUrl()); }
From source file:com.proofpoint.discovery.announcer.Main.java
public static void main(String[] args) throws Exception { Bootstrap app = bootstrapApplication("discovery-announcer") .withModules(new NodeModule(), new DiscoveryModule(), new HttpServerModule(), new JsonModule(), new JaxrsModule(), new MBeanModule(), new JmxModule(), new JmxHttpModule(), new LogJmxModule(), new HttpEventModule(), new ReportingModule(), new ReportingClientModule(), new TraceTokenModule(), new MainModule()) .withApplicationDefaults(ImmutableMap.of("http-server.http.enabled", "false")); try {/* www .ja v a 2 s. c o m*/ Injector injector = app.initialize(); injector.getInstance(Announcer.class).start(); } catch (Throwable e) { log.error(e); System.exit(1); } }
From source file:com.facebook.presto.tpcds.TpcdsQueryRunner.java
public static void main(String[] args) throws Exception { Logging.initialize();//www .ja v a 2 s .c om DistributedQueryRunner queryRunner = createQueryRunner(ImmutableMap.of("http-server.http.port", "8080")); Thread.sleep(10); Logger log = Logger.get(TpcdsQueryRunner.class); log.info("======== SERVER STARTED ========"); log.info("\n====\n%s\n====", queryRunner.getCoordinator().getBaseUrl()); }
From source file:com.facebook.presto.plugin.memory.MemoryQueryRunner.java
public static void main(String[] args) throws Exception { Logging.initialize();/* w ww .j a v a 2s . c om*/ DistributedQueryRunner queryRunner = createQueryRunner(ImmutableMap.of("http-server.http.port", "8080")); Thread.sleep(10); Logger log = Logger.get(MemoryQueryRunner.class); log.info("======== SERVER STARTED ========"); log.info("\n====\n%s\n====", queryRunner.getCoordinator().getBaseUrl()); }
From source file:rapture.server.WatchServer.java
public static void main(String[] args) { try {//from w w w. j av a 2s . c o m Kernel.initBootstrap(ImmutableMap.of("STD", ConfigLoader.getConf().StandardTemplate), WatchServer.class, false); RaptureAppService.setupApp("WatchServer"); } catch (RaptureException e1) { log.error("Failed to start WatchServer with " + ExceptionToString.format(e1)); System.exit(-1); } // load configuration: specifies what action to take for an event // TODO: check that action uris exist. try { String retrieveSystemConfig = Kernel.getSys().retrieveSystemConfig(ContextFactory.getKernelUser(), "CONFIG", CONFIG_URI); watchConfig = JacksonUtil.getMapFromJson(retrieveSystemConfig); for (String key : watchConfig.keySet()) { List<Map> list = (List<Map>) watchConfig.get(key); if (Files.isDirectory(Paths.get(key))) { if (key.charAt(key.length() - 1) != File.separatorChar) { key += File.separator; } config.put(key, list); log.info("Path=" + key + ":Config=" + list.toString()); } else { log.error("Directory " + key + " does not exist! Check the config."); } } } catch (Exception e2) { log.error("Failed to load configuration from " + CONFIG_URI + ". Exception:" + ExceptionToString.format(e2)); System.exit(-1); } for (String path : config.keySet()) { log.info("Setting up " + path); new WatchRunner(path, config.get(path)).startThread(); } log.info("WatchServer started and ready."); }
From source file:org.zanata.util.Annotations.java
public static void main(String[] args) throws Exception { Authenticated auth = dummy(Authenticated.class); System.out.println(auth);// w ww. j av a 2 s . co m HttpParam httpParam = create(HttpParam.class, ImmutableMap.of("value", "param")); System.out.println(httpParam); Method[] methods = HttpParam.class.getDeclaredMethods(); for (Method method : methods) { System.out.println(method.getName() + "=" + method.invoke(httpParam)); } }
From source file:io.prometheus.client.examples.random.Main.java
public static void main(final String[] arguments) { Registry.defaultInitialize(); final Server server = new Server(8181); final ServletContextHandler context = new ServletContextHandler(); context.setContextPath("/"); server.setHandler(context);/*w w w. ja v a 2 s . c o m*/ context.addServlet(new ServletHolder(new MetricsServlet()), "/"); new Thread() { @Override public void run() { final RandomDataImpl randomData = new RandomDataImpl(); try { while (true) { rpcLatency.add(ImmutableMap.of("service", "foo"), randomData.nextLong(0, 200)); rpcLatency.add(ImmutableMap.of("service", "bar"), (float) randomData.nextGaussian(100, 20)); rpcLatency.add(ImmutableMap.of("service", "zed"), (float) randomData.nextExponential(100)); rpcCalls.increment(ImmutableMap.of("service", "foo")); rpcCalls.increment(ImmutableMap.of("service", "bar")); rpcCalls.increment(ImmutableMap.of("service", "zed")); Thread.sleep(1000); } } catch (final InterruptedException e) { } } }.start(); try { server.start(); server.join(); } catch (Exception e) { e.printStackTrace(); } }
From source file:com.facebook.presto.tests.tpch.TpchQueryRunner.java
public static void main(String[] args) throws Exception { Logging.initialize();/*from w w w .j a va2 s . c o m*/ DistributedQueryRunner queryRunner = createQueryRunner(ImmutableMap.of("http-server.http.port", "8080")); Thread.sleep(10); Logger log = Logger.get(TpchQueryRunner.class); log.info("======== SERVER STARTED ========"); log.info("\n====\n%s\n====", queryRunner.getCoordinator().getBaseUrl()); }