use of com.vmware.xenon.common.ServiceHost in project photon-model by vmware.
the class ServerX509TrustManagerTest method setUp.
@BeforeClass
public static void setUp() throws Throwable {
// Force a custom trust store... that shouldn't override the Java default cacerts.
URI customStore = ServerX509TrustManagerTest.class.getResource("/certs/trusted_certificates.jks").toURI();
File f = new File(customStore.getPath());
System.setProperty(ServerX509TrustManager.JAVAX_NET_SSL_TRUST_STORE, f.getPath());
System.setProperty(ServerX509TrustManager.JAVAX_NET_SSL_TRUST_STORE_PASSWORD, "changeit");
// Fake host, not really needed for the purpose of the trust manager test.
ServiceHost host = new ServiceHost() {
};
trustManager = ServerX509TrustManager.init(host);
}
use of com.vmware.xenon.common.ServiceHost in project photon-model by vmware.
the class SslTrustCertificateServiceUtils method subscribe.
/**
* Subscribes a consumer to the given continuous query.
*/
static void subscribe(ServiceHost host, Consumer<Operation> consumer) {
QueryTask task = getQueryTask();
QueryUtils.createQueryTaskOperation(host, task, null).setReferer(host.getUri()).setCompletion((o, e) -> {
if (e != null && o.getStatusCode() != Operation.STATUS_CODE_CONFLICT) {
host.log(Level.SEVERE, Utils.toString(e));
return;
}
String taskUriPath = UriUtils.buildUriPath(ServiceUriPaths.CORE_LOCAL_QUERY_TASKS, task.documentSelfLink);
Operation subscribePost = Operation.createPost(host, taskUriPath).setReferer(host.getUri()).setConnectionSharing(true).setCompletion((op, ex) -> {
if (ex != null) {
host.log(Level.SEVERE, Utils.toString(ex));
}
});
host.log(Level.INFO, "Subscribing to a continuous task: %s", taskUriPath);
host.startSubscriptionService(subscribePost, consumer, ServiceSubscriber.create(false));
}).sendWith(host);
}
Aggregations