public static VerificationHost create() { return new VerificationHost(); }
public static VerificationHost create() { return new VerificationHost(); }
public static VerificationHost create(ServiceHost.Arguments args) throws Exception { return initialize(new VerificationHost(), args); }
public static VerificationHost create(ServiceHost.Arguments args) throws Exception { return initialize(new VerificationHost(), 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 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 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 testServiceUiDefaultPath() { class MyService extends StatelessService { } Service s = new MyService(); s.setHost(new VerificationHost()); Path path = Paths.get(Utils.UI_DIRECTORY_NAME, Utils.buildServicePath(MyService.class)); assertEquals(path, Utils.getServiceUiResourcePath(s)); }
@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 testServiceUiDefaultPath() { class MyService extends StatelessService { } Service s = new MyService(); s.setHost(new VerificationHost()); Path path = Paths.get(Utils.UI_DIRECTORY_NAME, Utils.buildServicePath(MyService.class)); assertEquals(path, Utils.getServiceUiResourcePath(s)); }
@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(); }
@Test public void testRedirect() { UiService service = new UiService(); service.setSelfLink("/sample"); service.setHost(new VerificationHost()); AtomicBoolean completionCalled = new AtomicBoolean(); service.handleGet(new Operation().setUri(UriUtils.buildUri("http://localhost/sample")) .setCompletion((o, e) -> { assertEquals("/sample/", o.getResponseHeader(Operation.LOCATION_HEADER)); completionCalled.set(true); })); assertTrue(completionCalled.get()); }
@Test public void testRedirectToBase() { UiService service = new UiService(); service.setSelfLink("/"); VerificationHost vh = new VerificationHost(); vh.setAuthorizationEnabled(true); vh.setAuthorizationContext(createAuthorizationContext(true)); service.setHost(vh); AtomicBoolean completionCalled = new AtomicBoolean(); service.handleGet(new Operation().setUri(UriUtils.buildUri("http://localhost/login/")) .setCompletion((o, e) -> { assertEquals("/", o.getResponseHeader(Operation.LOCATION_HEADER)); completionCalled.set(true); })); assertTrue(completionCalled.get()); }
@Test public void testRedirectToLogin() { UiService service = new UiService(); service.setSelfLink("/"); VerificationHost vh = new VerificationHost(); vh.setAuthorizationEnabled(true); vh.setAuthorizationContext(createAuthorizationContext(false)); service.setHost(vh); AtomicBoolean completionCalled = new AtomicBoolean(); service.handleGet(new Operation().setUri(UriUtils.buildUri("http://localhost/sample")) .setCompletion((o, e) -> { assertEquals("/login/", o.getResponseHeader(Operation.LOCATION_HEADER)); completionCalled.set(true); })); assertTrue(completionCalled.get()); }
args.authProviderHostUri = "http://auth-service.somewhere.local:4444"; VerificationHost customHost = new VerificationHost(); VerificationHost.initialize(customHost, args);
args.authProviderHostUri = "http://auth-service.somewhere.local:4444"; VerificationHost customHost = new VerificationHost(); VerificationHost.initialize(customHost, args);