use of com.netflix.appinfo.MyDataCenterInstanceConfig 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.MyDataCenterInstanceConfig 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.MyDataCenterInstanceConfig 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.MyDataCenterInstanceConfig in project eureka by Netflix.
the class BackUpRegistryTest method setUp.
public void setUp(boolean enableRemote) throws Exception {
ConfigurationManager.getConfigInstance().setProperty("eureka.client.refresh.interval", CLIENT_REFRESH_RATE);
ConfigurationManager.getConfigInstance().setProperty("eureka.registration.enabled", "false");
if (enableRemote) {
ConfigurationManager.getConfigInstance().setProperty("eureka.fetchRemoteRegionsRegistry", REMOTE_REGION);
}
ConfigurationManager.getConfigInstance().setProperty("eureka.myregion.availabilityZones", REMOTE_ZONE);
ConfigurationManager.getConfigInstance().setProperty("eureka.backupregistry", MockBackupRegistry.class.getName());
ConfigurationManager.getConfigInstance().setProperty("eureka.serviceUrl.default", "http://localhost:" + NOT_AVAILABLE_EUREKA_PORT + MockRemoteEurekaServer.EUREKA_API_BASE_PATH);
InstanceInfo.Builder builder = InstanceInfo.Builder.newBuilder();
builder.setIPAddr("10.10.101.00");
builder.setHostName("Hosttt");
builder.setAppName("EurekaTestApp-" + UUID.randomUUID());
builder.setDataCenterInfo(new DataCenterInfo() {
@Override
public Name getName() {
return Name.MyOwn;
}
});
ApplicationInfoManager applicationInfoManager = new ApplicationInfoManager(new MyDataCenterInstanceConfig(), builder.build());
backupRegistry = new MockBackupRegistry();
setupBackupMock();
client = new DiscoveryClient(applicationInfoManager, new DefaultEurekaClientConfig(), null, Providers.of((BackupRegistry) backupRegistry));
}
use of com.netflix.appinfo.MyDataCenterInstanceConfig in project eureka by Netflix.
the class AbstractTester method setUp.
@Before
public void setUp() throws Exception {
ConfigurationManager.getConfigInstance().clearProperty("eureka.remoteRegion.global.appWhiteList");
ConfigurationManager.getConfigInstance().setProperty("eureka.responseCacheAutoExpirationInSeconds", "10");
ConfigurationManager.getConfigInstance().clearProperty("eureka.remoteRegion." + REMOTE_REGION_NAME + ".appWhiteList");
ConfigurationManager.getConfigInstance().setProperty("eureka.deltaRetentionTimerIntervalInMs", "600000");
ConfigurationManager.getConfigInstance().setProperty("eureka.remoteRegion.registryFetchIntervalInSeconds", "5");
populateRemoteRegistryAtStartup();
mockRemoteEurekaServer = newMockRemoteServer();
mockRemoteEurekaServer.start();
ConfigurationManager.getConfigInstance().setProperty("eureka.remoteRegionUrlsWithName", REMOTE_REGION_NAME + ";http://localhost:" + mockRemoteEurekaServer.getPort() + MockRemoteEurekaServer.EUREKA_API_BASE_PATH);
serverConfig = spy(new DefaultEurekaServerConfig());
InstanceInfo.Builder builder = InstanceInfo.Builder.newBuilder();
builder.setIPAddr("10.10.101.00");
builder.setHostName("Hosttt");
builder.setAppName("EurekaTestApp-" + UUID.randomUUID());
builder.setLeaseInfo(LeaseInfo.Builder.newBuilder().build());
builder.setDataCenterInfo(getDataCenterInfo());
ConfigurationManager.getConfigInstance().setProperty("eureka.serviceUrl.default", "http://localhost:" + mockRemoteEurekaServer.getPort() + MockRemoteEurekaServer.EUREKA_API_BASE_PATH);
DefaultEurekaClientConfig clientConfig = new DefaultEurekaClientConfig();
// setup config in advance, used in initialize converter
ApplicationInfoManager applicationInfoManager = new ApplicationInfoManager(new MyDataCenterInstanceConfig(), builder.build());
client = new DiscoveryClient(applicationInfoManager, clientConfig);
ServerCodecs serverCodecs = new DefaultServerCodecs(serverConfig);
registry = makePeerAwareInstanceRegistry(serverConfig, clientConfig, serverCodecs, client);
serverContext = new DefaultEurekaServerContext(serverConfig, serverCodecs, registry, mock(PeerEurekaNodes.class), applicationInfoManager);
serverContext.initialize();
}
Aggregations