public static VerificationHost create(ServiceHost.Arguments args) throws Exception { return initialize(new VerificationHost(), args); }
public void initializeHost(VerificationHost host) throws Exception { ServiceHost.Arguments args = VerificationHost.buildDefaultServiceHostArguments(0); VerificationHost.initialize(host, args); }
public static VerificationHost create(ServiceHost.Arguments args) throws Exception { return initialize(new VerificationHost(), args); }
public void initializeHost(VerificationHost host) throws Exception { ServiceHost.Arguments args = VerificationHost.buildDefaultServiceHostArguments(0); VerificationHost.initialize(host, args); }
public static VerificationHost create(Integer port) throws Exception { ServiceHost.Arguments args = buildDefaultServiceHostArguments(port); return initialize(new VerificationHost(), args); }
public static VerificationHost create(Integer port) throws Exception { ServiceHost.Arguments args = buildDefaultServiceHostArguments(port); return initialize(new VerificationHost(), args); }
private VerificationHost createHost() throws Throwable { ServiceHost.Arguments args = new ServiceHost.Arguments(); args.sandbox = null; // ask runtime to pick a random storage location args.port = 0; // ask runtime to pick a random port args.isAuthorizationEnabled = false; VerificationHost h = new VerificationHost(); h = VerificationHost.initialize(h, args); h.start(); return h; }
private static VerificationHost createHost() throws Throwable { ServiceHost.Arguments args = new ServiceHost.Arguments(); args.sandbox = null; // ask runtime to pick a random storage location args.port = 0; // ask runtime to pick a random port args.isAuthorizationEnabled = false; VerificationHost h = new VerificationHost(); h = VerificationHost.initialize(h, args); h.start(); return h; }
private VerificationHost createVerificationHost() throws Throwable { VerificationHost host = new VerificationHost(); ServiceHost.Arguments args = VerificationHost.buildDefaultServiceHostArguments(0); VerificationHost.initialize(host, args); host.start(); host.setMaintenanceIntervalMicros(TimeUnit.MILLISECONDS.toMicros(100)); return host; }
@Test public void defaultBehavior() throws Exception { Arguments args = new Arguments(); args.id = "id"; args.port = 0; args.authProviderHostUri = "http://auth-service.somewhere.local:4444"; VerificationHost customHost = new VerificationHost(); VerificationHost.initialize(customHost, args); String link = "/link-to-sth"; URI uri = AuthUtils.buildAuthProviderHostUri(customHost, link); assertEquals(URI.create(args.authProviderHostUri + link), uri); }
@Test public void defaultBehavior() throws Exception { Arguments args = new Arguments(); args.id = "id"; args.port = 0; args.authProviderHostUri = "http://auth-service.somewhere.local:4444"; VerificationHost customHost = new VerificationHost(); VerificationHost.initialize(customHost, args); String link = "/link-to-sth"; URI uri = AuthUtils.buildAuthProviderHostUri(customHost, link); assertEquals(URI.create(args.authProviderHostUri + link), uri); }
private VerificationHost createHost() throws Throwable { OperationInterceptorRegistry interceptors = new OperationInterceptorRegistry(); ServiceHost.Arguments args = new ServiceHost.Arguments(); args.sandbox = null; // ask runtime to pick a random storage location args.port = 0; // ask runtime to pick a random port args.isAuthorizationEnabled = false; VerificationHost h = new VerificationHost(); h = VerificationHost.initialize(h, args); h.start(); return h; }
@Before public void setUp() throws Throwable { ServiceHost.Arguments args = new ServiceHost.Arguments(); args.sandbox = null; // ask runtime to pick a random storage location args.port = 0; // ask runtime to pick a random port args.isAuthorizationEnabled = false; host = new VerificationHost(); host = VerificationHost.initialize(host, args); host.start(); }
public static VerificationHost initialize(VerificationHost h, ServiceHost.Arguments args) throws Exception { if (args.sandbox == null) { h.setTemporaryFolder(new TemporaryFolder()); h.getTemporaryFolder().create(); args.sandbox = h.getTemporaryFolder().getRoot().toPath(); } try { h.initialize(args); } catch (Throwable e) { throw new RuntimeException(e); } h.sender = new TestRequestSender(h); return h; }
public static VerificationHost initialize(VerificationHost h, ServiceHost.Arguments args) throws Exception { if (args.sandbox == null) { h.setTemporaryFolder(new TemporaryFolder()); h.getTemporaryFolder().create(); args.sandbox = h.getTemporaryFolder().getRoot().toPath(); } try { h.initialize(args); } catch (Throwable e) { throw new RuntimeException(e); } h.sender = new TestRequestSender(h); return h; }
@Override public void initializeHost(VerificationHost host) throws Exception { try { // create a xenon service host housing just the user authz rules this.externalAuthHost = createHost(); ServiceHost.Arguments args = VerificationHost.buildDefaultServiceHostArguments(0); VerificationHost.initialize(this.externalAuthHost, args); this.externalAuthHost.setAuthorizationService(new AuthorizationContextService()); this.externalAuthHost.setAuthorizationEnabled(true); this.externalAuthHost.start(); this.externalAuthHost.setSystemAuthorizationContext(); // create two users this.userServiceJane = createUsers(this.externalAuthHost, USER_JANE, USER_JANE_EMAIL); this.userServiceJohn = createUsers(this.externalAuthHost, USER_JOHN, USER_JOHN_EMAIL); this.externalAuthHost.resetAuthorizationContext(); // start test verification host with an external auth provider args = VerificationHost.buildDefaultServiceHostArguments(0); args.authProviderHostUri = this.externalAuthHost.getUri().toString(); args.isAuthorizationEnabled = true; VerificationHost.initialize(this.host, args); Utils.registerKind(UserService.UserState.class, Utils.buildKind(UserService.UserState.class)); } catch (Throwable e) { throw new Exception(e); } }
protected Map.Entry<VerificationHost, ServerX509TrustManager> createHostWithTrustManager( long reloadTime) throws Throwable { ServiceHost.Arguments args = getHostArguments(); OperationInterceptorRegistry interceptors = createInterceptorRegistry(); registerInterceptors(interceptors); VerificationHost h = VerificationHost.initialize( new CustomizationVerificationHost(interceptors), args); h.setMaintenanceIntervalMicros(this.getMaintenanceIntervalMillis() * 1000); ServerX509TrustManager trustManager = new TestServerX509TrustManager(h, reloadTime); SSLContext sslContext = CertificateUtil.createSSLContext(trustManager, null); h.setClient(createServiceClient(sslContext, 0, h)); h.start(); return new AbstractMap.SimpleEntry<>(h, trustManager); }
@Before public void setUp() throws Throwable { // create and start 3 verification hosts cluster = VerificationHost.create(); ServiceHost.Arguments args = VerificationHost.buildDefaultServiceHostArguments(0); VerificationHost.initialize(cluster, args); cluster.start(); cluster.setMaintenanceIntervalMicros(TimeUnit.MILLISECONDS.toMicros(100)); // join nodes cluster.setUpPeerHosts(CLUSTER_NODES); cluster.joinNodesAndVerifyConvergence(3); cluster.setNodeGroupQuorum(2); // peer used to send posts. peerHost = cluster.getPeerHost(); // wait for replicated factory availability cluster.waitForReplicatedFactoryServiceAvailable(UriUtils.buildUri(peerHost, ExampleService.FACTORY_LINK)); // create example service exampleState = createExampleServiceState(); }
@Before public void setUp() throws Throwable { host = VerificationHost.create(); ServiceHost.Arguments args = VerificationHost.buildDefaultServiceHostArguments(0); VerificationHost.initialize(host, args); host.start(); host.startService(new RegistryFactoryService()); host.waitForServiceAvailable(RegistryFactoryService.SELF_LINK); host.startService(new ConfigurationFactoryService()); host.waitForServiceAvailable(ConfigurationFactoryService.SELF_LINK); sender = host.getTestRequestSender(); harborInitRegistryService = new HarborInitRegistryService(); harborInitRegistryService.setHost(host); }
protected VerificationHost createHost(ServiceHost.Arguments args, String[] additionalArgs) throws Throwable { OperationInterceptorRegistry interceptors = createInterceptorRegistry(); registerInterceptors(interceptors); CustomizationVerificationHost customizationHost = new CustomizationVerificationHost( interceptors); if (args == null) { args = getHostArguments(); } if (additionalArgs != null) { CommandLineArgumentParser.parse(args, additionalArgs); CommandLineArgumentParser.parse(customizationHost, additionalArgs); } VerificationHost resultHost = VerificationHost.initialize(customizationHost, args); resultHost.setMaintenanceIntervalMicros(this.getMaintenanceIntervalMillis() * 1000); resultHost.setTimeoutSeconds(HOST_TIMEOUT_SECONDS); setPrivilegedServices(resultHost); resultHost.start(); return resultHost; }