public TestInjectionModule(String serviceName, ServiceProperties props) { this.serviceProperties = props; serviceProperties.setServiceName(serviceName); if (props.getProperty("registry") == null) { serviceProperties.addProperty("registry", "consul"); } if (props.getProperty("registryServer") == null) { serviceProperties.addProperty("registryServer", "localhost:8500"); } if (props.getProperty("kafkaServer") == null) { serviceProperties.addProperty("kafkaServer", "localhost:9092"); } }
public static int getHttpConnectTimeout(ServiceProperties serviceProps) { return serviceProps.getIntegerProperty(HTTP_CONNECT_TIMEOUT, DEFAULT_HTTP_CONNECT_TIMEOUT); }
public ServiceImpersonator(String serviceName) throws Exception { this(serviceName, new ServiceProperties()); }
public void initProperties(String[] args) { serviceProperties.initialize(args); }
public OrangeContext newContextFromMetadata() { return new OrangeContext(correlationId); }
public String getRpcOriginService() { return getProperty(RPC_ORIGIN_SERVICE); }
private String defaultConsumerGroupId(Topic topic) { // default consumer group id consists of topic and service name return topic + "-" + serviceProperties.getServiceName(); }
public void initializeServiceDiscovery() { initializeLoadBalancerFactory(injector); }
private String getRegistrationUri() { return "http://" + serviceProps.getRegistryServer() + "/v1/agent/service/register"; }
public Map<String, ServiceMethodHandler<? extends Message, ? extends Message>> getMethodHandlers() { return methodHandlers.getMethodHandlers(); }
public int getInternalPort() { return serviceProperties.getServicePort(); }
public static int getKafkaMaxBlockMs(ServiceProperties serviceProps) { return serviceProps.getIntegerProperty(KAFKA_MAX_BLOCK_MS, DEFAULT_KAFKA_MAX_BLOCK_MS); }
public ServiceUnderTestModule(String serviceName) { this(serviceName, new ServiceProperties()); }
public String getRpcOriginMethod() { return getProperty(RPC_ORIGIN_METHOD); }
public static int getMinJettyThreads(ServiceProperties serviceProps) { return serviceProps.getIntegerProperty(MIN_JETTY_THREADS, DEFAULT_MIN_JETTY_THREADS); }
public RpcHandlerTest_RpcHandlerMock(MethodHandlerDictionary handlers, MetricRegistry registry, RpcHandlerMetrics handlerMetrics) { super(handlers, registry, handlerMetrics, new ServiceProperties(), null); }
public static int getMaxJettyThreads(ServiceProperties serviceProps) { return serviceProps.getIntegerProperty(MAX_JETTY_THREADS, DEFAULT_MAX_JETTY_THREADS); }
public static int getHttpAddressResolutionTimeout(ServiceProperties serviceProps) { return serviceProps.getIntegerProperty(HTTP_ADDRESS_RESOLUTION_TIMEOUT, DEFAULT_HTTP_ADDRESS_RESOLUTION_TIMEOUT); }
public static int getReadinessCheckPort(ServiceProperties serviceProps) { return serviceProps.getIntegerProperty(READINESS_CHECK_PORT, DEFAULT_READINESS_CHECK_PORT); }
public static int getKafkaRequestTimeoutMs(ServiceProperties serviceProps) { return serviceProps.getIntegerProperty(KAFKA_REQUEST_TIMEOUT_MS, DEFAULT_KAFKA_REQUEST_TIMEOUT_MS); }