/** * Create a druid service configuration object for the metadata service. * * @return a druid service configuration object with all configuration parameters set */ public static DruidServiceConfig getMetadataServiceConfig() { return new DruidServiceConfig( "Coordinator", getDruidCoordUrl(), getDruidTimeout(), getDruidPriority() ); }
/** * Create a druid service configuration object. * * @return a druid service configuration object with all configuration parameters set */ public static DruidServiceConfig getServiceConfig() { return new DruidServiceConfig("Broker", getDruidUrl(), getDruidTimeout(), getDruidPriority()); }
/** * Fetches the druid request timeout. * * @return druid request timeout */ public static Integer getDruidTimeout() { Integer time = fetchDruidResponseTimeOut(DRUID_REQUEST_TIMEOUT_KEY); return time; }
@Override public Integer getTimeout() { return serviceConfig.getTimeout(); }
/** * Constructor. * * @param name Name of the webservice */ public TestDruidWebService(String name) { this(new DruidServiceConfig(name, null, null, null)); }
@Override public void invoke(Throwable error) { if (failed.compareAndSet(false, true)) { nextFail.invoke(error); } } };
@Override public String toString() { return " name: " + serviceConfig.getNameAndUrl() + " hash code: " + hashCode(); }
/** * Create a DruidWebService for metadata. * * @param mapper shared instance of {@link com.fasterxml.jackson.databind.ObjectMapper} * * @return A DruidWebService */ protected DruidWebService buildMetadataDruidWebService(ObjectMapper mapper) { return buildDruidWebService(DruidClientConfigHelper.getMetadataServiceConfig(), mapper); }
/** * Create a DruidWebService for the UI connection. * <p> * Provided so subclasses can implement alternative druid web service implementations for the UI connection * * @param mapper shared instance of {@link com.fasterxml.jackson.databind.ObjectMapper} * * @return A DruidWebService */ protected DruidWebService buildDruidWebService(ObjectMapper mapper) { return buildDruidWebService(DruidClientConfigHelper.getServiceConfig(), mapper); }
/** * Stop the request timer, start the response timer, and then invoke the error callback code. * * @param statusCode Http status code of the error response * @param reasonPhrase The reason for the error. Often the status code description. * @param responseBody The body of the error response */ default void dispatch(int statusCode, String reasonPhrase, String responseBody) { RequestLog.stopTiming(REQUEST_WORKFLOW_TIMER); RequestLog.startTiming(RESPONSE_WORKFLOW_TIMER); invoke(statusCode, reasonPhrase, responseBody); } }
/** * Fetches the druid URL. * * @return druid URL */ public static String getDruidUrl() { String url = SYSTEM_CONFIG.getStringProperty(DRUID_BROKER_URL_KEY, null); validateUrl(url); return url; }
/** * Constructor. * * @param serviceConfig Config to use when building the test druid web service */ public TestDruidWebService(DruidServiceConfig serviceConfig) { this.serviceConfig = serviceConfig; this.timeout = serviceConfig.getTimeout(); }
/** * Constructor. * <p> * Uses the default name. */ public TestDruidWebService() { this(new DruidServiceConfig(DEFAULT_NAME, null, null, null)); }
/** * Stop the request timer, start the response timer, and then invoke the failure callback code. * * @param error The error that caused the failure */ default void dispatch(Throwable error) { RequestLog.stopTiming(REQUEST_WORKFLOW_TIMER); RequestLog.startTiming(RESPONSE_WORKFLOW_TIMER); invoke(error); } }
@Override public String toString() { return " name: " + serviceConfig.getNameAndUrl() + " hash code: " + hashCode(); }
/** * Constructor. * * @param serviceConfig Config to use when building the test druid web service */ public TestDruidWebService(DruidServiceConfig serviceConfig) { this.serviceConfig = serviceConfig; this.timeout = serviceConfig.getTimeout(); }
/** * Constructor. * <p> * Uses the default name. */ public TestDruidWebService() { this(new DruidServiceConfig(DEFAULT_NAME, null, null, null)); }
@Override public Integer getTimeout() { return serviceConfig.getTimeout(); }
/** * Constructor. * * @param name Name of the webservice */ public TestDruidWebService(String name) { this(new DruidServiceConfig(name, null, null, null)); }
@Override public Integer getTimeout() { return serviceConfig.getTimeout(); }