use of com.netflix.appinfo.ApplicationInfoManager in project eureka by Netflix.
the class DiscoveryClientResource method setupDiscoveryClient.
public static EurekaClient setupDiscoveryClient(InstanceInfo clientInstanceInfo) {
DefaultEurekaClientConfig config = new DefaultEurekaClientConfig();
// setup config in advance, used in initialize converter
ApplicationInfoManager applicationInfoManager = new ApplicationInfoManager(new MyDataCenterInstanceConfig(), clientInstanceInfo);
DiscoveryManager.getInstance().setEurekaClientConfig(config);
EurekaClient client = new DiscoveryClient(applicationInfoManager, config);
return client;
}
use of com.netflix.appinfo.ApplicationInfoManager in project eureka by Netflix.
the class AwsAsgUtilTest method setUp.
@Before
public void setUp() throws Exception {
ConfigurationManager.getConfigInstance().setProperty("eureka.awsAccessId", "fakeId");
ConfigurationManager.getConfigInstance().setProperty("eureka.awsSecretKey", "fakeKey");
AmazonInfo dataCenterInfo = mock(AmazonInfo.class);
EurekaServerConfig serverConfig = new DefaultEurekaServerConfig();
InstanceInfo.Builder builder = InstanceInfo.Builder.newBuilder();
builder.setIPAddr("10.10.101.00");
builder.setHostName("fakeHost");
builder.setAppName("fake-" + UUID.randomUUID());
builder.setLeaseInfo(LeaseInfo.Builder.newBuilder().build());
builder.setDataCenterInfo(dataCenterInfo);
instanceInfo = builder.build();
applicationInfoManager = new ApplicationInfoManager(new MyDataCenterInstanceConfig(), instanceInfo);
DefaultEurekaClientConfig clientConfig = new DefaultEurekaClientConfig();
// setup config in advance, used in initialize converter
client = mock(DiscoveryClient.class);
registry = mock(PeerAwareInstanceRegistry.class);
awsAsgUtil = spy(new AwsAsgUtil(serverConfig, clientConfig, registry));
}
use of com.netflix.appinfo.ApplicationInfoManager in project eureka by Netflix.
the class RateLimitingFilterTest method setUp.
@Before
public void setUp() throws Exception {
RateLimitingFilter.reset();
ConfigurationManager.getConfigInstance().setProperty("eureka.rateLimiter.privilegedClients", PYTHON_CLIENT);
ConfigurationManager.getConfigInstance().setProperty("eureka.rateLimiter.enabled", true);
ConfigurationManager.getConfigInstance().setProperty("eureka.rateLimiter.burstSize", 2);
ConfigurationManager.getConfigInstance().setProperty("eureka.rateLimiter.registryFetchAverageRate", 1);
ConfigurationManager.getConfigInstance().setProperty("eureka.rateLimiter.fullFetchAverageRate", 1);
ConfigurationManager.getConfigInstance().setProperty("eureka.rateLimiter.throttleStandardClients", false);
ApplicationInfoManager applicationInfoManager = new ApplicationInfoManager(new MyDataCenterInstanceConfig());
DefaultEurekaServerConfig config = new DefaultEurekaServerConfig();
EurekaServerContext mockServer = mock(EurekaServerContext.class);
when(mockServer.getServerConfig()).thenReturn(config);
filter = new RateLimitingFilter(mockServer);
}
use of com.netflix.appinfo.ApplicationInfoManager in project eureka by Netflix.
the class ExampleEurekaService method main.
public static void main(String[] args) {
DynamicPropertyFactory configInstance = com.netflix.config.DynamicPropertyFactory.getInstance();
ApplicationInfoManager applicationInfoManager = initializeApplicationInfoManager(new MyDataCenterInstanceConfig());
EurekaClient eurekaClient = initializeEurekaClient(applicationInfoManager, new DefaultEurekaClientConfig());
ExampleServiceBase exampleServiceBase = new ExampleServiceBase(applicationInfoManager, eurekaClient, configInstance);
try {
exampleServiceBase.start();
} finally {
// the stop calls shutdown on eurekaClient
exampleServiceBase.stop();
}
}
use of com.netflix.appinfo.ApplicationInfoManager in project eureka by Netflix.
the class ExampleEurekaService method initializeApplicationInfoManager.
private static synchronized ApplicationInfoManager initializeApplicationInfoManager(EurekaInstanceConfig instanceConfig) {
if (applicationInfoManager == null) {
InstanceInfo instanceInfo = new EurekaConfigBasedInstanceInfoProvider(instanceConfig).get();
applicationInfoManager = new ApplicationInfoManager(instanceConfig, instanceInfo);
}
return applicationInfoManager;
}
Aggregations