public <T> LocalMachines set(int priority, NamedComponent<T> namedComponent) { addMachine(new SingletonFactoryMachine<>(priority, namedComponent)); return this; } }
public Builder withMetrics(MetricRegistry metrics) { machines.put("IndividualMachines", new SingletonFactoryMachine<>(0, new NamedComponent<>(METRICS_NAME, metrics))); return this; }
@Override public void onSetup(Factory.LocalMachines localMachines) { System.out.println("using db " + uri + "/" + db); localMachines .addMachine(new SingletonFactoryMachine<>( -10, new NamedComponent<>(Name.of(String.class, MongoModule.MONGO_DB_NAME), db))); }
public RunningServer(WebServer server, RestxSpecRunner runner, RestxSpecRepository repository, UUIDGenerator uuidGenerator, RestxErrors errors, RunningServerSettings settings) { this.server = server; this.runner = runner; this.repository = repository; this.uuidGenerator = uuidGenerator; this.errors = errors; storeLocation = Paths.get(settings.targetTestsRoot()); objectMapper = new ObjectMapper(); objectMapper.registerModule(new JodaModule()); objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); lastResults = loadLastResults(); System.setOut(out); System.setErr(err); Factory.LocalMachines.contextLocal(server.getServerId()).addMachine( new SingletonFactoryMachine<>(0, NamedComponent.of(RunningServer.class, "RunningServer", this))); }
private static Factory.Builder newFactoryBuilder(String serverId) { Factory.Builder builder = newFactoryBuilder(); if (serverId != null) { builder.addLocalMachines(Factory.LocalMachines.contextLocal(serverId)); // make server id and base url accessible in the factory components Optional<WebServer> serverById = WebServers.getServerById(serverId); builder .addMachine(new SingletonFactoryMachine<>( 0, NamedComponent.of(String.class, "restx.server.id", serverId))) .addMachine(new SingletonFactoryMachine<>( 0, NamedComponent.of(String.class, "restx.server.baseUrl", serverById.isPresent() ? serverById.get().baseUrl() : ""))) .addMachine(new SingletonFactoryMachine<>( 0, NamedComponent.of(String.class, "restx.server.port", serverById.isPresent() ? String.valueOf(serverById.get().getPort()) : ""))) .addMachine(new SingletonFactoryMachine<>( 0, NamedComponent.of(String.class, "restx.server.type", serverById.isPresent() ? serverById.get().getServerType() : ""))) ; } return builder; }
private static Factory.Builder newFactoryBuilder(String serverId, Optional<String> bladeId, Optional<String> threadLocalId, String mode) { Factory.Builder builder = newFactoryBuilder(serverId); if (threadLocalId.isPresent()) { builder.addLocalMachines(Factory.LocalMachines.threadLocalFrom(threadLocalId.get())); } if (bladeId.isPresent()) { builder.addLocalMachines(Factory.LocalMachines.contextLocal(Blade.contextId(serverId, bladeId.get()))); } builder.addMachine(new SingletonFactoryMachine<>( -100000, NamedComponent.of(String.class, "restx.mode", mode))); return builder; }
public RunningServer(WebServer server, RestxSpecRunner runner, RestxSpecRepository repository, UUIDGenerator uuidGenerator, RestxErrors errors, RunningServerSettings settings) { this.server = server; this.runner = runner; this.repository = repository; this.uuidGenerator = uuidGenerator; this.errors = errors; storeLocation = Paths.get(settings.targetTestsRoot()); objectMapper = new ObjectMapper(); objectMapper.registerModule(new JodaModule()); objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); lastResults = loadLastResults(); System.setOut(out); System.setErr(err); Factory.LocalMachines.contextLocal(server.getServerId()).addMachine( new SingletonFactoryMachine<>(0, NamedComponent.of(RunningServer.class, "RunningServer", this))); }
private static Factory.Builder newFactoryBuilder(String serverId) { Factory.Builder builder = newFactoryBuilder(); if (serverId != null) { builder.addLocalMachines(Factory.LocalMachines.contextLocal(serverId)); // make server id and base url accessible in the factory components Optional<WebServer> serverById = WebServers.getServerById(serverId); builder .addMachine(new SingletonFactoryMachine<>( 0, NamedComponent.of(String.class, "restx.server.id", serverId))) .addMachine(new SingletonFactoryMachine<>( 0, NamedComponent.of(String.class, "restx.server.baseUrl", serverById.isPresent() ? serverById.get().baseUrl() : ""))) .addMachine(new SingletonFactoryMachine<>( 0, NamedComponent.of(String.class, "restx.server.port", serverById.isPresent() ? String.valueOf(serverById.get().getPort()) : ""))) .addMachine(new SingletonFactoryMachine<>( 0, NamedComponent.of(String.class, "restx.server.type", serverById.isPresent() ? serverById.get().getServerType() : ""))) ; } return builder; }
private static Factory.Builder newFactoryBuilder(String serverId, Optional<String> bladeId, Optional<String> threadLocalId, String mode) { Factory.Builder builder = newFactoryBuilder(serverId); if (threadLocalId.isPresent()) { builder.addLocalMachines(Factory.LocalMachines.threadLocalFrom(threadLocalId.get())); } if (bladeId.isPresent()) { builder.addLocalMachines(Factory.LocalMachines.contextLocal(Blade.contextId(serverId, bladeId.get()))); } builder.addMachine(new SingletonFactoryMachine<>( -100000, NamedComponent.of(String.class, "restx.mode", mode))); return builder; }
.put("FactoryMachine", new SingletonFactoryMachine<>(10000, new NamedComponent<>(FACTORY_NAME, this)))
.concat(new SingletonFactoryMachine<>(-10000, NamedComponent.of(String.class, "restx.app.package", basePack))) .getComponent(AppSettings.class); new ShellAppRunner(appSettings, appClassName, compileMode, quiet, daemon, vmOptions)