From 0ab973b56390ab5685c81bbed8822bb3f4221df8 Mon Sep 17 00:00:00 2001 From: spencergibb Date: Thu, 13 Jan 2022 17:59:20 -0500 Subject: [PATCH] Moves non jersey 1 client classes to eureka-client-core eureka-client is now thin and only contains jersey1 code --- eureka-client-archaius2/build.gradle | 2 +- .../appinfo/Archaius2AmazonInfoConfig.java | 4 +- .../Ec2EurekaArchaius2InstanceConfig.java | 4 +- .../EurekaArchaius2InstanceConfig.java | 4 +- .../Archaius2VipAddressResolver.java | 4 +- .../CompositeInstanceConfigFactory.java | 4 +- ...azonInfoProviderInstanceConfigFactory.java | 4 +- .../EurekaArchaius2ClientConfig.java | 2 +- .../guice/InternalEurekaClientModule.java | 8 +- .../EurekaArchaius2TransportConfig.java | 2 +- eureka-client-core/build.gradle | 41 ++ .../appinfo/AbstractEurekaIdentity.java | 0 .../appinfo/AbstractInstanceConfig.java | 0 .../java/com/netflix/appinfo/AmazonInfo.java | 0 .../com/netflix/appinfo/AmazonInfoConfig.java | 0 .../appinfo/ApplicationInfoManager.java | 4 +- .../appinfo/Archaius1AmazonInfoConfig.java | 0 .../netflix/appinfo/CloudInstanceConfig.java | 2 +- .../com/netflix/appinfo/DataCenterInfo.java | 0 .../com/netflix/appinfo/EurekaAccept.java | 0 .../netflix/appinfo/EurekaClientIdentity.java | 0 .../netflix/appinfo/EurekaInstanceConfig.java | 0 .../netflix/appinfo/HealthCheckCallback.java | 0 .../HealthCheckCallbackToHandlerBridge.java | 0 .../netflix/appinfo/HealthCheckHandler.java | 0 .../netflix/appinfo/HealthCheckResource.java | 0 .../com/netflix/appinfo/InstanceInfo.java | 0 .../java/com/netflix/appinfo/LeaseInfo.java | 0 .../com/netflix/appinfo/MyDataCenterInfo.java | 0 .../appinfo/MyDataCenterInstanceConfig.java | 2 +- .../appinfo/PropertiesInstanceConfig.java | 0 ...ropertyBasedAmazonInfoConfigConstants.java | 0 .../PropertyBasedInstanceConfigConstants.java | 0 .../RefreshableAmazonInfoProvider.java | 0 .../appinfo/RefreshableInstanceConfig.java | 0 .../com/netflix/appinfo/UniqueIdentifier.java | 0 .../Archaius1VipAddressResolver.java | 0 .../CloudInstanceConfigProvider.java | 0 ...EurekaConfigBasedInstanceInfoProvider.java | 2 +- .../MyDataCenterInstanceConfigProvider.java | 0 .../appinfo/providers/VipAddressResolver.java | 0 .../discovery/AbstractAzToRegionMapper.java | 0 .../AbstractDiscoveryClientOptionalArgs.java | 8 - .../netflix/discovery/AzToRegionMapper.java | 0 .../com/netflix/discovery/BackupRegistry.java | 0 .../discovery/CacheRefreshedEvent.java | 0 .../netflix/discovery/CommonConstants.java | 0 .../discovery/DNSBasedAzToRegionMapper.java | 0 .../discovery/DefaultEurekaClientConfig.java | 2 +- .../netflix/discovery/DiscoveryClient.java | 63 +-- .../com/netflix/discovery/DiscoveryEvent.java | 0 .../netflix/discovery/DiscoveryManager.java | 0 .../com/netflix/discovery/EurekaClient.java | 0 .../netflix/discovery/EurekaClientConfig.java | 0 .../netflix/discovery/EurekaClientNames.java | 0 .../com/netflix/discovery/EurekaEvent.java | 0 .../discovery/EurekaEventListener.java | 0 .../netflix/discovery/EurekaNamespace.java | 0 .../discovery/EurekaUpStatusResolver.java | 2 +- .../discovery/InstanceInfoReplicator.java | 0 .../discovery/InstanceRegionChecker.java | 0 .../discovery/InternalEurekaStatusModule.java | 4 +- .../discovery/NotImplementedRegistryImpl.java | 2 +- .../discovery/PreRegistrationHandler.java | 0 .../PropertyBasedAzToRegionMapper.java | 0 .../PropertyBasedClientConfigConstants.java | 0 .../netflix/discovery/StatusChangeEvent.java | 0 .../discovery/TimedSupervisorTask.java | 0 .../netflix/discovery/converters/Auto.java | 0 .../discovery/converters/Converters.java | 0 .../converters/EntityBodyConverter.java | 0 .../discovery/converters/EnumLookup.java | 0 .../converters/EurekaJacksonCodec.java | 0 .../discovery/converters/JsonXStream.java | 0 .../discovery/converters/KeyFormatter.java | 4 +- .../discovery/converters/XmlXStream.java | 0 .../jackson/AbstractEurekaJacksonCodec.java | 0 .../jackson/DataCenterTypeInfoResolver.java | 0 .../jackson/EurekaJacksonJsonModifiers.java | 0 .../jackson/EurekaJacksonXmlModifiers.java | 0 .../jackson/EurekaJsonJacksonCodec.java | 0 .../jackson/EurekaXmlJacksonCodec.java | 0 .../builder/ApplicationsJacksonBuilder.java | 0 .../ApplicationsXmlJacksonBuilder.java | 0 .../StringInterningAmazonInfoBuilder.java | 0 .../jackson/mixin/ApplicationXmlMixIn.java | 0 .../jackson/mixin/ApplicationsJsonMixIn.java | 0 .../jackson/mixin/ApplicationsXmlMixIn.java | 0 .../jackson/mixin/DataCenterInfoXmlMixIn.java | 0 .../jackson/mixin/InstanceInfoJsonMixIn.java | 0 .../jackson/mixin/MiniInstanceInfoMixIn.java | 0 .../jackson/mixin/PortWrapperXmlMixIn.java | 0 .../ApplicationXmlDeserializer.java | 0 .../ApplicationsJsonBeanSerializer.java | 0 .../ApplicationsXmlBeanSerializer.java | 0 .../InstanceInfoJsonBeanSerializer.java | 0 .../InstanceInfoXmlBeanSerializer.java | 0 .../PortWrapperXmlDeserializer.java | 0 .../converters/wrappers/CodecWrapper.java | 0 .../converters/wrappers/CodecWrapperBase.java | 0 .../converters/wrappers/CodecWrappers.java | 5 +- .../converters/wrappers/DecoderWrapper.java | 0 .../converters/wrappers/EncoderWrapper.java | 0 .../discovery/endpoint/DnsResolver.java | 0 .../discovery/endpoint/EndpointUtils.java | 0 .../internal/util/AmazonInfoUtils.java | 0 .../internal/util/Archaius1Utils.java | 0 .../provider/DiscoveryJerseyProvider.java | 422 +++++++++--------- .../discovery/provider/ISerializer.java | 0 .../discovery/provider/Serializer.java | 0 .../DefaultEurekaClientConfigProvider.java | 0 .../netflix/discovery/shared/Application.java | 0 .../discovery/shared/Applications.java | 0 .../discovery/shared/LookupService.java | 0 .../shared/MonitoredConnectionManager.java | 0 .../discovery/shared/NamedConnectionPool.java | 0 .../com/netflix/discovery/shared/Pair.java | 0 .../discovery/shared/dns/DnsService.java | 0 .../discovery/shared/dns/DnsServiceImpl.java | 0 .../shared/resolver/AsyncResolver.java | 0 .../shared/resolver/ClosableResolver.java | 0 .../shared/resolver/ClusterResolver.java | 0 .../resolver/ClusterResolverException.java | 0 .../resolver/ClusterResolverFactory.java | 0 .../shared/resolver/DefaultEndpoint.java | 0 .../shared/resolver/DnsClusterResolver.java | 0 .../shared/resolver/EndpointRandomizer.java | 0 .../shared/resolver/EurekaEndpoint.java | 0 .../resolver/LegacyClusterResolver.java | 0 .../discovery/shared/resolver/README.md | 0 .../resolver/ReloadingClusterResolver.java | 0 .../shared/resolver/ResolverUtils.java | 0 .../resolver/StaticClusterResolver.java | 0 .../resolver/aws/ApplicationsResolver.java | 0 .../shared/resolver/aws/AwsEndpoint.java | 0 .../resolver/aws/ConfigClusterResolver.java | 0 .../aws/DnsTxtRecordClusterResolver.java | 0 .../resolver/aws/EurekaHttpResolver.java | 2 +- .../aws/ZoneAffinityClusterResolver.java | 0 .../DefaultEurekaTransportConfig.java | 0 .../transport/EurekaClientFactoryBuilder.java | 0 .../shared/transport/EurekaHttpClient.java | 0 .../transport/EurekaHttpClientFactory.java | 0 .../shared/transport/EurekaHttpClients.java | 0 .../shared/transport/EurekaHttpResponse.java | 0 .../transport/EurekaTransportConfig.java | 0 ...PropertyBasedTransportConfigConstants.java | 0 .../discovery/shared/transport/README.md | 0 .../transport/TransportClientFactory.java | 0 .../shared/transport/TransportException.java | 0 .../shared/transport/TransportUtils.java | 0 .../decorator/EurekaHttpClientDecorator.java | 0 .../MetricsCollectingEurekaHttpClient.java | 0 .../RedirectingEurekaHttpClient.java | 0 .../decorator/RetryableEurekaHttpClient.java | 0 .../decorator/ServerStatusEvaluator.java | 0 .../decorator/ServerStatusEvaluators.java | 0 .../decorator/SessionedEurekaHttpClient.java | 0 .../jersey/TransportClientFactories.java | 4 - .../util/DeserializerStringCache.java | 0 .../discovery/util/DiscoveryBuildInfo.java | 0 .../util/EurekaEntityComparators.java | 0 .../discovery/util/EurekaEntityFunctions.java | 0 .../util/EurekaEntityTransformers.java | 0 .../netflix/discovery/util/EurekaUtils.java | 0 .../discovery/util/ExceptionsMetric.java | 0 .../netflix/discovery/util/RateLimiter.java | 0 .../com/netflix/discovery/util/ServoUtil.java | 0 .../netflix/discovery/util/StringCache.java | 0 .../netflix/discovery/util/StringUtil.java | 0 .../netflix/discovery/util/SystemUtil.java | 0 .../discovery/util/ThresholdLevelsMetric.java | 0 .../com/netflix/appinfo/AmazonInfoTest.java | 0 .../appinfo/ApplicationInfoManagerTest.java | 0 .../appinfo/CloudInstanceConfigTest.java | 0 .../com/netflix/appinfo/InstanceInfoTest.java | 0 .../RefreshableAmazonInfoProviderTest.java | 0 .../AbstractDiscoveryClientTester.java | 0 .../netflix/discovery/BackUpRegistryTest.java | 0 .../discovery/BaseDiscoveryClientTester.java | 0 .../DiscoveryClientCloseJerseyThreadTest.java | 0 .../DiscoveryClientDisableRegistryTest.java | 0 .../DiscoveryClientEventBusTest.java | 0 .../discovery/DiscoveryClientHealthTest.java | 0 .../DiscoveryClientRedirectTest.java | 0 .../DiscoveryClientRegisterUpdateTest.java | 0 .../DiscoveryClientRegistryTest.java | 0 .../DiscoveryClientStatsInitFailedTest.java | 0 .../discovery/DiscoveryClientStatsTest.java | 0 ...urekaClientLifecycleServerFailureTest.java | 0 .../discovery/EurekaClientLifecycleTest.java | 0 .../discovery/EurekaEventListenerTest.java | 0 .../discovery/InstanceInfoReplicatorTest.java | 0 .../discovery/InstanceRegionCheckerTest.java | 0 ...ersey1DiscoveryClientOptionalArgsTest.java | 58 +++ .../netflix/discovery/MockBackupRegistry.java | 0 .../discovery/MockRemoteEurekaServer.java | 0 .../discovery/TimedSupervisorTaskTest.java | 0 .../discovery/converters/CodecLoadTester.java | 0 .../discovery/converters/EnumLookupTest.java | 0 .../EurekaCodecCompatibilityTest.java | 0 .../EurekaJacksonCodecIntegrationTest.java | 0 .../converters/EurekaJacksonCodecTest.java | 0 .../EurekaJsonAndXmlJacksonCodecTest.java | 0 .../discovery/converters/JsonXStreamTest.java | 0 .../discovery/converters/StringCacheTest.java | 0 .../discovery/converters/XmlXStreamTest.java | 0 .../StringInterningAmazonInfoBuilderTest.java | 0 .../wrappers/CodecWrappersTest.java | 0 .../discovery/guice/EurekaModuleTest.java | 81 ++++ .../provider/DiscoveryJerseyProviderTest.java | 0 ...DefaultEurekaClientConfigProviderTest.java | 0 .../discovery/shared/ApplicationsTest.java | 0 .../shared/resolver/AsyncResolverTest.java | 0 .../ReloadingClusterResolverTest.java | 0 .../shared/resolver/ResolverUtilsTest.java | 0 .../resolver/StaticClusterResolverTest.java | 0 .../aws/ApplicationsResolverTest.java | 0 .../aws/ConfigClusterResolverTest.java | 0 .../resolver/aws/EurekaHttpResolverTest.java | 0 .../shared/resolver/aws/SampleCluster.java | 0 .../resolver/aws/TestEurekaHttpResolver.java | 0 .../aws/ZoneAffinityClusterResolverTest.java | 0 .../RedirectingEurekaHttpClientTest.java | 0 .../RetryableEurekaHttpClientTest.java | 0 .../SessionedEurekaHttpClientTest.java | 0 .../util/DeserializerStringCacheTest.java | 0 .../util/DiscoveryBuildInfoTest.java | 0 .../util/EurekaEntityFunctionsTest.java | 0 .../discovery/util/EurekaUtilsTest.java | 0 .../discovery/util/RateLimiterTest.java | 0 eureka-client-jersey2/build.gradle | 2 +- .../Jersey2TransportClientFactories.java | 7 - eureka-client/build.gradle | 29 +- .../transport/EurekaHttpClientsTest.java | 8 +- .../eureka/DefaultEurekaServerConfig.java | 2 +- .../eureka/DefaultEurekaServerContext.java | 4 +- .../eureka/GzipEncodingEnforcingFilter.java | 2 +- .../netflix/eureka/RateLimitingFilter.java | 4 +- .../eureka/ServerRequestAuthFilter.java | 4 +- .../java/com/netflix/eureka/StatusFilter.java | 2 +- .../com/netflix/eureka/aws/AwsAsgUtil.java | 4 +- .../netflix/eureka/aws/AwsBinderDelegate.java | 4 +- .../com/netflix/eureka/aws/EIPManager.java | 4 +- .../aws/ElasticNetworkInterfaceBinder.java | 2 +- .../com/netflix/eureka/aws/Route53Binder.java | 4 +- .../eureka/cluster/PeerEurekaNodes.java | 4 +- .../eureka/registry/AwsInstanceRegistry.java | 4 +- .../PeerAwareInstanceRegistryImpl.java | 4 +- .../eureka/registry/RemoteRegionRegistry.java | 2 +- .../netflix/eureka/resources/ASGResource.java | 2 +- .../resources/ApplicationsResource.java | 2 +- .../eureka/resources/DefaultServerCodecs.java | 4 +- .../eureka/resources/InstancesResource.java | 2 +- .../resources/PeerReplicationResource.java | 2 +- .../eureka/resources/SecureVIPResource.java | 2 +- .../eureka/resources/ServerInfoResource.java | 2 +- .../eureka/resources/StatusResource.java | 2 +- .../netflix/eureka/resources/VIPResource.java | 2 +- .../JerseyRemoteRegionClientFactory.java | 2 +- .../netflix/eureka/ExampleServiceBase.java | 4 +- eureka-server-governator/build.gradle | 2 +- eureka-server/build.gradle | 2 +- settings.gradle | 5 +- 264 files changed, 487 insertions(+), 390 deletions(-) create mode 100644 eureka-client-core/build.gradle rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/appinfo/AbstractEurekaIdentity.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/appinfo/AbstractInstanceConfig.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/appinfo/AmazonInfo.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/appinfo/AmazonInfoConfig.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/appinfo/ApplicationInfoManager.java (99%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/appinfo/Archaius1AmazonInfoConfig.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/appinfo/CloudInstanceConfig.java (99%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/appinfo/DataCenterInfo.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/appinfo/EurekaAccept.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/appinfo/EurekaClientIdentity.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/appinfo/EurekaInstanceConfig.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/appinfo/HealthCheckCallback.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/appinfo/HealthCheckCallbackToHandlerBridge.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/appinfo/HealthCheckHandler.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/appinfo/HealthCheckResource.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/appinfo/InstanceInfo.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/appinfo/LeaseInfo.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/appinfo/MyDataCenterInfo.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/appinfo/MyDataCenterInstanceConfig.java (97%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/appinfo/PropertiesInstanceConfig.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/appinfo/PropertyBasedAmazonInfoConfigConstants.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/appinfo/PropertyBasedInstanceConfigConstants.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/appinfo/RefreshableAmazonInfoProvider.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/appinfo/RefreshableInstanceConfig.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/appinfo/UniqueIdentifier.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/appinfo/providers/Archaius1VipAddressResolver.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/appinfo/providers/CloudInstanceConfigProvider.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/appinfo/providers/EurekaConfigBasedInstanceInfoProvider.java (99%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/appinfo/providers/MyDataCenterInstanceConfigProvider.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/appinfo/providers/VipAddressResolver.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/AbstractAzToRegionMapper.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/AbstractDiscoveryClientOptionalArgs.java (92%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/AzToRegionMapper.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/BackupRegistry.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/CacheRefreshedEvent.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/CommonConstants.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/DNSBasedAzToRegionMapper.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/DefaultEurekaClientConfig.java (99%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/DiscoveryClient.java (96%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/DiscoveryEvent.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/DiscoveryManager.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/EurekaClient.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/EurekaClientConfig.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/EurekaClientNames.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/EurekaEvent.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/EurekaEventListener.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/EurekaNamespace.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/EurekaUpStatusResolver.java (98%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/InstanceInfoReplicator.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/InstanceRegionChecker.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/InternalEurekaStatusModule.java (96%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/NotImplementedRegistryImpl.java (91%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/PreRegistrationHandler.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/PropertyBasedAzToRegionMapper.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/PropertyBasedClientConfigConstants.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/StatusChangeEvent.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/TimedSupervisorTask.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/converters/Auto.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/converters/Converters.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/converters/EntityBodyConverter.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/converters/EnumLookup.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/converters/EurekaJacksonCodec.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/converters/JsonXStream.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/converters/KeyFormatter.java (95%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/converters/XmlXStream.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/converters/jackson/AbstractEurekaJacksonCodec.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/converters/jackson/DataCenterTypeInfoResolver.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/converters/jackson/EurekaJacksonJsonModifiers.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/converters/jackson/EurekaJacksonXmlModifiers.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/converters/jackson/EurekaJsonJacksonCodec.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/converters/jackson/EurekaXmlJacksonCodec.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/converters/jackson/builder/ApplicationsJacksonBuilder.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/converters/jackson/builder/ApplicationsXmlJacksonBuilder.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/converters/jackson/builder/StringInterningAmazonInfoBuilder.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/converters/jackson/mixin/ApplicationXmlMixIn.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/converters/jackson/mixin/ApplicationsJsonMixIn.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/converters/jackson/mixin/ApplicationsXmlMixIn.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/converters/jackson/mixin/DataCenterInfoXmlMixIn.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/converters/jackson/mixin/InstanceInfoJsonMixIn.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/converters/jackson/mixin/MiniInstanceInfoMixIn.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/converters/jackson/mixin/PortWrapperXmlMixIn.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/converters/jackson/serializer/ApplicationXmlDeserializer.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/converters/jackson/serializer/ApplicationsJsonBeanSerializer.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/converters/jackson/serializer/ApplicationsXmlBeanSerializer.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/converters/jackson/serializer/InstanceInfoJsonBeanSerializer.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/converters/jackson/serializer/InstanceInfoXmlBeanSerializer.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/converters/jackson/serializer/PortWrapperXmlDeserializer.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/converters/wrappers/CodecWrapper.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/converters/wrappers/CodecWrapperBase.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/converters/wrappers/CodecWrappers.java (97%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/converters/wrappers/DecoderWrapper.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/converters/wrappers/EncoderWrapper.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/endpoint/DnsResolver.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/endpoint/EndpointUtils.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/internal/util/AmazonInfoUtils.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/internal/util/Archaius1Utils.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/provider/DiscoveryJerseyProvider.java (97%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/provider/ISerializer.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/provider/Serializer.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/providers/DefaultEurekaClientConfigProvider.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/shared/Application.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/shared/Applications.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/shared/LookupService.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/shared/MonitoredConnectionManager.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/shared/NamedConnectionPool.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/shared/Pair.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/shared/dns/DnsService.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/shared/dns/DnsServiceImpl.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/shared/resolver/AsyncResolver.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/shared/resolver/ClosableResolver.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/shared/resolver/ClusterResolver.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/shared/resolver/ClusterResolverException.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/shared/resolver/ClusterResolverFactory.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/shared/resolver/DefaultEndpoint.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/shared/resolver/DnsClusterResolver.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/shared/resolver/EndpointRandomizer.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/shared/resolver/EurekaEndpoint.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/shared/resolver/LegacyClusterResolver.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/shared/resolver/README.md (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/shared/resolver/ReloadingClusterResolver.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/shared/resolver/ResolverUtils.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/shared/resolver/StaticClusterResolver.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/shared/resolver/aws/ApplicationsResolver.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/shared/resolver/aws/AwsEndpoint.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/shared/resolver/aws/ConfigClusterResolver.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/shared/resolver/aws/DnsTxtRecordClusterResolver.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/shared/resolver/aws/EurekaHttpResolver.java (98%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/shared/resolver/aws/ZoneAffinityClusterResolver.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/shared/transport/DefaultEurekaTransportConfig.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/shared/transport/EurekaClientFactoryBuilder.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/shared/transport/EurekaHttpClient.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/shared/transport/EurekaHttpClientFactory.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/shared/transport/EurekaHttpClients.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/shared/transport/EurekaHttpResponse.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/shared/transport/EurekaTransportConfig.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/shared/transport/PropertyBasedTransportConfigConstants.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/shared/transport/README.md (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/shared/transport/TransportClientFactory.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/shared/transport/TransportException.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/shared/transport/TransportUtils.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/shared/transport/decorator/EurekaHttpClientDecorator.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/shared/transport/decorator/MetricsCollectingEurekaHttpClient.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/shared/transport/decorator/RedirectingEurekaHttpClient.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/shared/transport/decorator/RetryableEurekaHttpClient.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/shared/transport/decorator/ServerStatusEvaluator.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/shared/transport/decorator/ServerStatusEvaluators.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/shared/transport/decorator/SessionedEurekaHttpClient.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/shared/transport/jersey/TransportClientFactories.java (81%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/util/DeserializerStringCache.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/util/DiscoveryBuildInfo.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/util/EurekaEntityComparators.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/util/EurekaEntityFunctions.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/util/EurekaEntityTransformers.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/util/EurekaUtils.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/util/ExceptionsMetric.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/util/RateLimiter.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/util/ServoUtil.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/util/StringCache.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/util/StringUtil.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/util/SystemUtil.java (100%) rename {eureka-client => eureka-client-core}/src/main/java/com/netflix/discovery/util/ThresholdLevelsMetric.java (100%) rename {eureka-client => eureka-client-core}/src/test/java/com/netflix/appinfo/AmazonInfoTest.java (100%) rename {eureka-client => eureka-client-core}/src/test/java/com/netflix/appinfo/ApplicationInfoManagerTest.java (100%) rename {eureka-client => eureka-client-core}/src/test/java/com/netflix/appinfo/CloudInstanceConfigTest.java (100%) rename {eureka-client => eureka-client-core}/src/test/java/com/netflix/appinfo/InstanceInfoTest.java (100%) rename {eureka-client => eureka-client-core}/src/test/java/com/netflix/appinfo/RefreshableAmazonInfoProviderTest.java (100%) rename {eureka-client => eureka-client-core}/src/test/java/com/netflix/discovery/AbstractDiscoveryClientTester.java (100%) rename {eureka-client => eureka-client-core}/src/test/java/com/netflix/discovery/BackUpRegistryTest.java (100%) rename {eureka-client => eureka-client-core}/src/test/java/com/netflix/discovery/BaseDiscoveryClientTester.java (100%) rename {eureka-client => eureka-client-core}/src/test/java/com/netflix/discovery/DiscoveryClientCloseJerseyThreadTest.java (100%) rename {eureka-client => eureka-client-core}/src/test/java/com/netflix/discovery/DiscoveryClientDisableRegistryTest.java (100%) rename {eureka-client => eureka-client-core}/src/test/java/com/netflix/discovery/DiscoveryClientEventBusTest.java (100%) rename {eureka-client => eureka-client-core}/src/test/java/com/netflix/discovery/DiscoveryClientHealthTest.java (100%) rename {eureka-client => eureka-client-core}/src/test/java/com/netflix/discovery/DiscoveryClientRedirectTest.java (100%) rename {eureka-client => eureka-client-core}/src/test/java/com/netflix/discovery/DiscoveryClientRegisterUpdateTest.java (100%) rename {eureka-client => eureka-client-core}/src/test/java/com/netflix/discovery/DiscoveryClientRegistryTest.java (100%) rename {eureka-client => eureka-client-core}/src/test/java/com/netflix/discovery/DiscoveryClientStatsInitFailedTest.java (100%) rename {eureka-client => eureka-client-core}/src/test/java/com/netflix/discovery/DiscoveryClientStatsTest.java (100%) rename {eureka-client => eureka-client-core}/src/test/java/com/netflix/discovery/EurekaClientLifecycleServerFailureTest.java (100%) rename {eureka-client => eureka-client-core}/src/test/java/com/netflix/discovery/EurekaClientLifecycleTest.java (100%) rename {eureka-client => eureka-client-core}/src/test/java/com/netflix/discovery/EurekaEventListenerTest.java (100%) rename {eureka-client => eureka-client-core}/src/test/java/com/netflix/discovery/InstanceInfoReplicatorTest.java (100%) rename {eureka-client => eureka-client-core}/src/test/java/com/netflix/discovery/InstanceRegionCheckerTest.java (100%) create mode 100644 eureka-client-core/src/test/java/com/netflix/discovery/Jersey1DiscoveryClientOptionalArgsTest.java rename {eureka-client => eureka-client-core}/src/test/java/com/netflix/discovery/MockBackupRegistry.java (100%) rename {eureka-client => eureka-client-core}/src/test/java/com/netflix/discovery/MockRemoteEurekaServer.java (100%) rename {eureka-client => eureka-client-core}/src/test/java/com/netflix/discovery/TimedSupervisorTaskTest.java (100%) rename {eureka-client => eureka-client-core}/src/test/java/com/netflix/discovery/converters/CodecLoadTester.java (100%) rename {eureka-client => eureka-client-core}/src/test/java/com/netflix/discovery/converters/EnumLookupTest.java (100%) rename {eureka-client => eureka-client-core}/src/test/java/com/netflix/discovery/converters/EurekaCodecCompatibilityTest.java (100%) rename {eureka-client => eureka-client-core}/src/test/java/com/netflix/discovery/converters/EurekaJacksonCodecIntegrationTest.java (100%) rename {eureka-client => eureka-client-core}/src/test/java/com/netflix/discovery/converters/EurekaJacksonCodecTest.java (100%) rename {eureka-client => eureka-client-core}/src/test/java/com/netflix/discovery/converters/EurekaJsonAndXmlJacksonCodecTest.java (100%) rename {eureka-client => eureka-client-core}/src/test/java/com/netflix/discovery/converters/JsonXStreamTest.java (100%) rename {eureka-client => eureka-client-core}/src/test/java/com/netflix/discovery/converters/StringCacheTest.java (100%) rename {eureka-client => eureka-client-core}/src/test/java/com/netflix/discovery/converters/XmlXStreamTest.java (100%) rename {eureka-client => eureka-client-core}/src/test/java/com/netflix/discovery/converters/jackson/builder/StringInterningAmazonInfoBuilderTest.java (100%) rename {eureka-client => eureka-client-core}/src/test/java/com/netflix/discovery/converters/wrappers/CodecWrappersTest.java (100%) create mode 100644 eureka-client-core/src/test/java/com/netflix/discovery/guice/EurekaModuleTest.java rename {eureka-client => eureka-client-core}/src/test/java/com/netflix/discovery/provider/DiscoveryJerseyProviderTest.java (100%) rename {eureka-client => eureka-client-core}/src/test/java/com/netflix/discovery/providers/DefaultEurekaClientConfigProviderTest.java (100%) rename {eureka-client => eureka-client-core}/src/test/java/com/netflix/discovery/shared/ApplicationsTest.java (100%) rename {eureka-client => eureka-client-core}/src/test/java/com/netflix/discovery/shared/resolver/AsyncResolverTest.java (100%) rename {eureka-client => eureka-client-core}/src/test/java/com/netflix/discovery/shared/resolver/ReloadingClusterResolverTest.java (100%) rename {eureka-client => eureka-client-core}/src/test/java/com/netflix/discovery/shared/resolver/ResolverUtilsTest.java (100%) rename {eureka-client => eureka-client-core}/src/test/java/com/netflix/discovery/shared/resolver/StaticClusterResolverTest.java (100%) rename {eureka-client => eureka-client-core}/src/test/java/com/netflix/discovery/shared/resolver/aws/ApplicationsResolverTest.java (100%) rename {eureka-client => eureka-client-core}/src/test/java/com/netflix/discovery/shared/resolver/aws/ConfigClusterResolverTest.java (100%) rename {eureka-client => eureka-client-core}/src/test/java/com/netflix/discovery/shared/resolver/aws/EurekaHttpResolverTest.java (100%) rename {eureka-client => eureka-client-core}/src/test/java/com/netflix/discovery/shared/resolver/aws/SampleCluster.java (100%) rename {eureka-client => eureka-client-core}/src/test/java/com/netflix/discovery/shared/resolver/aws/TestEurekaHttpResolver.java (100%) rename {eureka-client => eureka-client-core}/src/test/java/com/netflix/discovery/shared/resolver/aws/ZoneAffinityClusterResolverTest.java (100%) rename {eureka-client => eureka-client-core}/src/test/java/com/netflix/discovery/shared/transport/decorator/RedirectingEurekaHttpClientTest.java (100%) rename {eureka-client => eureka-client-core}/src/test/java/com/netflix/discovery/shared/transport/decorator/RetryableEurekaHttpClientTest.java (100%) rename {eureka-client => eureka-client-core}/src/test/java/com/netflix/discovery/shared/transport/decorator/SessionedEurekaHttpClientTest.java (100%) rename {eureka-client => eureka-client-core}/src/test/java/com/netflix/discovery/util/DeserializerStringCacheTest.java (100%) rename {eureka-client => eureka-client-core}/src/test/java/com/netflix/discovery/util/DiscoveryBuildInfoTest.java (100%) rename {eureka-client => eureka-client-core}/src/test/java/com/netflix/discovery/util/EurekaEntityFunctionsTest.java (100%) rename {eureka-client => eureka-client-core}/src/test/java/com/netflix/discovery/util/EurekaUtilsTest.java (100%) rename {eureka-client => eureka-client-core}/src/test/java/com/netflix/discovery/util/RateLimiterTest.java (100%) diff --git a/eureka-client-archaius2/build.gradle b/eureka-client-archaius2/build.gradle index 82ea351f8..045463cb2 100644 --- a/eureka-client-archaius2/build.gradle +++ b/eureka-client-archaius2/build.gradle @@ -9,7 +9,7 @@ sourceSets { } dependencies { - compile project(':eureka-client') + compile project(':eureka-client-core') // archaius2 compile "com.netflix.archaius:archaius2-core:${archaius2Version}" diff --git a/eureka-client-archaius2/src/main/java/com/netflix/appinfo/Archaius2AmazonInfoConfig.java b/eureka-client-archaius2/src/main/java/com/netflix/appinfo/Archaius2AmazonInfoConfig.java index 306583b43..dd405b2dd 100644 --- a/eureka-client-archaius2/src/main/java/com/netflix/appinfo/Archaius2AmazonInfoConfig.java +++ b/eureka-client-archaius2/src/main/java/com/netflix/appinfo/Archaius2AmazonInfoConfig.java @@ -5,8 +5,8 @@ import com.netflix.discovery.CommonConstants; import com.netflix.discovery.internal.util.InternalPrefixedConfig; -import javax.inject.Inject; -import javax.inject.Singleton; +import com.google.inject.Inject; +import com.google.inject.Singleton; import static com.netflix.appinfo.PropertyBasedAmazonInfoConfigConstants.*; diff --git a/eureka-client-archaius2/src/main/java/com/netflix/appinfo/Ec2EurekaArchaius2InstanceConfig.java b/eureka-client-archaius2/src/main/java/com/netflix/appinfo/Ec2EurekaArchaius2InstanceConfig.java index 55a4b82b1..9975734f6 100644 --- a/eureka-client-archaius2/src/main/java/com/netflix/appinfo/Ec2EurekaArchaius2InstanceConfig.java +++ b/eureka-client-archaius2/src/main/java/com/netflix/appinfo/Ec2EurekaArchaius2InstanceConfig.java @@ -1,8 +1,8 @@ package com.netflix.appinfo; -import javax.inject.Inject; +import com.google.inject.Inject; import javax.inject.Provider; -import javax.inject.Singleton; +import com.google.inject.Singleton; import com.netflix.discovery.CommonConstants; import org.slf4j.Logger; diff --git a/eureka-client-archaius2/src/main/java/com/netflix/appinfo/EurekaArchaius2InstanceConfig.java b/eureka-client-archaius2/src/main/java/com/netflix/appinfo/EurekaArchaius2InstanceConfig.java index 902952bf5..5aaaf03e3 100644 --- a/eureka-client-archaius2/src/main/java/com/netflix/appinfo/EurekaArchaius2InstanceConfig.java +++ b/eureka-client-archaius2/src/main/java/com/netflix/appinfo/EurekaArchaius2InstanceConfig.java @@ -3,8 +3,8 @@ import java.util.HashMap; import java.util.Map; -import javax.inject.Inject; -import javax.inject.Singleton; +import com.google.inject.Inject; +import com.google.inject.Singleton; import com.google.common.collect.Sets; import com.netflix.archaius.api.Config; diff --git a/eureka-client-archaius2/src/main/java/com/netflix/appinfo/providers/Archaius2VipAddressResolver.java b/eureka-client-archaius2/src/main/java/com/netflix/appinfo/providers/Archaius2VipAddressResolver.java index eb6da9d5f..5df644fbd 100644 --- a/eureka-client-archaius2/src/main/java/com/netflix/appinfo/providers/Archaius2VipAddressResolver.java +++ b/eureka-client-archaius2/src/main/java/com/netflix/appinfo/providers/Archaius2VipAddressResolver.java @@ -4,8 +4,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.inject.Inject; -import javax.inject.Singleton; +import com.google.inject.Inject; +import com.google.inject.Singleton; import java.util.regex.Matcher; import java.util.regex.Pattern; diff --git a/eureka-client-archaius2/src/main/java/com/netflix/appinfo/providers/CompositeInstanceConfigFactory.java b/eureka-client-archaius2/src/main/java/com/netflix/appinfo/providers/CompositeInstanceConfigFactory.java index 90eb169ee..c88ec2390 100644 --- a/eureka-client-archaius2/src/main/java/com/netflix/appinfo/providers/CompositeInstanceConfigFactory.java +++ b/eureka-client-archaius2/src/main/java/com/netflix/appinfo/providers/CompositeInstanceConfigFactory.java @@ -15,8 +15,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.inject.Inject; -import javax.inject.Singleton; +import com.google.inject.Inject; +import com.google.inject.Singleton; import java.net.SocketTimeoutException; import java.net.URL; diff --git a/eureka-client-archaius2/src/main/java/com/netflix/appinfo/providers/CustomAmazonInfoProviderInstanceConfigFactory.java b/eureka-client-archaius2/src/main/java/com/netflix/appinfo/providers/CustomAmazonInfoProviderInstanceConfigFactory.java index 49731775c..748652803 100644 --- a/eureka-client-archaius2/src/main/java/com/netflix/appinfo/providers/CustomAmazonInfoProviderInstanceConfigFactory.java +++ b/eureka-client-archaius2/src/main/java/com/netflix/appinfo/providers/CustomAmazonInfoProviderInstanceConfigFactory.java @@ -8,9 +8,9 @@ import com.netflix.discovery.DiscoveryManager; import com.google.inject.Inject; -import javax.inject.Named; +import com.google.inject.name.Named; import javax.inject.Provider; -import javax.inject.Singleton; +import com.google.inject.Singleton; @Singleton public class CustomAmazonInfoProviderInstanceConfigFactory implements EurekaInstanceConfigFactory { diff --git a/eureka-client-archaius2/src/main/java/com/netflix/discovery/EurekaArchaius2ClientConfig.java b/eureka-client-archaius2/src/main/java/com/netflix/discovery/EurekaArchaius2ClientConfig.java index 8b54cbb5d..19689bb04 100644 --- a/eureka-client-archaius2/src/main/java/com/netflix/discovery/EurekaArchaius2ClientConfig.java +++ b/eureka-client-archaius2/src/main/java/com/netflix/discovery/EurekaArchaius2ClientConfig.java @@ -11,7 +11,7 @@ import com.netflix.discovery.internal.util.InternalPrefixedConfig; import com.netflix.discovery.shared.transport.EurekaTransportConfig; -import javax.inject.Singleton; +import com.google.inject.Singleton; import static com.netflix.discovery.PropertyBasedClientConfigConstants.*; diff --git a/eureka-client-archaius2/src/main/java/com/netflix/discovery/guice/InternalEurekaClientModule.java b/eureka-client-archaius2/src/main/java/com/netflix/discovery/guice/InternalEurekaClientModule.java index 92770c28f..797324b21 100644 --- a/eureka-client-archaius2/src/main/java/com/netflix/discovery/guice/InternalEurekaClientModule.java +++ b/eureka-client-archaius2/src/main/java/com/netflix/discovery/guice/InternalEurekaClientModule.java @@ -24,10 +24,9 @@ import com.netflix.discovery.shared.resolver.ResolverUtils; import com.netflix.discovery.shared.transport.EurekaArchaius2TransportConfig; import com.netflix.discovery.shared.transport.EurekaTransportConfig; -import com.netflix.discovery.shared.transport.jersey.Jersey1DiscoveryClientOptionalArgs; -import javax.inject.Named; -import javax.inject.Singleton; +import com.google.inject.name.Named; +import com.google.inject.Singleton; final class InternalEurekaClientModule extends AbstractModule { @@ -74,9 +73,6 @@ protected void configure() { bind(EurekaClient.class).to(DiscoveryClient.class); bind(EndpointRandomizer.class).toInstance(ResolverUtils::randomize); - - // Default to the jersey1 discovery client optional args - bind(AbstractDiscoveryClientOptionalArgs.class).to(Jersey1DiscoveryClientOptionalArgs.class).in(Scopes.SINGLETON); } @Provides diff --git a/eureka-client-archaius2/src/main/java/com/netflix/discovery/shared/transport/EurekaArchaius2TransportConfig.java b/eureka-client-archaius2/src/main/java/com/netflix/discovery/shared/transport/EurekaArchaius2TransportConfig.java index bec524c50..c956c2a59 100644 --- a/eureka-client-archaius2/src/main/java/com/netflix/discovery/shared/transport/EurekaArchaius2TransportConfig.java +++ b/eureka-client-archaius2/src/main/java/com/netflix/discovery/shared/transport/EurekaArchaius2TransportConfig.java @@ -6,7 +6,7 @@ import com.netflix.discovery.CommonConstants; import com.netflix.discovery.internal.util.InternalPrefixedConfig; -import javax.inject.Singleton; +import com.google.inject.Singleton; import static com.netflix.discovery.shared.transport.PropertyBasedTransportConfigConstants.*; diff --git a/eureka-client-core/build.gradle b/eureka-client-core/build.gradle new file mode 100644 index 000000000..d628476e7 --- /dev/null +++ b/eureka-client-core/build.gradle @@ -0,0 +1,41 @@ +apply plugin: 'nebula.test-jar' + +configurations.all { + // jersey2 + exclude group: 'org.glassfish.jersey' +} + +dependencies { + compile "com.netflix.netflix-commons:netflix-eventbus:0.3.0" + compile 'com.thoughtworks.xstream:xstream:1.4.18' + compile "com.netflix.archaius:archaius-core:${archaiusVersion}" + compile 'javax.ws.rs:jsr311-api:1.1.1' + compile "com.netflix.servo:servo-core:${servoVersion}" + compile "org.apache.httpcomponents:httpclient:${apacheHttpClientVersion}" + compile "com.google.code.findbugs:jsr305:${jsr305Version}" + compile "commons-configuration:commons-configuration:${commonsConfigurationVersion}" + compile "com.google.inject:guice:${guiceVersion}" + + compile "com.github.vlsi.compactmap:compactmap:2.0" + + compile "com.fasterxml.jackson.core:jackson-annotations:${jacksonVersion}" + compile "com.fasterxml.jackson.core:jackson-core:${jacksonVersion}" + compile "com.fasterxml.jackson.core:jackson-databind:${jacksonDatabindVersion}" + + // Eureka client uses JSON encoding by default + compileOnly "com.fasterxml.jackson.dataformat:jackson-dataformat-xml:${jacksonVersion}" + // Prefered jackson Stax serializer. Default Oracle has issues (adds empty namespace) and is slower + compileOnly "com.fasterxml.woodstox:woodstox-core:${woodstoxVersion}" + + runtimeOnly "org.codehaus.jettison:jettison:${jettisonVersion}" + + testCompile project(':eureka-test-utils') + testCompile "junit:junit:${junit_version}" + testCompile 'org.mortbay.jetty:jetty:6.1H.22' + testCompile "org.mockito:mockito-core:${mockitoVersion}" + testCompile "org.mock-server:mockserver-netty:${mockserverVersion}" + testCompile "com.netflix.governator:governator:${governatorVersion}" + testCompile "com.github.tomakehurst:wiremock-jre8:2.25.1" + testCompile "org.assertj:assertj-core:3.11.1" + testCompile "javax.servlet:javax.servlet-api:4.0.1" +} diff --git a/eureka-client/src/main/java/com/netflix/appinfo/AbstractEurekaIdentity.java b/eureka-client-core/src/main/java/com/netflix/appinfo/AbstractEurekaIdentity.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/appinfo/AbstractEurekaIdentity.java rename to eureka-client-core/src/main/java/com/netflix/appinfo/AbstractEurekaIdentity.java diff --git a/eureka-client/src/main/java/com/netflix/appinfo/AbstractInstanceConfig.java b/eureka-client-core/src/main/java/com/netflix/appinfo/AbstractInstanceConfig.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/appinfo/AbstractInstanceConfig.java rename to eureka-client-core/src/main/java/com/netflix/appinfo/AbstractInstanceConfig.java diff --git a/eureka-client/src/main/java/com/netflix/appinfo/AmazonInfo.java b/eureka-client-core/src/main/java/com/netflix/appinfo/AmazonInfo.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/appinfo/AmazonInfo.java rename to eureka-client-core/src/main/java/com/netflix/appinfo/AmazonInfo.java diff --git a/eureka-client/src/main/java/com/netflix/appinfo/AmazonInfoConfig.java b/eureka-client-core/src/main/java/com/netflix/appinfo/AmazonInfoConfig.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/appinfo/AmazonInfoConfig.java rename to eureka-client-core/src/main/java/com/netflix/appinfo/AmazonInfoConfig.java diff --git a/eureka-client/src/main/java/com/netflix/appinfo/ApplicationInfoManager.java b/eureka-client-core/src/main/java/com/netflix/appinfo/ApplicationInfoManager.java similarity index 99% rename from eureka-client/src/main/java/com/netflix/appinfo/ApplicationInfoManager.java rename to eureka-client-core/src/main/java/com/netflix/appinfo/ApplicationInfoManager.java index 8f517cfd3..baf693d44 100644 --- a/eureka-client/src/main/java/com/netflix/appinfo/ApplicationInfoManager.java +++ b/eureka-client-core/src/main/java/com/netflix/appinfo/ApplicationInfoManager.java @@ -16,8 +16,8 @@ package com.netflix.appinfo; -import javax.inject.Inject; -import javax.inject.Singleton; +import com.google.inject.Inject; +import com.google.inject.Singleton; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; diff --git a/eureka-client/src/main/java/com/netflix/appinfo/Archaius1AmazonInfoConfig.java b/eureka-client-core/src/main/java/com/netflix/appinfo/Archaius1AmazonInfoConfig.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/appinfo/Archaius1AmazonInfoConfig.java rename to eureka-client-core/src/main/java/com/netflix/appinfo/Archaius1AmazonInfoConfig.java diff --git a/eureka-client/src/main/java/com/netflix/appinfo/CloudInstanceConfig.java b/eureka-client-core/src/main/java/com/netflix/appinfo/CloudInstanceConfig.java similarity index 99% rename from eureka-client/src/main/java/com/netflix/appinfo/CloudInstanceConfig.java rename to eureka-client-core/src/main/java/com/netflix/appinfo/CloudInstanceConfig.java index 356a7052c..0bb9f160f 100644 --- a/eureka-client/src/main/java/com/netflix/appinfo/CloudInstanceConfig.java +++ b/eureka-client-core/src/main/java/com/netflix/appinfo/CloudInstanceConfig.java @@ -23,7 +23,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.inject.Singleton; +import com.google.inject.Singleton; /** * An {@link InstanceInfo} configuration for AWS cloud deployments. diff --git a/eureka-client/src/main/java/com/netflix/appinfo/DataCenterInfo.java b/eureka-client-core/src/main/java/com/netflix/appinfo/DataCenterInfo.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/appinfo/DataCenterInfo.java rename to eureka-client-core/src/main/java/com/netflix/appinfo/DataCenterInfo.java diff --git a/eureka-client/src/main/java/com/netflix/appinfo/EurekaAccept.java b/eureka-client-core/src/main/java/com/netflix/appinfo/EurekaAccept.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/appinfo/EurekaAccept.java rename to eureka-client-core/src/main/java/com/netflix/appinfo/EurekaAccept.java diff --git a/eureka-client/src/main/java/com/netflix/appinfo/EurekaClientIdentity.java b/eureka-client-core/src/main/java/com/netflix/appinfo/EurekaClientIdentity.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/appinfo/EurekaClientIdentity.java rename to eureka-client-core/src/main/java/com/netflix/appinfo/EurekaClientIdentity.java diff --git a/eureka-client/src/main/java/com/netflix/appinfo/EurekaInstanceConfig.java b/eureka-client-core/src/main/java/com/netflix/appinfo/EurekaInstanceConfig.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/appinfo/EurekaInstanceConfig.java rename to eureka-client-core/src/main/java/com/netflix/appinfo/EurekaInstanceConfig.java diff --git a/eureka-client/src/main/java/com/netflix/appinfo/HealthCheckCallback.java b/eureka-client-core/src/main/java/com/netflix/appinfo/HealthCheckCallback.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/appinfo/HealthCheckCallback.java rename to eureka-client-core/src/main/java/com/netflix/appinfo/HealthCheckCallback.java diff --git a/eureka-client/src/main/java/com/netflix/appinfo/HealthCheckCallbackToHandlerBridge.java b/eureka-client-core/src/main/java/com/netflix/appinfo/HealthCheckCallbackToHandlerBridge.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/appinfo/HealthCheckCallbackToHandlerBridge.java rename to eureka-client-core/src/main/java/com/netflix/appinfo/HealthCheckCallbackToHandlerBridge.java diff --git a/eureka-client/src/main/java/com/netflix/appinfo/HealthCheckHandler.java b/eureka-client-core/src/main/java/com/netflix/appinfo/HealthCheckHandler.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/appinfo/HealthCheckHandler.java rename to eureka-client-core/src/main/java/com/netflix/appinfo/HealthCheckHandler.java diff --git a/eureka-client/src/main/java/com/netflix/appinfo/HealthCheckResource.java b/eureka-client-core/src/main/java/com/netflix/appinfo/HealthCheckResource.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/appinfo/HealthCheckResource.java rename to eureka-client-core/src/main/java/com/netflix/appinfo/HealthCheckResource.java diff --git a/eureka-client/src/main/java/com/netflix/appinfo/InstanceInfo.java b/eureka-client-core/src/main/java/com/netflix/appinfo/InstanceInfo.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/appinfo/InstanceInfo.java rename to eureka-client-core/src/main/java/com/netflix/appinfo/InstanceInfo.java diff --git a/eureka-client/src/main/java/com/netflix/appinfo/LeaseInfo.java b/eureka-client-core/src/main/java/com/netflix/appinfo/LeaseInfo.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/appinfo/LeaseInfo.java rename to eureka-client-core/src/main/java/com/netflix/appinfo/LeaseInfo.java diff --git a/eureka-client/src/main/java/com/netflix/appinfo/MyDataCenterInfo.java b/eureka-client-core/src/main/java/com/netflix/appinfo/MyDataCenterInfo.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/appinfo/MyDataCenterInfo.java rename to eureka-client-core/src/main/java/com/netflix/appinfo/MyDataCenterInfo.java diff --git a/eureka-client/src/main/java/com/netflix/appinfo/MyDataCenterInstanceConfig.java b/eureka-client-core/src/main/java/com/netflix/appinfo/MyDataCenterInstanceConfig.java similarity index 97% rename from eureka-client/src/main/java/com/netflix/appinfo/MyDataCenterInstanceConfig.java rename to eureka-client-core/src/main/java/com/netflix/appinfo/MyDataCenterInstanceConfig.java index 5741f3cf7..21e2ccc21 100644 --- a/eureka-client/src/main/java/com/netflix/appinfo/MyDataCenterInstanceConfig.java +++ b/eureka-client-core/src/main/java/com/netflix/appinfo/MyDataCenterInstanceConfig.java @@ -18,7 +18,7 @@ import com.google.inject.ProvidedBy; import com.netflix.appinfo.providers.MyDataCenterInstanceConfigProvider; -import javax.inject.Singleton; +import com.google.inject.Singleton; /** * An {@link InstanceInfo} configuration for the non-AWS datacenter. diff --git a/eureka-client/src/main/java/com/netflix/appinfo/PropertiesInstanceConfig.java b/eureka-client-core/src/main/java/com/netflix/appinfo/PropertiesInstanceConfig.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/appinfo/PropertiesInstanceConfig.java rename to eureka-client-core/src/main/java/com/netflix/appinfo/PropertiesInstanceConfig.java diff --git a/eureka-client/src/main/java/com/netflix/appinfo/PropertyBasedAmazonInfoConfigConstants.java b/eureka-client-core/src/main/java/com/netflix/appinfo/PropertyBasedAmazonInfoConfigConstants.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/appinfo/PropertyBasedAmazonInfoConfigConstants.java rename to eureka-client-core/src/main/java/com/netflix/appinfo/PropertyBasedAmazonInfoConfigConstants.java diff --git a/eureka-client/src/main/java/com/netflix/appinfo/PropertyBasedInstanceConfigConstants.java b/eureka-client-core/src/main/java/com/netflix/appinfo/PropertyBasedInstanceConfigConstants.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/appinfo/PropertyBasedInstanceConfigConstants.java rename to eureka-client-core/src/main/java/com/netflix/appinfo/PropertyBasedInstanceConfigConstants.java diff --git a/eureka-client/src/main/java/com/netflix/appinfo/RefreshableAmazonInfoProvider.java b/eureka-client-core/src/main/java/com/netflix/appinfo/RefreshableAmazonInfoProvider.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/appinfo/RefreshableAmazonInfoProvider.java rename to eureka-client-core/src/main/java/com/netflix/appinfo/RefreshableAmazonInfoProvider.java diff --git a/eureka-client/src/main/java/com/netflix/appinfo/RefreshableInstanceConfig.java b/eureka-client-core/src/main/java/com/netflix/appinfo/RefreshableInstanceConfig.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/appinfo/RefreshableInstanceConfig.java rename to eureka-client-core/src/main/java/com/netflix/appinfo/RefreshableInstanceConfig.java diff --git a/eureka-client/src/main/java/com/netflix/appinfo/UniqueIdentifier.java b/eureka-client-core/src/main/java/com/netflix/appinfo/UniqueIdentifier.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/appinfo/UniqueIdentifier.java rename to eureka-client-core/src/main/java/com/netflix/appinfo/UniqueIdentifier.java diff --git a/eureka-client/src/main/java/com/netflix/appinfo/providers/Archaius1VipAddressResolver.java b/eureka-client-core/src/main/java/com/netflix/appinfo/providers/Archaius1VipAddressResolver.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/appinfo/providers/Archaius1VipAddressResolver.java rename to eureka-client-core/src/main/java/com/netflix/appinfo/providers/Archaius1VipAddressResolver.java diff --git a/eureka-client/src/main/java/com/netflix/appinfo/providers/CloudInstanceConfigProvider.java b/eureka-client-core/src/main/java/com/netflix/appinfo/providers/CloudInstanceConfigProvider.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/appinfo/providers/CloudInstanceConfigProvider.java rename to eureka-client-core/src/main/java/com/netflix/appinfo/providers/CloudInstanceConfigProvider.java diff --git a/eureka-client/src/main/java/com/netflix/appinfo/providers/EurekaConfigBasedInstanceInfoProvider.java b/eureka-client-core/src/main/java/com/netflix/appinfo/providers/EurekaConfigBasedInstanceInfoProvider.java similarity index 99% rename from eureka-client/src/main/java/com/netflix/appinfo/providers/EurekaConfigBasedInstanceInfoProvider.java rename to eureka-client-core/src/main/java/com/netflix/appinfo/providers/EurekaConfigBasedInstanceInfoProvider.java index aab277e39..1ee13d4e1 100644 --- a/eureka-client/src/main/java/com/netflix/appinfo/providers/EurekaConfigBasedInstanceInfoProvider.java +++ b/eureka-client-core/src/main/java/com/netflix/appinfo/providers/EurekaConfigBasedInstanceInfoProvider.java @@ -1,6 +1,6 @@ package com.netflix.appinfo.providers; -import javax.inject.Singleton; +import com.google.inject.Singleton; import javax.inject.Provider; import java.util.Map; diff --git a/eureka-client/src/main/java/com/netflix/appinfo/providers/MyDataCenterInstanceConfigProvider.java b/eureka-client-core/src/main/java/com/netflix/appinfo/providers/MyDataCenterInstanceConfigProvider.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/appinfo/providers/MyDataCenterInstanceConfigProvider.java rename to eureka-client-core/src/main/java/com/netflix/appinfo/providers/MyDataCenterInstanceConfigProvider.java diff --git a/eureka-client/src/main/java/com/netflix/appinfo/providers/VipAddressResolver.java b/eureka-client-core/src/main/java/com/netflix/appinfo/providers/VipAddressResolver.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/appinfo/providers/VipAddressResolver.java rename to eureka-client-core/src/main/java/com/netflix/appinfo/providers/VipAddressResolver.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/AbstractAzToRegionMapper.java b/eureka-client-core/src/main/java/com/netflix/discovery/AbstractAzToRegionMapper.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/AbstractAzToRegionMapper.java rename to eureka-client-core/src/main/java/com/netflix/discovery/AbstractAzToRegionMapper.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/AbstractDiscoveryClientOptionalArgs.java b/eureka-client-core/src/main/java/com/netflix/discovery/AbstractDiscoveryClientOptionalArgs.java similarity index 92% rename from eureka-client/src/main/java/com/netflix/discovery/AbstractDiscoveryClientOptionalArgs.java rename to eureka-client-core/src/main/java/com/netflix/discovery/AbstractDiscoveryClientOptionalArgs.java index 1960664bd..f25f4be85 100644 --- a/eureka-client/src/main/java/com/netflix/discovery/AbstractDiscoveryClientOptionalArgs.java +++ b/eureka-client-core/src/main/java/com/netflix/discovery/AbstractDiscoveryClientOptionalArgs.java @@ -14,7 +14,6 @@ import com.netflix.appinfo.HealthCheckCallback; import com.netflix.appinfo.HealthCheckHandler; import com.netflix.discovery.shared.transport.TransportClientFactory; -import com.netflix.discovery.shared.transport.jersey.EurekaJerseyClient; import com.netflix.discovery.shared.transport.jersey.TransportClientFactories; import com.netflix.eventbus.spi.EventBus; @@ -30,8 +29,6 @@ public abstract class AbstractDiscoveryClientOptionalArgs { Collection additionalFilters; - EurekaJerseyClient eurekaJerseyClient; - TransportClientFactory transportClientFactory; TransportClientFactories transportClientFactories; @@ -85,11 +82,6 @@ public void setAdditionalFilters(Collection additionalFilters) { this.additionalFilters = additionalFilters; } - @Inject(optional = true) - public void setEurekaJerseyClient(EurekaJerseyClient eurekaJerseyClient) { - this.eurekaJerseyClient = eurekaJerseyClient; - } - Set getEventListeners() { return eventListeners == null ? Collections.emptySet() : eventListeners; } diff --git a/eureka-client/src/main/java/com/netflix/discovery/AzToRegionMapper.java b/eureka-client-core/src/main/java/com/netflix/discovery/AzToRegionMapper.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/AzToRegionMapper.java rename to eureka-client-core/src/main/java/com/netflix/discovery/AzToRegionMapper.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/BackupRegistry.java b/eureka-client-core/src/main/java/com/netflix/discovery/BackupRegistry.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/BackupRegistry.java rename to eureka-client-core/src/main/java/com/netflix/discovery/BackupRegistry.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/CacheRefreshedEvent.java b/eureka-client-core/src/main/java/com/netflix/discovery/CacheRefreshedEvent.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/CacheRefreshedEvent.java rename to eureka-client-core/src/main/java/com/netflix/discovery/CacheRefreshedEvent.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/CommonConstants.java b/eureka-client-core/src/main/java/com/netflix/discovery/CommonConstants.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/CommonConstants.java rename to eureka-client-core/src/main/java/com/netflix/discovery/CommonConstants.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/DNSBasedAzToRegionMapper.java b/eureka-client-core/src/main/java/com/netflix/discovery/DNSBasedAzToRegionMapper.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/DNSBasedAzToRegionMapper.java rename to eureka-client-core/src/main/java/com/netflix/discovery/DNSBasedAzToRegionMapper.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/DefaultEurekaClientConfig.java b/eureka-client-core/src/main/java/com/netflix/discovery/DefaultEurekaClientConfig.java similarity index 99% rename from eureka-client/src/main/java/com/netflix/discovery/DefaultEurekaClientConfig.java rename to eureka-client-core/src/main/java/com/netflix/discovery/DefaultEurekaClientConfig.java index dd1b9c292..b8db0c9a5 100644 --- a/eureka-client/src/main/java/com/netflix/discovery/DefaultEurekaClientConfig.java +++ b/eureka-client-core/src/main/java/com/netflix/discovery/DefaultEurekaClientConfig.java @@ -17,7 +17,7 @@ package com.netflix.discovery; import javax.annotation.Nullable; -import javax.inject.Singleton; +import com.google.inject.Singleton; import java.util.ArrayList; import java.util.Arrays; import java.util.List; diff --git a/eureka-client/src/main/java/com/netflix/discovery/DiscoveryClient.java b/eureka-client-core/src/main/java/com/netflix/discovery/DiscoveryClient.java similarity index 96% rename from eureka-client/src/main/java/com/netflix/discovery/DiscoveryClient.java rename to eureka-client-core/src/main/java/com/netflix/discovery/DiscoveryClient.java index e04a778b1..e9f742a65 100644 --- a/eureka-client/src/main/java/com/netflix/discovery/DiscoveryClient.java +++ b/eureka-client-core/src/main/java/com/netflix/discovery/DiscoveryClient.java @@ -45,13 +45,14 @@ import javax.annotation.Nullable; import javax.annotation.PreDestroy; import javax.inject.Provider; -import javax.inject.Singleton; +import com.google.inject.Singleton; import javax.net.ssl.HostnameVerifier; import javax.net.ssl.SSLContext; import javax.ws.rs.core.Response.Status; import com.netflix.discovery.shared.resolver.EndpointRandomizer; import com.netflix.discovery.shared.resolver.ResolverUtils; +import com.netflix.discovery.shared.transport.jersey.TransportClientFactories; import org.apache.commons.lang.exception.ExceptionUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -78,10 +79,6 @@ import com.netflix.discovery.shared.transport.EurekaHttpResponse; import com.netflix.discovery.shared.transport.EurekaTransportConfig; import com.netflix.discovery.shared.transport.TransportClientFactory; -import com.netflix.discovery.shared.transport.jersey.EurekaJerseyClient; -import com.netflix.discovery.shared.transport.jersey.Jersey1DiscoveryClientOptionalArgs; -import com.netflix.discovery.shared.transport.jersey.Jersey1TransportClientFactories; -import com.netflix.discovery.shared.transport.jersey.TransportClientFactories; import com.netflix.discovery.util.ThresholdLevelsMetric; import com.netflix.servo.annotations.DataSourceType; import com.netflix.servo.monitor.Counter; @@ -231,10 +228,6 @@ void shutdown() { } } - public static class DiscoveryClientOptionalArgs extends Jersey1DiscoveryClientOptionalArgs { - - } - /** * Assumes applicationInfoManager is already initialized * @@ -245,16 +238,6 @@ public DiscoveryClient(InstanceInfo myInfo, EurekaClientConfig config) { this(myInfo, config, null); } - /** - * Assumes applicationInfoManager is already initialized - * - * @deprecated use constructor that takes ApplicationInfoManager instead of InstanceInfo directly - */ - @Deprecated - public DiscoveryClient(InstanceInfo myInfo, EurekaClientConfig config, DiscoveryClientOptionalArgs args) { - this(ApplicationInfoManager.getInstance(), config, args); - } - /** * @deprecated use constructor that takes ApplicationInfoManager instead of InstanceInfo directly */ @@ -267,14 +250,6 @@ public DiscoveryClient(ApplicationInfoManager applicationInfoManager, EurekaClie this(applicationInfoManager, config, null); } - /** - * @deprecated use the version that take {@link com.netflix.discovery.AbstractDiscoveryClientOptionalArgs} instead - */ - @Deprecated - public DiscoveryClient(ApplicationInfoManager applicationInfoManager, final EurekaClientConfig config, DiscoveryClientOptionalArgs args) { - this(applicationInfoManager, config, (AbstractDiscoveryClientOptionalArgs) args); - } - public DiscoveryClient(ApplicationInfoManager applicationInfoManager, final EurekaClientConfig config, AbstractDiscoveryClientOptionalArgs args) { this(applicationInfoManager, config, args, ResolverUtils::randomize); } @@ -493,40 +468,24 @@ public synchronized BackupRegistry get() { initTimestampMs, initRegistrySize); } + @SuppressWarnings({ "rawtypes", "unchecked" }) private void scheduleServerEndpointTask(EurekaTransport eurekaTransport, AbstractDiscoveryClientOptionalArgs args) { + if (args == null) { + throw new IllegalArgumentException("args can not be null"); + } - Collection additionalFilters = args == null - ? Collections.emptyList() - : args.additionalFilters; + Collection additionalFilters = args.additionalFilters; - EurekaJerseyClient providedJerseyClient = args == null - ? null - : args.eurekaJerseyClient; - - TransportClientFactories argsTransportClientFactories = null; - if (args != null && args.getTransportClientFactories() != null) { - argsTransportClientFactories = args.getTransportClientFactories(); - } - // Ignore the raw types warnings since the client filter interface changed between jersey 1/2 - @SuppressWarnings("rawtypes") - TransportClientFactories transportClientFactories = argsTransportClientFactories == null - ? new Jersey1TransportClientFactories() - : argsTransportClientFactories; + TransportClientFactories transportClientFactories = args.getTransportClientFactories(); - Optional sslContext = args == null - ? Optional.empty() - : args.getSSLContext(); - Optional hostnameVerifier = args == null - ? Optional.empty() - : args.getHostnameVerifier(); + Optional sslContext = args.getSSLContext(); + Optional hostnameVerifier = args.getHostnameVerifier(); // If the transport factory was not supplied with args, assume they are using jersey 1 for passivity - eurekaTransport.transportClientFactory = providedJerseyClient == null - ? transportClientFactories.newTransportClientFactory(clientConfig, additionalFilters, applicationInfoManager.getInfo(), sslContext, hostnameVerifier) - : transportClientFactories.newTransportClientFactory(additionalFilters, providedJerseyClient); + eurekaTransport.transportClientFactory = transportClientFactories.newTransportClientFactory(clientConfig, additionalFilters, applicationInfoManager.getInfo(), sslContext, hostnameVerifier); ApplicationsResolver.ApplicationsSource applicationsSource = new ApplicationsResolver.ApplicationsSource() { @Override diff --git a/eureka-client/src/main/java/com/netflix/discovery/DiscoveryEvent.java b/eureka-client-core/src/main/java/com/netflix/discovery/DiscoveryEvent.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/DiscoveryEvent.java rename to eureka-client-core/src/main/java/com/netflix/discovery/DiscoveryEvent.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/DiscoveryManager.java b/eureka-client-core/src/main/java/com/netflix/discovery/DiscoveryManager.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/DiscoveryManager.java rename to eureka-client-core/src/main/java/com/netflix/discovery/DiscoveryManager.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/EurekaClient.java b/eureka-client-core/src/main/java/com/netflix/discovery/EurekaClient.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/EurekaClient.java rename to eureka-client-core/src/main/java/com/netflix/discovery/EurekaClient.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/EurekaClientConfig.java b/eureka-client-core/src/main/java/com/netflix/discovery/EurekaClientConfig.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/EurekaClientConfig.java rename to eureka-client-core/src/main/java/com/netflix/discovery/EurekaClientConfig.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/EurekaClientNames.java b/eureka-client-core/src/main/java/com/netflix/discovery/EurekaClientNames.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/EurekaClientNames.java rename to eureka-client-core/src/main/java/com/netflix/discovery/EurekaClientNames.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/EurekaEvent.java b/eureka-client-core/src/main/java/com/netflix/discovery/EurekaEvent.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/EurekaEvent.java rename to eureka-client-core/src/main/java/com/netflix/discovery/EurekaEvent.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/EurekaEventListener.java b/eureka-client-core/src/main/java/com/netflix/discovery/EurekaEventListener.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/EurekaEventListener.java rename to eureka-client-core/src/main/java/com/netflix/discovery/EurekaEventListener.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/EurekaNamespace.java b/eureka-client-core/src/main/java/com/netflix/discovery/EurekaNamespace.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/EurekaNamespace.java rename to eureka-client-core/src/main/java/com/netflix/discovery/EurekaNamespace.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/EurekaUpStatusResolver.java b/eureka-client-core/src/main/java/com/netflix/discovery/EurekaUpStatusResolver.java similarity index 98% rename from eureka-client/src/main/java/com/netflix/discovery/EurekaUpStatusResolver.java rename to eureka-client-core/src/main/java/com/netflix/discovery/EurekaUpStatusResolver.java index 067dfca95..9375187c1 100644 --- a/eureka-client/src/main/java/com/netflix/discovery/EurekaUpStatusResolver.java +++ b/eureka-client-core/src/main/java/com/netflix/discovery/EurekaUpStatusResolver.java @@ -2,7 +2,7 @@ import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; -import javax.inject.Singleton; +import com.google.inject.Singleton; import java.util.concurrent.atomic.AtomicLong; import com.google.inject.Inject; diff --git a/eureka-client/src/main/java/com/netflix/discovery/InstanceInfoReplicator.java b/eureka-client-core/src/main/java/com/netflix/discovery/InstanceInfoReplicator.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/InstanceInfoReplicator.java rename to eureka-client-core/src/main/java/com/netflix/discovery/InstanceInfoReplicator.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/InstanceRegionChecker.java b/eureka-client-core/src/main/java/com/netflix/discovery/InstanceRegionChecker.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/InstanceRegionChecker.java rename to eureka-client-core/src/main/java/com/netflix/discovery/InstanceRegionChecker.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/InternalEurekaStatusModule.java b/eureka-client-core/src/main/java/com/netflix/discovery/InternalEurekaStatusModule.java similarity index 96% rename from eureka-client/src/main/java/com/netflix/discovery/InternalEurekaStatusModule.java rename to eureka-client-core/src/main/java/com/netflix/discovery/InternalEurekaStatusModule.java index 477959fae..f46cef3a6 100644 --- a/eureka-client/src/main/java/com/netflix/discovery/InternalEurekaStatusModule.java +++ b/eureka-client-core/src/main/java/com/netflix/discovery/InternalEurekaStatusModule.java @@ -1,8 +1,8 @@ package com.netflix.discovery; -import javax.inject.Inject; +import com.google.inject.Inject; import javax.inject.Provider; -import javax.inject.Singleton; +import com.google.inject.Singleton; import com.google.common.base.Supplier; import com.google.inject.AbstractModule; diff --git a/eureka-client/src/main/java/com/netflix/discovery/NotImplementedRegistryImpl.java b/eureka-client-core/src/main/java/com/netflix/discovery/NotImplementedRegistryImpl.java similarity index 91% rename from eureka-client/src/main/java/com/netflix/discovery/NotImplementedRegistryImpl.java rename to eureka-client-core/src/main/java/com/netflix/discovery/NotImplementedRegistryImpl.java index ee051adf7..85520d0f7 100644 --- a/eureka-client/src/main/java/com/netflix/discovery/NotImplementedRegistryImpl.java +++ b/eureka-client-core/src/main/java/com/netflix/discovery/NotImplementedRegistryImpl.java @@ -1,6 +1,6 @@ package com.netflix.discovery; -import javax.inject.Singleton; +import com.google.inject.Singleton; import com.netflix.discovery.shared.Applications; diff --git a/eureka-client/src/main/java/com/netflix/discovery/PreRegistrationHandler.java b/eureka-client-core/src/main/java/com/netflix/discovery/PreRegistrationHandler.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/PreRegistrationHandler.java rename to eureka-client-core/src/main/java/com/netflix/discovery/PreRegistrationHandler.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/PropertyBasedAzToRegionMapper.java b/eureka-client-core/src/main/java/com/netflix/discovery/PropertyBasedAzToRegionMapper.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/PropertyBasedAzToRegionMapper.java rename to eureka-client-core/src/main/java/com/netflix/discovery/PropertyBasedAzToRegionMapper.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/PropertyBasedClientConfigConstants.java b/eureka-client-core/src/main/java/com/netflix/discovery/PropertyBasedClientConfigConstants.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/PropertyBasedClientConfigConstants.java rename to eureka-client-core/src/main/java/com/netflix/discovery/PropertyBasedClientConfigConstants.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/StatusChangeEvent.java b/eureka-client-core/src/main/java/com/netflix/discovery/StatusChangeEvent.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/StatusChangeEvent.java rename to eureka-client-core/src/main/java/com/netflix/discovery/StatusChangeEvent.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/TimedSupervisorTask.java b/eureka-client-core/src/main/java/com/netflix/discovery/TimedSupervisorTask.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/TimedSupervisorTask.java rename to eureka-client-core/src/main/java/com/netflix/discovery/TimedSupervisorTask.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/converters/Auto.java b/eureka-client-core/src/main/java/com/netflix/discovery/converters/Auto.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/converters/Auto.java rename to eureka-client-core/src/main/java/com/netflix/discovery/converters/Auto.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/converters/Converters.java b/eureka-client-core/src/main/java/com/netflix/discovery/converters/Converters.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/converters/Converters.java rename to eureka-client-core/src/main/java/com/netflix/discovery/converters/Converters.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/converters/EntityBodyConverter.java b/eureka-client-core/src/main/java/com/netflix/discovery/converters/EntityBodyConverter.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/converters/EntityBodyConverter.java rename to eureka-client-core/src/main/java/com/netflix/discovery/converters/EntityBodyConverter.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/converters/EnumLookup.java b/eureka-client-core/src/main/java/com/netflix/discovery/converters/EnumLookup.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/converters/EnumLookup.java rename to eureka-client-core/src/main/java/com/netflix/discovery/converters/EnumLookup.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/converters/EurekaJacksonCodec.java b/eureka-client-core/src/main/java/com/netflix/discovery/converters/EurekaJacksonCodec.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/converters/EurekaJacksonCodec.java rename to eureka-client-core/src/main/java/com/netflix/discovery/converters/EurekaJacksonCodec.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/converters/JsonXStream.java b/eureka-client-core/src/main/java/com/netflix/discovery/converters/JsonXStream.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/converters/JsonXStream.java rename to eureka-client-core/src/main/java/com/netflix/discovery/converters/JsonXStream.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/converters/KeyFormatter.java b/eureka-client-core/src/main/java/com/netflix/discovery/converters/KeyFormatter.java similarity index 95% rename from eureka-client/src/main/java/com/netflix/discovery/converters/KeyFormatter.java rename to eureka-client-core/src/main/java/com/netflix/discovery/converters/KeyFormatter.java index 04dcd1678..f2b8c1a6d 100644 --- a/eureka-client/src/main/java/com/netflix/discovery/converters/KeyFormatter.java +++ b/eureka-client-core/src/main/java/com/netflix/discovery/converters/KeyFormatter.java @@ -1,7 +1,7 @@ package com.netflix.discovery.converters; -import javax.inject.Inject; -import javax.inject.Singleton; +import com.google.inject.Inject; +import com.google.inject.Singleton; import com.netflix.discovery.EurekaClientConfig; diff --git a/eureka-client/src/main/java/com/netflix/discovery/converters/XmlXStream.java b/eureka-client-core/src/main/java/com/netflix/discovery/converters/XmlXStream.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/converters/XmlXStream.java rename to eureka-client-core/src/main/java/com/netflix/discovery/converters/XmlXStream.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/converters/jackson/AbstractEurekaJacksonCodec.java b/eureka-client-core/src/main/java/com/netflix/discovery/converters/jackson/AbstractEurekaJacksonCodec.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/converters/jackson/AbstractEurekaJacksonCodec.java rename to eureka-client-core/src/main/java/com/netflix/discovery/converters/jackson/AbstractEurekaJacksonCodec.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/converters/jackson/DataCenterTypeInfoResolver.java b/eureka-client-core/src/main/java/com/netflix/discovery/converters/jackson/DataCenterTypeInfoResolver.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/converters/jackson/DataCenterTypeInfoResolver.java rename to eureka-client-core/src/main/java/com/netflix/discovery/converters/jackson/DataCenterTypeInfoResolver.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/converters/jackson/EurekaJacksonJsonModifiers.java b/eureka-client-core/src/main/java/com/netflix/discovery/converters/jackson/EurekaJacksonJsonModifiers.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/converters/jackson/EurekaJacksonJsonModifiers.java rename to eureka-client-core/src/main/java/com/netflix/discovery/converters/jackson/EurekaJacksonJsonModifiers.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/converters/jackson/EurekaJacksonXmlModifiers.java b/eureka-client-core/src/main/java/com/netflix/discovery/converters/jackson/EurekaJacksonXmlModifiers.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/converters/jackson/EurekaJacksonXmlModifiers.java rename to eureka-client-core/src/main/java/com/netflix/discovery/converters/jackson/EurekaJacksonXmlModifiers.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/converters/jackson/EurekaJsonJacksonCodec.java b/eureka-client-core/src/main/java/com/netflix/discovery/converters/jackson/EurekaJsonJacksonCodec.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/converters/jackson/EurekaJsonJacksonCodec.java rename to eureka-client-core/src/main/java/com/netflix/discovery/converters/jackson/EurekaJsonJacksonCodec.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/converters/jackson/EurekaXmlJacksonCodec.java b/eureka-client-core/src/main/java/com/netflix/discovery/converters/jackson/EurekaXmlJacksonCodec.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/converters/jackson/EurekaXmlJacksonCodec.java rename to eureka-client-core/src/main/java/com/netflix/discovery/converters/jackson/EurekaXmlJacksonCodec.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/converters/jackson/builder/ApplicationsJacksonBuilder.java b/eureka-client-core/src/main/java/com/netflix/discovery/converters/jackson/builder/ApplicationsJacksonBuilder.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/converters/jackson/builder/ApplicationsJacksonBuilder.java rename to eureka-client-core/src/main/java/com/netflix/discovery/converters/jackson/builder/ApplicationsJacksonBuilder.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/converters/jackson/builder/ApplicationsXmlJacksonBuilder.java b/eureka-client-core/src/main/java/com/netflix/discovery/converters/jackson/builder/ApplicationsXmlJacksonBuilder.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/converters/jackson/builder/ApplicationsXmlJacksonBuilder.java rename to eureka-client-core/src/main/java/com/netflix/discovery/converters/jackson/builder/ApplicationsXmlJacksonBuilder.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/converters/jackson/builder/StringInterningAmazonInfoBuilder.java b/eureka-client-core/src/main/java/com/netflix/discovery/converters/jackson/builder/StringInterningAmazonInfoBuilder.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/converters/jackson/builder/StringInterningAmazonInfoBuilder.java rename to eureka-client-core/src/main/java/com/netflix/discovery/converters/jackson/builder/StringInterningAmazonInfoBuilder.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/converters/jackson/mixin/ApplicationXmlMixIn.java b/eureka-client-core/src/main/java/com/netflix/discovery/converters/jackson/mixin/ApplicationXmlMixIn.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/converters/jackson/mixin/ApplicationXmlMixIn.java rename to eureka-client-core/src/main/java/com/netflix/discovery/converters/jackson/mixin/ApplicationXmlMixIn.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/converters/jackson/mixin/ApplicationsJsonMixIn.java b/eureka-client-core/src/main/java/com/netflix/discovery/converters/jackson/mixin/ApplicationsJsonMixIn.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/converters/jackson/mixin/ApplicationsJsonMixIn.java rename to eureka-client-core/src/main/java/com/netflix/discovery/converters/jackson/mixin/ApplicationsJsonMixIn.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/converters/jackson/mixin/ApplicationsXmlMixIn.java b/eureka-client-core/src/main/java/com/netflix/discovery/converters/jackson/mixin/ApplicationsXmlMixIn.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/converters/jackson/mixin/ApplicationsXmlMixIn.java rename to eureka-client-core/src/main/java/com/netflix/discovery/converters/jackson/mixin/ApplicationsXmlMixIn.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/converters/jackson/mixin/DataCenterInfoXmlMixIn.java b/eureka-client-core/src/main/java/com/netflix/discovery/converters/jackson/mixin/DataCenterInfoXmlMixIn.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/converters/jackson/mixin/DataCenterInfoXmlMixIn.java rename to eureka-client-core/src/main/java/com/netflix/discovery/converters/jackson/mixin/DataCenterInfoXmlMixIn.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/converters/jackson/mixin/InstanceInfoJsonMixIn.java b/eureka-client-core/src/main/java/com/netflix/discovery/converters/jackson/mixin/InstanceInfoJsonMixIn.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/converters/jackson/mixin/InstanceInfoJsonMixIn.java rename to eureka-client-core/src/main/java/com/netflix/discovery/converters/jackson/mixin/InstanceInfoJsonMixIn.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/converters/jackson/mixin/MiniInstanceInfoMixIn.java b/eureka-client-core/src/main/java/com/netflix/discovery/converters/jackson/mixin/MiniInstanceInfoMixIn.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/converters/jackson/mixin/MiniInstanceInfoMixIn.java rename to eureka-client-core/src/main/java/com/netflix/discovery/converters/jackson/mixin/MiniInstanceInfoMixIn.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/converters/jackson/mixin/PortWrapperXmlMixIn.java b/eureka-client-core/src/main/java/com/netflix/discovery/converters/jackson/mixin/PortWrapperXmlMixIn.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/converters/jackson/mixin/PortWrapperXmlMixIn.java rename to eureka-client-core/src/main/java/com/netflix/discovery/converters/jackson/mixin/PortWrapperXmlMixIn.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/converters/jackson/serializer/ApplicationXmlDeserializer.java b/eureka-client-core/src/main/java/com/netflix/discovery/converters/jackson/serializer/ApplicationXmlDeserializer.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/converters/jackson/serializer/ApplicationXmlDeserializer.java rename to eureka-client-core/src/main/java/com/netflix/discovery/converters/jackson/serializer/ApplicationXmlDeserializer.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/converters/jackson/serializer/ApplicationsJsonBeanSerializer.java b/eureka-client-core/src/main/java/com/netflix/discovery/converters/jackson/serializer/ApplicationsJsonBeanSerializer.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/converters/jackson/serializer/ApplicationsJsonBeanSerializer.java rename to eureka-client-core/src/main/java/com/netflix/discovery/converters/jackson/serializer/ApplicationsJsonBeanSerializer.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/converters/jackson/serializer/ApplicationsXmlBeanSerializer.java b/eureka-client-core/src/main/java/com/netflix/discovery/converters/jackson/serializer/ApplicationsXmlBeanSerializer.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/converters/jackson/serializer/ApplicationsXmlBeanSerializer.java rename to eureka-client-core/src/main/java/com/netflix/discovery/converters/jackson/serializer/ApplicationsXmlBeanSerializer.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/converters/jackson/serializer/InstanceInfoJsonBeanSerializer.java b/eureka-client-core/src/main/java/com/netflix/discovery/converters/jackson/serializer/InstanceInfoJsonBeanSerializer.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/converters/jackson/serializer/InstanceInfoJsonBeanSerializer.java rename to eureka-client-core/src/main/java/com/netflix/discovery/converters/jackson/serializer/InstanceInfoJsonBeanSerializer.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/converters/jackson/serializer/InstanceInfoXmlBeanSerializer.java b/eureka-client-core/src/main/java/com/netflix/discovery/converters/jackson/serializer/InstanceInfoXmlBeanSerializer.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/converters/jackson/serializer/InstanceInfoXmlBeanSerializer.java rename to eureka-client-core/src/main/java/com/netflix/discovery/converters/jackson/serializer/InstanceInfoXmlBeanSerializer.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/converters/jackson/serializer/PortWrapperXmlDeserializer.java b/eureka-client-core/src/main/java/com/netflix/discovery/converters/jackson/serializer/PortWrapperXmlDeserializer.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/converters/jackson/serializer/PortWrapperXmlDeserializer.java rename to eureka-client-core/src/main/java/com/netflix/discovery/converters/jackson/serializer/PortWrapperXmlDeserializer.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/converters/wrappers/CodecWrapper.java b/eureka-client-core/src/main/java/com/netflix/discovery/converters/wrappers/CodecWrapper.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/converters/wrappers/CodecWrapper.java rename to eureka-client-core/src/main/java/com/netflix/discovery/converters/wrappers/CodecWrapper.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/converters/wrappers/CodecWrapperBase.java b/eureka-client-core/src/main/java/com/netflix/discovery/converters/wrappers/CodecWrapperBase.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/converters/wrappers/CodecWrapperBase.java rename to eureka-client-core/src/main/java/com/netflix/discovery/converters/wrappers/CodecWrapperBase.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/converters/wrappers/CodecWrappers.java b/eureka-client-core/src/main/java/com/netflix/discovery/converters/wrappers/CodecWrappers.java similarity index 97% rename from eureka-client/src/main/java/com/netflix/discovery/converters/wrappers/CodecWrappers.java rename to eureka-client-core/src/main/java/com/netflix/discovery/converters/wrappers/CodecWrappers.java index 5fbc9c229..a345a12a9 100644 --- a/eureka-client/src/main/java/com/netflix/discovery/converters/wrappers/CodecWrappers.java +++ b/eureka-client-core/src/main/java/com/netflix/discovery/converters/wrappers/CodecWrappers.java @@ -14,7 +14,6 @@ import com.netflix.discovery.converters.XmlXStream; import com.netflix.discovery.converters.jackson.EurekaJsonJacksonCodec; import com.netflix.discovery.converters.jackson.EurekaXmlJacksonCodec; -import com.netflix.discovery.shared.transport.jersey.EurekaJerseyClientImpl; /** * This is just a helper class during transition when multiple codecs are supported. One day this should all go away @@ -22,9 +21,9 @@ * * For adding custom codecs to Discovery, prefer creating a custom EurekaJerseyClient to added to DiscoveryClient * either completely independently or via - * {@link EurekaJerseyClientImpl.EurekaJerseyClientBuilder#withDecoderWrapper(DecoderWrapper)} + * {@link com.netflix.discovery.shared.transport.jersey.EurekaJerseyClientImpl.EurekaJerseyClientBuilder#withDecoderWrapper(DecoderWrapper)} * and - * {@link EurekaJerseyClientImpl.EurekaJerseyClientBuilder#withEncoderWrapper(EncoderWrapper)} + * {@link com.netflix.discovery.shared.transport.jersey.EurekaJerseyClientImpl.EurekaJerseyClientBuilder#withEncoderWrapper(EncoderWrapper)} * * @author David Liu */ diff --git a/eureka-client/src/main/java/com/netflix/discovery/converters/wrappers/DecoderWrapper.java b/eureka-client-core/src/main/java/com/netflix/discovery/converters/wrappers/DecoderWrapper.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/converters/wrappers/DecoderWrapper.java rename to eureka-client-core/src/main/java/com/netflix/discovery/converters/wrappers/DecoderWrapper.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/converters/wrappers/EncoderWrapper.java b/eureka-client-core/src/main/java/com/netflix/discovery/converters/wrappers/EncoderWrapper.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/converters/wrappers/EncoderWrapper.java rename to eureka-client-core/src/main/java/com/netflix/discovery/converters/wrappers/EncoderWrapper.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/endpoint/DnsResolver.java b/eureka-client-core/src/main/java/com/netflix/discovery/endpoint/DnsResolver.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/endpoint/DnsResolver.java rename to eureka-client-core/src/main/java/com/netflix/discovery/endpoint/DnsResolver.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/endpoint/EndpointUtils.java b/eureka-client-core/src/main/java/com/netflix/discovery/endpoint/EndpointUtils.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/endpoint/EndpointUtils.java rename to eureka-client-core/src/main/java/com/netflix/discovery/endpoint/EndpointUtils.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/internal/util/AmazonInfoUtils.java b/eureka-client-core/src/main/java/com/netflix/discovery/internal/util/AmazonInfoUtils.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/internal/util/AmazonInfoUtils.java rename to eureka-client-core/src/main/java/com/netflix/discovery/internal/util/AmazonInfoUtils.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/internal/util/Archaius1Utils.java b/eureka-client-core/src/main/java/com/netflix/discovery/internal/util/Archaius1Utils.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/internal/util/Archaius1Utils.java rename to eureka-client-core/src/main/java/com/netflix/discovery/internal/util/Archaius1Utils.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/provider/DiscoveryJerseyProvider.java b/eureka-client-core/src/main/java/com/netflix/discovery/provider/DiscoveryJerseyProvider.java similarity index 97% rename from eureka-client/src/main/java/com/netflix/discovery/provider/DiscoveryJerseyProvider.java rename to eureka-client-core/src/main/java/com/netflix/discovery/provider/DiscoveryJerseyProvider.java index baff3898b..6b30b3597 100644 --- a/eureka-client/src/main/java/com/netflix/discovery/provider/DiscoveryJerseyProvider.java +++ b/eureka-client-core/src/main/java/com/netflix/discovery/provider/DiscoveryJerseyProvider.java @@ -1,211 +1,211 @@ -/* - * Copyright 2012 Netflix, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.netflix.discovery.provider; - -import javax.ws.rs.Consumes; -import javax.ws.rs.Produces; -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.core.Response; -import javax.ws.rs.ext.MessageBodyReader; -import javax.ws.rs.ext.MessageBodyWriter; -import javax.ws.rs.ext.Provider; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.lang.annotation.Annotation; -import java.lang.reflect.Type; -import java.util.Map; - -import com.netflix.discovery.converters.wrappers.CodecWrappers; -import com.netflix.discovery.converters.wrappers.CodecWrappers.LegacyJacksonJson; -import com.netflix.discovery.converters.wrappers.DecoderWrapper; -import com.netflix.discovery.converters.wrappers.EncoderWrapper; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * A custom provider implementation for Jersey that dispatches to the - * implementation that serializes/deserializes objects sent to and from eureka - * server. - * - * @author Karthik Ranganathan - */ -@Provider -@Produces({"application/json", "application/xml"}) -@Consumes("*/*") -public class DiscoveryJerseyProvider implements MessageBodyWriter, MessageBodyReader { - private static final Logger LOGGER = LoggerFactory.getLogger(DiscoveryJerseyProvider.class); - - private final EncoderWrapper jsonEncoder; - private final DecoderWrapper jsonDecoder; - - // XML support is maintained for legacy/custom clients. These codecs are used only on the server side only, while - // Eureka client is using JSON only. - private final EncoderWrapper xmlEncoder; - private final DecoderWrapper xmlDecoder; - - public DiscoveryJerseyProvider() { - this(null, null); - } - - public DiscoveryJerseyProvider(EncoderWrapper jsonEncoder, DecoderWrapper jsonDecoder) { - this.jsonEncoder = jsonEncoder == null ? CodecWrappers.getEncoder(LegacyJacksonJson.class) : jsonEncoder; - this.jsonDecoder = jsonDecoder == null ? CodecWrappers.getDecoder(LegacyJacksonJson.class) : jsonDecoder; - LOGGER.info("Using JSON encoding codec {}", this.jsonEncoder.codecName()); - LOGGER.info("Using JSON decoding codec {}", this.jsonDecoder.codecName()); - - if (jsonEncoder instanceof CodecWrappers.JacksonJsonMini) { - throw new UnsupportedOperationException("Encoder: " + jsonEncoder.codecName() + "is not supported for the client"); - } - - this.xmlEncoder = CodecWrappers.getEncoder(CodecWrappers.XStreamXml.class); - this.xmlDecoder = CodecWrappers.getDecoder(CodecWrappers.XStreamXml.class); - - LOGGER.info("Using XML encoding codec {}", this.xmlEncoder.codecName()); - LOGGER.info("Using XML decoding codec {}", this.xmlDecoder.codecName()); - } - - @Override - public boolean isReadable(Class serializableClass, Type type, Annotation[] annotations, MediaType mediaType) { - return isSupportedMediaType(mediaType) && isSupportedCharset(mediaType) && isSupportedEntity(serializableClass); - } - - @Override - public Object readFrom(Class serializableClass, Type type, - Annotation[] annotations, MediaType mediaType, - MultivaluedMap headers, InputStream inputStream) throws IOException { - DecoderWrapper decoder; - if (MediaType.MEDIA_TYPE_WILDCARD.equals(mediaType.getSubtype())) { - decoder = xmlDecoder; - } else if ("json".equalsIgnoreCase(mediaType.getSubtype())) { - decoder = jsonDecoder; - } else { - decoder = xmlDecoder; // default - } - - try { - return decoder.decode(inputStream, serializableClass); - } catch (Throwable e) { - if (e instanceof Error) { // See issue: https://github.com/Netflix/eureka/issues/72 on why we catch Error here. - closeInputOnError(inputStream); - throw new WebApplicationException(e, createErrorReply(500, e, mediaType)); - } - LOGGER.debug("Cannot parse request body", e); - throw new WebApplicationException(e, createErrorReply(400, "cannot parse request body", mediaType)); - } - } - - @Override - public long getSize(Object serializableObject, Class serializableClass, Type type, Annotation[] annotations, MediaType mediaType) { - return -1; - } - - @Override - public boolean isWriteable(Class serializableClass, Type type, Annotation[] annotations, MediaType mediaType) { - return isSupportedMediaType(mediaType) && isSupportedEntity(serializableClass); - } - - @Override - public void writeTo(Object serializableObject, Class serializableClass, - Type type, Annotation[] annotations, MediaType mediaType, - MultivaluedMap headers, OutputStream outputStream) throws IOException, WebApplicationException { - EncoderWrapper encoder = "json".equalsIgnoreCase(mediaType.getSubtype()) ? jsonEncoder : xmlEncoder; - - // XML codec may not be available - if (encoder == null) { - throw new WebApplicationException(createErrorReply(400, "No codec available to serialize content type " + mediaType, mediaType)); - } - - encoder.encode(serializableObject, outputStream); - } - - private boolean isSupportedMediaType(MediaType mediaType) { - if (MediaType.APPLICATION_JSON_TYPE.isCompatible(mediaType)) { - return true; - } - if (MediaType.APPLICATION_XML_TYPE.isCompatible(mediaType)) { - return xmlDecoder != null; - } - return false; - } - - /** - * As content is cached, we expect both ends use UTF-8 always. If no content charset encoding is explicitly - * defined, UTF-8 is assumed as a default. - * As legacy clients may use ISO 8859-1 we accept it as well, although result may be unspecified if - * characters out of ASCII 0-127 range are used. - */ - private static boolean isSupportedCharset(MediaType mediaType) { - Map parameters = mediaType.getParameters(); - if (parameters == null || parameters.isEmpty()) { - return true; - } - String charset = parameters.get("charset"); - return charset == null - || "UTF-8".equalsIgnoreCase(charset) - || "ISO-8859-1".equalsIgnoreCase(charset); - } - - /** - * Checks for the {@link Serializer} annotation for the given class. - * - * @param entityType The class to be serialized/deserialized. - * @return true if the annotation is present, false otherwise. - */ - private static boolean isSupportedEntity(Class entityType) { - try { - Annotation annotation = entityType.getAnnotation(Serializer.class); - if (annotation != null) { - return true; - } - } catch (Throwable th) { - LOGGER.warn("Exception in checking for annotations", th); - } - return false; - } - - private static Response createErrorReply(int status, Throwable cause, MediaType mediaType) { - StringBuilder sb = new StringBuilder(cause.getClass().getName()); - if (cause.getMessage() != null) { - sb.append(": ").append(cause.getMessage()); - } - return createErrorReply(status, sb.toString(), mediaType); - } - - private static Response createErrorReply(int status, String errorMessage, MediaType mediaType) { - String message; - if (MediaType.APPLICATION_JSON_TYPE.equals(mediaType)) { - message = "{\"error\": \"" + errorMessage + "\"}"; - } else { - message = "" + errorMessage + ""; - } - return Response.status(status).entity(message).type(mediaType).build(); - } - - private static void closeInputOnError(InputStream inputStream) { - if (inputStream != null) { - LOGGER.error("Unexpected error occurred during de-serialization of discovery data, done connection cleanup"); - try { - inputStream.close(); - } catch (IOException e) { - LOGGER.debug("Cannot close input", e); - } - } - } -} +/* + * Copyright 2012 Netflix, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.netflix.discovery.provider; + +import javax.ws.rs.Consumes; +import javax.ws.rs.Produces; +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.MultivaluedMap; +import javax.ws.rs.core.Response; +import javax.ws.rs.ext.MessageBodyReader; +import javax.ws.rs.ext.MessageBodyWriter; +import javax.ws.rs.ext.Provider; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.lang.annotation.Annotation; +import java.lang.reflect.Type; +import java.util.Map; + +import com.netflix.discovery.converters.wrappers.CodecWrappers; +import com.netflix.discovery.converters.wrappers.CodecWrappers.LegacyJacksonJson; +import com.netflix.discovery.converters.wrappers.DecoderWrapper; +import com.netflix.discovery.converters.wrappers.EncoderWrapper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * A custom provider implementation for Jersey that dispatches to the + * implementation that serializes/deserializes objects sent to and from eureka + * server. + * + * @author Karthik Ranganathan + */ +@Provider +@Produces({"application/json", "application/xml"}) +@Consumes("*/*") +public class DiscoveryJerseyProvider implements MessageBodyWriter, MessageBodyReader { + private static final Logger LOGGER = LoggerFactory.getLogger(DiscoveryJerseyProvider.class); + + private final EncoderWrapper jsonEncoder; + private final DecoderWrapper jsonDecoder; + + // XML support is maintained for legacy/custom clients. These codecs are used only on the server side only, while + // Eureka client is using JSON only. + private final EncoderWrapper xmlEncoder; + private final DecoderWrapper xmlDecoder; + + public DiscoveryJerseyProvider() { + this(null, null); + } + + public DiscoveryJerseyProvider(EncoderWrapper jsonEncoder, DecoderWrapper jsonDecoder) { + this.jsonEncoder = jsonEncoder == null ? CodecWrappers.getEncoder(LegacyJacksonJson.class) : jsonEncoder; + this.jsonDecoder = jsonDecoder == null ? CodecWrappers.getDecoder(LegacyJacksonJson.class) : jsonDecoder; + LOGGER.info("Using JSON encoding codec {}", this.jsonEncoder.codecName()); + LOGGER.info("Using JSON decoding codec {}", this.jsonDecoder.codecName()); + + if (jsonEncoder instanceof CodecWrappers.JacksonJsonMini) { + throw new UnsupportedOperationException("Encoder: " + jsonEncoder.codecName() + "is not supported for the client"); + } + + this.xmlEncoder = CodecWrappers.getEncoder(CodecWrappers.XStreamXml.class); + this.xmlDecoder = CodecWrappers.getDecoder(CodecWrappers.XStreamXml.class); + + LOGGER.info("Using XML encoding codec {}", this.xmlEncoder.codecName()); + LOGGER.info("Using XML decoding codec {}", this.xmlDecoder.codecName()); + } + + @Override + public boolean isReadable(Class serializableClass, Type type, Annotation[] annotations, MediaType mediaType) { + return isSupportedMediaType(mediaType) && isSupportedCharset(mediaType) && isSupportedEntity(serializableClass); + } + + @Override + public Object readFrom(Class serializableClass, Type type, + Annotation[] annotations, MediaType mediaType, + MultivaluedMap headers, InputStream inputStream) throws IOException { + DecoderWrapper decoder; + if (MediaType.MEDIA_TYPE_WILDCARD.equals(mediaType.getSubtype())) { + decoder = xmlDecoder; + } else if ("json".equalsIgnoreCase(mediaType.getSubtype())) { + decoder = jsonDecoder; + } else { + decoder = xmlDecoder; // default + } + + try { + return decoder.decode(inputStream, serializableClass); + } catch (Throwable e) { + if (e instanceof Error) { // See issue: https://github.com/Netflix/eureka/issues/72 on why we catch Error here. + closeInputOnError(inputStream); + throw new WebApplicationException(e, createErrorReply(500, e, mediaType)); + } + LOGGER.debug("Cannot parse request body", e); + throw new WebApplicationException(e, createErrorReply(400, "cannot parse request body", mediaType)); + } + } + + @Override + public long getSize(Object serializableObject, Class serializableClass, Type type, Annotation[] annotations, MediaType mediaType) { + return -1; + } + + @Override + public boolean isWriteable(Class serializableClass, Type type, Annotation[] annotations, MediaType mediaType) { + return isSupportedMediaType(mediaType) && isSupportedEntity(serializableClass); + } + + @Override + public void writeTo(Object serializableObject, Class serializableClass, + Type type, Annotation[] annotations, MediaType mediaType, + MultivaluedMap headers, OutputStream outputStream) throws IOException, WebApplicationException { + EncoderWrapper encoder = "json".equalsIgnoreCase(mediaType.getSubtype()) ? jsonEncoder : xmlEncoder; + + // XML codec may not be available + if (encoder == null) { + throw new WebApplicationException(createErrorReply(400, "No codec available to serialize content type " + mediaType, mediaType)); + } + + encoder.encode(serializableObject, outputStream); + } + + private boolean isSupportedMediaType(MediaType mediaType) { + if (MediaType.APPLICATION_JSON_TYPE.isCompatible(mediaType)) { + return true; + } + if (MediaType.APPLICATION_XML_TYPE.isCompatible(mediaType)) { + return xmlDecoder != null; + } + return false; + } + + /** + * As content is cached, we expect both ends use UTF-8 always. If no content charset encoding is explicitly + * defined, UTF-8 is assumed as a default. + * As legacy clients may use ISO 8859-1 we accept it as well, although result may be unspecified if + * characters out of ASCII 0-127 range are used. + */ + private static boolean isSupportedCharset(MediaType mediaType) { + Map parameters = mediaType.getParameters(); + if (parameters == null || parameters.isEmpty()) { + return true; + } + String charset = parameters.get("charset"); + return charset == null + || "UTF-8".equalsIgnoreCase(charset) + || "ISO-8859-1".equalsIgnoreCase(charset); + } + + /** + * Checks for the {@link Serializer} annotation for the given class. + * + * @param entityType The class to be serialized/deserialized. + * @return true if the annotation is present, false otherwise. + */ + private static boolean isSupportedEntity(Class entityType) { + try { + Annotation annotation = entityType.getAnnotation(Serializer.class); + if (annotation != null) { + return true; + } + } catch (Throwable th) { + LOGGER.warn("Exception in checking for annotations", th); + } + return false; + } + + private static Response createErrorReply(int status, Throwable cause, MediaType mediaType) { + StringBuilder sb = new StringBuilder(cause.getClass().getName()); + if (cause.getMessage() != null) { + sb.append(": ").append(cause.getMessage()); + } + return createErrorReply(status, sb.toString(), mediaType); + } + + private static Response createErrorReply(int status, String errorMessage, MediaType mediaType) { + String message; + if (MediaType.APPLICATION_JSON_TYPE.equals(mediaType)) { + message = "{\"error\": \"" + errorMessage + "\"}"; + } else { + message = "" + errorMessage + ""; + } + return Response.status(status).entity(message).type(mediaType).build(); + } + + private static void closeInputOnError(InputStream inputStream) { + if (inputStream != null) { + LOGGER.error("Unexpected error occurred during de-serialization of discovery data, done connection cleanup"); + try { + inputStream.close(); + } catch (IOException e) { + LOGGER.debug("Cannot close input", e); + } + } + } +} diff --git a/eureka-client/src/main/java/com/netflix/discovery/provider/ISerializer.java b/eureka-client-core/src/main/java/com/netflix/discovery/provider/ISerializer.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/provider/ISerializer.java rename to eureka-client-core/src/main/java/com/netflix/discovery/provider/ISerializer.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/provider/Serializer.java b/eureka-client-core/src/main/java/com/netflix/discovery/provider/Serializer.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/provider/Serializer.java rename to eureka-client-core/src/main/java/com/netflix/discovery/provider/Serializer.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/providers/DefaultEurekaClientConfigProvider.java b/eureka-client-core/src/main/java/com/netflix/discovery/providers/DefaultEurekaClientConfigProvider.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/providers/DefaultEurekaClientConfigProvider.java rename to eureka-client-core/src/main/java/com/netflix/discovery/providers/DefaultEurekaClientConfigProvider.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/shared/Application.java b/eureka-client-core/src/main/java/com/netflix/discovery/shared/Application.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/shared/Application.java rename to eureka-client-core/src/main/java/com/netflix/discovery/shared/Application.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/shared/Applications.java b/eureka-client-core/src/main/java/com/netflix/discovery/shared/Applications.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/shared/Applications.java rename to eureka-client-core/src/main/java/com/netflix/discovery/shared/Applications.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/shared/LookupService.java b/eureka-client-core/src/main/java/com/netflix/discovery/shared/LookupService.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/shared/LookupService.java rename to eureka-client-core/src/main/java/com/netflix/discovery/shared/LookupService.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/shared/MonitoredConnectionManager.java b/eureka-client-core/src/main/java/com/netflix/discovery/shared/MonitoredConnectionManager.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/shared/MonitoredConnectionManager.java rename to eureka-client-core/src/main/java/com/netflix/discovery/shared/MonitoredConnectionManager.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/shared/NamedConnectionPool.java b/eureka-client-core/src/main/java/com/netflix/discovery/shared/NamedConnectionPool.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/shared/NamedConnectionPool.java rename to eureka-client-core/src/main/java/com/netflix/discovery/shared/NamedConnectionPool.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/shared/Pair.java b/eureka-client-core/src/main/java/com/netflix/discovery/shared/Pair.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/shared/Pair.java rename to eureka-client-core/src/main/java/com/netflix/discovery/shared/Pair.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/shared/dns/DnsService.java b/eureka-client-core/src/main/java/com/netflix/discovery/shared/dns/DnsService.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/shared/dns/DnsService.java rename to eureka-client-core/src/main/java/com/netflix/discovery/shared/dns/DnsService.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/shared/dns/DnsServiceImpl.java b/eureka-client-core/src/main/java/com/netflix/discovery/shared/dns/DnsServiceImpl.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/shared/dns/DnsServiceImpl.java rename to eureka-client-core/src/main/java/com/netflix/discovery/shared/dns/DnsServiceImpl.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/shared/resolver/AsyncResolver.java b/eureka-client-core/src/main/java/com/netflix/discovery/shared/resolver/AsyncResolver.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/shared/resolver/AsyncResolver.java rename to eureka-client-core/src/main/java/com/netflix/discovery/shared/resolver/AsyncResolver.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/shared/resolver/ClosableResolver.java b/eureka-client-core/src/main/java/com/netflix/discovery/shared/resolver/ClosableResolver.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/shared/resolver/ClosableResolver.java rename to eureka-client-core/src/main/java/com/netflix/discovery/shared/resolver/ClosableResolver.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/shared/resolver/ClusterResolver.java b/eureka-client-core/src/main/java/com/netflix/discovery/shared/resolver/ClusterResolver.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/shared/resolver/ClusterResolver.java rename to eureka-client-core/src/main/java/com/netflix/discovery/shared/resolver/ClusterResolver.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/shared/resolver/ClusterResolverException.java b/eureka-client-core/src/main/java/com/netflix/discovery/shared/resolver/ClusterResolverException.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/shared/resolver/ClusterResolverException.java rename to eureka-client-core/src/main/java/com/netflix/discovery/shared/resolver/ClusterResolverException.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/shared/resolver/ClusterResolverFactory.java b/eureka-client-core/src/main/java/com/netflix/discovery/shared/resolver/ClusterResolverFactory.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/shared/resolver/ClusterResolverFactory.java rename to eureka-client-core/src/main/java/com/netflix/discovery/shared/resolver/ClusterResolverFactory.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/shared/resolver/DefaultEndpoint.java b/eureka-client-core/src/main/java/com/netflix/discovery/shared/resolver/DefaultEndpoint.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/shared/resolver/DefaultEndpoint.java rename to eureka-client-core/src/main/java/com/netflix/discovery/shared/resolver/DefaultEndpoint.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/shared/resolver/DnsClusterResolver.java b/eureka-client-core/src/main/java/com/netflix/discovery/shared/resolver/DnsClusterResolver.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/shared/resolver/DnsClusterResolver.java rename to eureka-client-core/src/main/java/com/netflix/discovery/shared/resolver/DnsClusterResolver.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/shared/resolver/EndpointRandomizer.java b/eureka-client-core/src/main/java/com/netflix/discovery/shared/resolver/EndpointRandomizer.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/shared/resolver/EndpointRandomizer.java rename to eureka-client-core/src/main/java/com/netflix/discovery/shared/resolver/EndpointRandomizer.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/shared/resolver/EurekaEndpoint.java b/eureka-client-core/src/main/java/com/netflix/discovery/shared/resolver/EurekaEndpoint.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/shared/resolver/EurekaEndpoint.java rename to eureka-client-core/src/main/java/com/netflix/discovery/shared/resolver/EurekaEndpoint.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/shared/resolver/LegacyClusterResolver.java b/eureka-client-core/src/main/java/com/netflix/discovery/shared/resolver/LegacyClusterResolver.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/shared/resolver/LegacyClusterResolver.java rename to eureka-client-core/src/main/java/com/netflix/discovery/shared/resolver/LegacyClusterResolver.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/shared/resolver/README.md b/eureka-client-core/src/main/java/com/netflix/discovery/shared/resolver/README.md similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/shared/resolver/README.md rename to eureka-client-core/src/main/java/com/netflix/discovery/shared/resolver/README.md diff --git a/eureka-client/src/main/java/com/netflix/discovery/shared/resolver/ReloadingClusterResolver.java b/eureka-client-core/src/main/java/com/netflix/discovery/shared/resolver/ReloadingClusterResolver.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/shared/resolver/ReloadingClusterResolver.java rename to eureka-client-core/src/main/java/com/netflix/discovery/shared/resolver/ReloadingClusterResolver.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/shared/resolver/ResolverUtils.java b/eureka-client-core/src/main/java/com/netflix/discovery/shared/resolver/ResolverUtils.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/shared/resolver/ResolverUtils.java rename to eureka-client-core/src/main/java/com/netflix/discovery/shared/resolver/ResolverUtils.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/shared/resolver/StaticClusterResolver.java b/eureka-client-core/src/main/java/com/netflix/discovery/shared/resolver/StaticClusterResolver.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/shared/resolver/StaticClusterResolver.java rename to eureka-client-core/src/main/java/com/netflix/discovery/shared/resolver/StaticClusterResolver.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/shared/resolver/aws/ApplicationsResolver.java b/eureka-client-core/src/main/java/com/netflix/discovery/shared/resolver/aws/ApplicationsResolver.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/shared/resolver/aws/ApplicationsResolver.java rename to eureka-client-core/src/main/java/com/netflix/discovery/shared/resolver/aws/ApplicationsResolver.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/shared/resolver/aws/AwsEndpoint.java b/eureka-client-core/src/main/java/com/netflix/discovery/shared/resolver/aws/AwsEndpoint.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/shared/resolver/aws/AwsEndpoint.java rename to eureka-client-core/src/main/java/com/netflix/discovery/shared/resolver/aws/AwsEndpoint.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/shared/resolver/aws/ConfigClusterResolver.java b/eureka-client-core/src/main/java/com/netflix/discovery/shared/resolver/aws/ConfigClusterResolver.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/shared/resolver/aws/ConfigClusterResolver.java rename to eureka-client-core/src/main/java/com/netflix/discovery/shared/resolver/aws/ConfigClusterResolver.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/shared/resolver/aws/DnsTxtRecordClusterResolver.java b/eureka-client-core/src/main/java/com/netflix/discovery/shared/resolver/aws/DnsTxtRecordClusterResolver.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/shared/resolver/aws/DnsTxtRecordClusterResolver.java rename to eureka-client-core/src/main/java/com/netflix/discovery/shared/resolver/aws/DnsTxtRecordClusterResolver.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/shared/resolver/aws/EurekaHttpResolver.java b/eureka-client-core/src/main/java/com/netflix/discovery/shared/resolver/aws/EurekaHttpResolver.java similarity index 98% rename from eureka-client/src/main/java/com/netflix/discovery/shared/resolver/aws/EurekaHttpResolver.java rename to eureka-client-core/src/main/java/com/netflix/discovery/shared/resolver/aws/EurekaHttpResolver.java index 6425468e5..efb31702d 100644 --- a/eureka-client/src/main/java/com/netflix/discovery/shared/resolver/aws/EurekaHttpResolver.java +++ b/eureka-client-core/src/main/java/com/netflix/discovery/shared/resolver/aws/EurekaHttpResolver.java @@ -51,7 +51,7 @@ public EurekaHttpResolver(EurekaClientConfig clientConfig, ); } - /* visible for testing */ EurekaHttpResolver(EurekaClientConfig clientConfig, + public EurekaHttpResolver(EurekaClientConfig clientConfig, EurekaTransportConfig transportConfig, EurekaHttpClientFactory clientFactory, String vipAddress) { diff --git a/eureka-client/src/main/java/com/netflix/discovery/shared/resolver/aws/ZoneAffinityClusterResolver.java b/eureka-client-core/src/main/java/com/netflix/discovery/shared/resolver/aws/ZoneAffinityClusterResolver.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/shared/resolver/aws/ZoneAffinityClusterResolver.java rename to eureka-client-core/src/main/java/com/netflix/discovery/shared/resolver/aws/ZoneAffinityClusterResolver.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/shared/transport/DefaultEurekaTransportConfig.java b/eureka-client-core/src/main/java/com/netflix/discovery/shared/transport/DefaultEurekaTransportConfig.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/shared/transport/DefaultEurekaTransportConfig.java rename to eureka-client-core/src/main/java/com/netflix/discovery/shared/transport/DefaultEurekaTransportConfig.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/shared/transport/EurekaClientFactoryBuilder.java b/eureka-client-core/src/main/java/com/netflix/discovery/shared/transport/EurekaClientFactoryBuilder.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/shared/transport/EurekaClientFactoryBuilder.java rename to eureka-client-core/src/main/java/com/netflix/discovery/shared/transport/EurekaClientFactoryBuilder.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/shared/transport/EurekaHttpClient.java b/eureka-client-core/src/main/java/com/netflix/discovery/shared/transport/EurekaHttpClient.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/shared/transport/EurekaHttpClient.java rename to eureka-client-core/src/main/java/com/netflix/discovery/shared/transport/EurekaHttpClient.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/shared/transport/EurekaHttpClientFactory.java b/eureka-client-core/src/main/java/com/netflix/discovery/shared/transport/EurekaHttpClientFactory.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/shared/transport/EurekaHttpClientFactory.java rename to eureka-client-core/src/main/java/com/netflix/discovery/shared/transport/EurekaHttpClientFactory.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/shared/transport/EurekaHttpClients.java b/eureka-client-core/src/main/java/com/netflix/discovery/shared/transport/EurekaHttpClients.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/shared/transport/EurekaHttpClients.java rename to eureka-client-core/src/main/java/com/netflix/discovery/shared/transport/EurekaHttpClients.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/shared/transport/EurekaHttpResponse.java b/eureka-client-core/src/main/java/com/netflix/discovery/shared/transport/EurekaHttpResponse.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/shared/transport/EurekaHttpResponse.java rename to eureka-client-core/src/main/java/com/netflix/discovery/shared/transport/EurekaHttpResponse.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/shared/transport/EurekaTransportConfig.java b/eureka-client-core/src/main/java/com/netflix/discovery/shared/transport/EurekaTransportConfig.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/shared/transport/EurekaTransportConfig.java rename to eureka-client-core/src/main/java/com/netflix/discovery/shared/transport/EurekaTransportConfig.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/shared/transport/PropertyBasedTransportConfigConstants.java b/eureka-client-core/src/main/java/com/netflix/discovery/shared/transport/PropertyBasedTransportConfigConstants.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/shared/transport/PropertyBasedTransportConfigConstants.java rename to eureka-client-core/src/main/java/com/netflix/discovery/shared/transport/PropertyBasedTransportConfigConstants.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/shared/transport/README.md b/eureka-client-core/src/main/java/com/netflix/discovery/shared/transport/README.md similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/shared/transport/README.md rename to eureka-client-core/src/main/java/com/netflix/discovery/shared/transport/README.md diff --git a/eureka-client/src/main/java/com/netflix/discovery/shared/transport/TransportClientFactory.java b/eureka-client-core/src/main/java/com/netflix/discovery/shared/transport/TransportClientFactory.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/shared/transport/TransportClientFactory.java rename to eureka-client-core/src/main/java/com/netflix/discovery/shared/transport/TransportClientFactory.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/shared/transport/TransportException.java b/eureka-client-core/src/main/java/com/netflix/discovery/shared/transport/TransportException.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/shared/transport/TransportException.java rename to eureka-client-core/src/main/java/com/netflix/discovery/shared/transport/TransportException.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/shared/transport/TransportUtils.java b/eureka-client-core/src/main/java/com/netflix/discovery/shared/transport/TransportUtils.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/shared/transport/TransportUtils.java rename to eureka-client-core/src/main/java/com/netflix/discovery/shared/transport/TransportUtils.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/shared/transport/decorator/EurekaHttpClientDecorator.java b/eureka-client-core/src/main/java/com/netflix/discovery/shared/transport/decorator/EurekaHttpClientDecorator.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/shared/transport/decorator/EurekaHttpClientDecorator.java rename to eureka-client-core/src/main/java/com/netflix/discovery/shared/transport/decorator/EurekaHttpClientDecorator.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/shared/transport/decorator/MetricsCollectingEurekaHttpClient.java b/eureka-client-core/src/main/java/com/netflix/discovery/shared/transport/decorator/MetricsCollectingEurekaHttpClient.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/shared/transport/decorator/MetricsCollectingEurekaHttpClient.java rename to eureka-client-core/src/main/java/com/netflix/discovery/shared/transport/decorator/MetricsCollectingEurekaHttpClient.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/shared/transport/decorator/RedirectingEurekaHttpClient.java b/eureka-client-core/src/main/java/com/netflix/discovery/shared/transport/decorator/RedirectingEurekaHttpClient.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/shared/transport/decorator/RedirectingEurekaHttpClient.java rename to eureka-client-core/src/main/java/com/netflix/discovery/shared/transport/decorator/RedirectingEurekaHttpClient.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/shared/transport/decorator/RetryableEurekaHttpClient.java b/eureka-client-core/src/main/java/com/netflix/discovery/shared/transport/decorator/RetryableEurekaHttpClient.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/shared/transport/decorator/RetryableEurekaHttpClient.java rename to eureka-client-core/src/main/java/com/netflix/discovery/shared/transport/decorator/RetryableEurekaHttpClient.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/shared/transport/decorator/ServerStatusEvaluator.java b/eureka-client-core/src/main/java/com/netflix/discovery/shared/transport/decorator/ServerStatusEvaluator.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/shared/transport/decorator/ServerStatusEvaluator.java rename to eureka-client-core/src/main/java/com/netflix/discovery/shared/transport/decorator/ServerStatusEvaluator.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/shared/transport/decorator/ServerStatusEvaluators.java b/eureka-client-core/src/main/java/com/netflix/discovery/shared/transport/decorator/ServerStatusEvaluators.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/shared/transport/decorator/ServerStatusEvaluators.java rename to eureka-client-core/src/main/java/com/netflix/discovery/shared/transport/decorator/ServerStatusEvaluators.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/shared/transport/decorator/SessionedEurekaHttpClient.java b/eureka-client-core/src/main/java/com/netflix/discovery/shared/transport/decorator/SessionedEurekaHttpClient.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/shared/transport/decorator/SessionedEurekaHttpClient.java rename to eureka-client-core/src/main/java/com/netflix/discovery/shared/transport/decorator/SessionedEurekaHttpClient.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/shared/transport/jersey/TransportClientFactories.java b/eureka-client-core/src/main/java/com/netflix/discovery/shared/transport/jersey/TransportClientFactories.java similarity index 81% rename from eureka-client/src/main/java/com/netflix/discovery/shared/transport/jersey/TransportClientFactories.java rename to eureka-client-core/src/main/java/com/netflix/discovery/shared/transport/jersey/TransportClientFactories.java index 6fc122555..9a73b7d2e 100644 --- a/eureka-client/src/main/java/com/netflix/discovery/shared/transport/jersey/TransportClientFactories.java +++ b/eureka-client-core/src/main/java/com/netflix/discovery/shared/transport/jersey/TransportClientFactories.java @@ -11,10 +11,6 @@ import com.netflix.discovery.shared.transport.TransportClientFactory; public interface TransportClientFactories { - - @Deprecated - public TransportClientFactory newTransportClientFactory(final Collection additionalFilters, - final EurekaJerseyClient providedJerseyClient); public TransportClientFactory newTransportClientFactory(final EurekaClientConfig clientConfig, final Collection additionalFilters, diff --git a/eureka-client/src/main/java/com/netflix/discovery/util/DeserializerStringCache.java b/eureka-client-core/src/main/java/com/netflix/discovery/util/DeserializerStringCache.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/util/DeserializerStringCache.java rename to eureka-client-core/src/main/java/com/netflix/discovery/util/DeserializerStringCache.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/util/DiscoveryBuildInfo.java b/eureka-client-core/src/main/java/com/netflix/discovery/util/DiscoveryBuildInfo.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/util/DiscoveryBuildInfo.java rename to eureka-client-core/src/main/java/com/netflix/discovery/util/DiscoveryBuildInfo.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/util/EurekaEntityComparators.java b/eureka-client-core/src/main/java/com/netflix/discovery/util/EurekaEntityComparators.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/util/EurekaEntityComparators.java rename to eureka-client-core/src/main/java/com/netflix/discovery/util/EurekaEntityComparators.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/util/EurekaEntityFunctions.java b/eureka-client-core/src/main/java/com/netflix/discovery/util/EurekaEntityFunctions.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/util/EurekaEntityFunctions.java rename to eureka-client-core/src/main/java/com/netflix/discovery/util/EurekaEntityFunctions.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/util/EurekaEntityTransformers.java b/eureka-client-core/src/main/java/com/netflix/discovery/util/EurekaEntityTransformers.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/util/EurekaEntityTransformers.java rename to eureka-client-core/src/main/java/com/netflix/discovery/util/EurekaEntityTransformers.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/util/EurekaUtils.java b/eureka-client-core/src/main/java/com/netflix/discovery/util/EurekaUtils.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/util/EurekaUtils.java rename to eureka-client-core/src/main/java/com/netflix/discovery/util/EurekaUtils.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/util/ExceptionsMetric.java b/eureka-client-core/src/main/java/com/netflix/discovery/util/ExceptionsMetric.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/util/ExceptionsMetric.java rename to eureka-client-core/src/main/java/com/netflix/discovery/util/ExceptionsMetric.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/util/RateLimiter.java b/eureka-client-core/src/main/java/com/netflix/discovery/util/RateLimiter.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/util/RateLimiter.java rename to eureka-client-core/src/main/java/com/netflix/discovery/util/RateLimiter.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/util/ServoUtil.java b/eureka-client-core/src/main/java/com/netflix/discovery/util/ServoUtil.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/util/ServoUtil.java rename to eureka-client-core/src/main/java/com/netflix/discovery/util/ServoUtil.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/util/StringCache.java b/eureka-client-core/src/main/java/com/netflix/discovery/util/StringCache.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/util/StringCache.java rename to eureka-client-core/src/main/java/com/netflix/discovery/util/StringCache.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/util/StringUtil.java b/eureka-client-core/src/main/java/com/netflix/discovery/util/StringUtil.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/util/StringUtil.java rename to eureka-client-core/src/main/java/com/netflix/discovery/util/StringUtil.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/util/SystemUtil.java b/eureka-client-core/src/main/java/com/netflix/discovery/util/SystemUtil.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/util/SystemUtil.java rename to eureka-client-core/src/main/java/com/netflix/discovery/util/SystemUtil.java diff --git a/eureka-client/src/main/java/com/netflix/discovery/util/ThresholdLevelsMetric.java b/eureka-client-core/src/main/java/com/netflix/discovery/util/ThresholdLevelsMetric.java similarity index 100% rename from eureka-client/src/main/java/com/netflix/discovery/util/ThresholdLevelsMetric.java rename to eureka-client-core/src/main/java/com/netflix/discovery/util/ThresholdLevelsMetric.java diff --git a/eureka-client/src/test/java/com/netflix/appinfo/AmazonInfoTest.java b/eureka-client-core/src/test/java/com/netflix/appinfo/AmazonInfoTest.java similarity index 100% rename from eureka-client/src/test/java/com/netflix/appinfo/AmazonInfoTest.java rename to eureka-client-core/src/test/java/com/netflix/appinfo/AmazonInfoTest.java diff --git a/eureka-client/src/test/java/com/netflix/appinfo/ApplicationInfoManagerTest.java b/eureka-client-core/src/test/java/com/netflix/appinfo/ApplicationInfoManagerTest.java similarity index 100% rename from eureka-client/src/test/java/com/netflix/appinfo/ApplicationInfoManagerTest.java rename to eureka-client-core/src/test/java/com/netflix/appinfo/ApplicationInfoManagerTest.java diff --git a/eureka-client/src/test/java/com/netflix/appinfo/CloudInstanceConfigTest.java b/eureka-client-core/src/test/java/com/netflix/appinfo/CloudInstanceConfigTest.java similarity index 100% rename from eureka-client/src/test/java/com/netflix/appinfo/CloudInstanceConfigTest.java rename to eureka-client-core/src/test/java/com/netflix/appinfo/CloudInstanceConfigTest.java diff --git a/eureka-client/src/test/java/com/netflix/appinfo/InstanceInfoTest.java b/eureka-client-core/src/test/java/com/netflix/appinfo/InstanceInfoTest.java similarity index 100% rename from eureka-client/src/test/java/com/netflix/appinfo/InstanceInfoTest.java rename to eureka-client-core/src/test/java/com/netflix/appinfo/InstanceInfoTest.java diff --git a/eureka-client/src/test/java/com/netflix/appinfo/RefreshableAmazonInfoProviderTest.java b/eureka-client-core/src/test/java/com/netflix/appinfo/RefreshableAmazonInfoProviderTest.java similarity index 100% rename from eureka-client/src/test/java/com/netflix/appinfo/RefreshableAmazonInfoProviderTest.java rename to eureka-client-core/src/test/java/com/netflix/appinfo/RefreshableAmazonInfoProviderTest.java diff --git a/eureka-client/src/test/java/com/netflix/discovery/AbstractDiscoveryClientTester.java b/eureka-client-core/src/test/java/com/netflix/discovery/AbstractDiscoveryClientTester.java similarity index 100% rename from eureka-client/src/test/java/com/netflix/discovery/AbstractDiscoveryClientTester.java rename to eureka-client-core/src/test/java/com/netflix/discovery/AbstractDiscoveryClientTester.java diff --git a/eureka-client/src/test/java/com/netflix/discovery/BackUpRegistryTest.java b/eureka-client-core/src/test/java/com/netflix/discovery/BackUpRegistryTest.java similarity index 100% rename from eureka-client/src/test/java/com/netflix/discovery/BackUpRegistryTest.java rename to eureka-client-core/src/test/java/com/netflix/discovery/BackUpRegistryTest.java diff --git a/eureka-client/src/test/java/com/netflix/discovery/BaseDiscoveryClientTester.java b/eureka-client-core/src/test/java/com/netflix/discovery/BaseDiscoveryClientTester.java similarity index 100% rename from eureka-client/src/test/java/com/netflix/discovery/BaseDiscoveryClientTester.java rename to eureka-client-core/src/test/java/com/netflix/discovery/BaseDiscoveryClientTester.java diff --git a/eureka-client/src/test/java/com/netflix/discovery/DiscoveryClientCloseJerseyThreadTest.java b/eureka-client-core/src/test/java/com/netflix/discovery/DiscoveryClientCloseJerseyThreadTest.java similarity index 100% rename from eureka-client/src/test/java/com/netflix/discovery/DiscoveryClientCloseJerseyThreadTest.java rename to eureka-client-core/src/test/java/com/netflix/discovery/DiscoveryClientCloseJerseyThreadTest.java diff --git a/eureka-client/src/test/java/com/netflix/discovery/DiscoveryClientDisableRegistryTest.java b/eureka-client-core/src/test/java/com/netflix/discovery/DiscoveryClientDisableRegistryTest.java similarity index 100% rename from eureka-client/src/test/java/com/netflix/discovery/DiscoveryClientDisableRegistryTest.java rename to eureka-client-core/src/test/java/com/netflix/discovery/DiscoveryClientDisableRegistryTest.java diff --git a/eureka-client/src/test/java/com/netflix/discovery/DiscoveryClientEventBusTest.java b/eureka-client-core/src/test/java/com/netflix/discovery/DiscoveryClientEventBusTest.java similarity index 100% rename from eureka-client/src/test/java/com/netflix/discovery/DiscoveryClientEventBusTest.java rename to eureka-client-core/src/test/java/com/netflix/discovery/DiscoveryClientEventBusTest.java diff --git a/eureka-client/src/test/java/com/netflix/discovery/DiscoveryClientHealthTest.java b/eureka-client-core/src/test/java/com/netflix/discovery/DiscoveryClientHealthTest.java similarity index 100% rename from eureka-client/src/test/java/com/netflix/discovery/DiscoveryClientHealthTest.java rename to eureka-client-core/src/test/java/com/netflix/discovery/DiscoveryClientHealthTest.java diff --git a/eureka-client/src/test/java/com/netflix/discovery/DiscoveryClientRedirectTest.java b/eureka-client-core/src/test/java/com/netflix/discovery/DiscoveryClientRedirectTest.java similarity index 100% rename from eureka-client/src/test/java/com/netflix/discovery/DiscoveryClientRedirectTest.java rename to eureka-client-core/src/test/java/com/netflix/discovery/DiscoveryClientRedirectTest.java diff --git a/eureka-client/src/test/java/com/netflix/discovery/DiscoveryClientRegisterUpdateTest.java b/eureka-client-core/src/test/java/com/netflix/discovery/DiscoveryClientRegisterUpdateTest.java similarity index 100% rename from eureka-client/src/test/java/com/netflix/discovery/DiscoveryClientRegisterUpdateTest.java rename to eureka-client-core/src/test/java/com/netflix/discovery/DiscoveryClientRegisterUpdateTest.java diff --git a/eureka-client/src/test/java/com/netflix/discovery/DiscoveryClientRegistryTest.java b/eureka-client-core/src/test/java/com/netflix/discovery/DiscoveryClientRegistryTest.java similarity index 100% rename from eureka-client/src/test/java/com/netflix/discovery/DiscoveryClientRegistryTest.java rename to eureka-client-core/src/test/java/com/netflix/discovery/DiscoveryClientRegistryTest.java diff --git a/eureka-client/src/test/java/com/netflix/discovery/DiscoveryClientStatsInitFailedTest.java b/eureka-client-core/src/test/java/com/netflix/discovery/DiscoveryClientStatsInitFailedTest.java similarity index 100% rename from eureka-client/src/test/java/com/netflix/discovery/DiscoveryClientStatsInitFailedTest.java rename to eureka-client-core/src/test/java/com/netflix/discovery/DiscoveryClientStatsInitFailedTest.java diff --git a/eureka-client/src/test/java/com/netflix/discovery/DiscoveryClientStatsTest.java b/eureka-client-core/src/test/java/com/netflix/discovery/DiscoveryClientStatsTest.java similarity index 100% rename from eureka-client/src/test/java/com/netflix/discovery/DiscoveryClientStatsTest.java rename to eureka-client-core/src/test/java/com/netflix/discovery/DiscoveryClientStatsTest.java diff --git a/eureka-client/src/test/java/com/netflix/discovery/EurekaClientLifecycleServerFailureTest.java b/eureka-client-core/src/test/java/com/netflix/discovery/EurekaClientLifecycleServerFailureTest.java similarity index 100% rename from eureka-client/src/test/java/com/netflix/discovery/EurekaClientLifecycleServerFailureTest.java rename to eureka-client-core/src/test/java/com/netflix/discovery/EurekaClientLifecycleServerFailureTest.java diff --git a/eureka-client/src/test/java/com/netflix/discovery/EurekaClientLifecycleTest.java b/eureka-client-core/src/test/java/com/netflix/discovery/EurekaClientLifecycleTest.java similarity index 100% rename from eureka-client/src/test/java/com/netflix/discovery/EurekaClientLifecycleTest.java rename to eureka-client-core/src/test/java/com/netflix/discovery/EurekaClientLifecycleTest.java diff --git a/eureka-client/src/test/java/com/netflix/discovery/EurekaEventListenerTest.java b/eureka-client-core/src/test/java/com/netflix/discovery/EurekaEventListenerTest.java similarity index 100% rename from eureka-client/src/test/java/com/netflix/discovery/EurekaEventListenerTest.java rename to eureka-client-core/src/test/java/com/netflix/discovery/EurekaEventListenerTest.java diff --git a/eureka-client/src/test/java/com/netflix/discovery/InstanceInfoReplicatorTest.java b/eureka-client-core/src/test/java/com/netflix/discovery/InstanceInfoReplicatorTest.java similarity index 100% rename from eureka-client/src/test/java/com/netflix/discovery/InstanceInfoReplicatorTest.java rename to eureka-client-core/src/test/java/com/netflix/discovery/InstanceInfoReplicatorTest.java diff --git a/eureka-client/src/test/java/com/netflix/discovery/InstanceRegionCheckerTest.java b/eureka-client-core/src/test/java/com/netflix/discovery/InstanceRegionCheckerTest.java similarity index 100% rename from eureka-client/src/test/java/com/netflix/discovery/InstanceRegionCheckerTest.java rename to eureka-client-core/src/test/java/com/netflix/discovery/InstanceRegionCheckerTest.java diff --git a/eureka-client-core/src/test/java/com/netflix/discovery/Jersey1DiscoveryClientOptionalArgsTest.java b/eureka-client-core/src/test/java/com/netflix/discovery/Jersey1DiscoveryClientOptionalArgsTest.java new file mode 100644 index 000000000..59da1b716 --- /dev/null +++ b/eureka-client-core/src/test/java/com/netflix/discovery/Jersey1DiscoveryClientOptionalArgsTest.java @@ -0,0 +1,58 @@ +package com.netflix.discovery; + +import javax.inject.Provider; + +import com.netflix.discovery.shared.transport.jersey.Jersey1DiscoveryClientOptionalArgs; +import org.junit.Before; +import org.junit.Test; + +import com.netflix.appinfo.HealthCheckCallback; +import com.netflix.appinfo.HealthCheckHandler; + +/** + * @author Matt Nelson + */ +public class Jersey1DiscoveryClientOptionalArgsTest { + + private Jersey1DiscoveryClientOptionalArgs args; + + @Before + public void before() { + args = new Jersey1DiscoveryClientOptionalArgs(); + } + + @Test + public void testHealthCheckCallbackGuiceProvider() { + args.setHealthCheckCallbackProvider(new GuiceProvider()); + } + + @Test + public void testHealthCheckCallbackJavaxProvider() { + args.setHealthCheckCallbackProvider(new JavaxProvider()); + } + + @Test + public void testHealthCheckHandlerGuiceProvider() { + args.setHealthCheckHandlerProvider(new GuiceProvider()); + } + + @Test + public void testHealthCheckHandlerJavaxProvider() { + args.setHealthCheckHandlerProvider(new JavaxProvider()); + } + + private class JavaxProvider implements Provider { + @Override + public T get() { + return null; + } + } + + private class GuiceProvider implements com.google.inject.Provider { + + @Override + public T get() { + return null; + } + } +} diff --git a/eureka-client/src/test/java/com/netflix/discovery/MockBackupRegistry.java b/eureka-client-core/src/test/java/com/netflix/discovery/MockBackupRegistry.java similarity index 100% rename from eureka-client/src/test/java/com/netflix/discovery/MockBackupRegistry.java rename to eureka-client-core/src/test/java/com/netflix/discovery/MockBackupRegistry.java diff --git a/eureka-client/src/test/java/com/netflix/discovery/MockRemoteEurekaServer.java b/eureka-client-core/src/test/java/com/netflix/discovery/MockRemoteEurekaServer.java similarity index 100% rename from eureka-client/src/test/java/com/netflix/discovery/MockRemoteEurekaServer.java rename to eureka-client-core/src/test/java/com/netflix/discovery/MockRemoteEurekaServer.java diff --git a/eureka-client/src/test/java/com/netflix/discovery/TimedSupervisorTaskTest.java b/eureka-client-core/src/test/java/com/netflix/discovery/TimedSupervisorTaskTest.java similarity index 100% rename from eureka-client/src/test/java/com/netflix/discovery/TimedSupervisorTaskTest.java rename to eureka-client-core/src/test/java/com/netflix/discovery/TimedSupervisorTaskTest.java diff --git a/eureka-client/src/test/java/com/netflix/discovery/converters/CodecLoadTester.java b/eureka-client-core/src/test/java/com/netflix/discovery/converters/CodecLoadTester.java similarity index 100% rename from eureka-client/src/test/java/com/netflix/discovery/converters/CodecLoadTester.java rename to eureka-client-core/src/test/java/com/netflix/discovery/converters/CodecLoadTester.java diff --git a/eureka-client/src/test/java/com/netflix/discovery/converters/EnumLookupTest.java b/eureka-client-core/src/test/java/com/netflix/discovery/converters/EnumLookupTest.java similarity index 100% rename from eureka-client/src/test/java/com/netflix/discovery/converters/EnumLookupTest.java rename to eureka-client-core/src/test/java/com/netflix/discovery/converters/EnumLookupTest.java diff --git a/eureka-client/src/test/java/com/netflix/discovery/converters/EurekaCodecCompatibilityTest.java b/eureka-client-core/src/test/java/com/netflix/discovery/converters/EurekaCodecCompatibilityTest.java similarity index 100% rename from eureka-client/src/test/java/com/netflix/discovery/converters/EurekaCodecCompatibilityTest.java rename to eureka-client-core/src/test/java/com/netflix/discovery/converters/EurekaCodecCompatibilityTest.java diff --git a/eureka-client/src/test/java/com/netflix/discovery/converters/EurekaJacksonCodecIntegrationTest.java b/eureka-client-core/src/test/java/com/netflix/discovery/converters/EurekaJacksonCodecIntegrationTest.java similarity index 100% rename from eureka-client/src/test/java/com/netflix/discovery/converters/EurekaJacksonCodecIntegrationTest.java rename to eureka-client-core/src/test/java/com/netflix/discovery/converters/EurekaJacksonCodecIntegrationTest.java diff --git a/eureka-client/src/test/java/com/netflix/discovery/converters/EurekaJacksonCodecTest.java b/eureka-client-core/src/test/java/com/netflix/discovery/converters/EurekaJacksonCodecTest.java similarity index 100% rename from eureka-client/src/test/java/com/netflix/discovery/converters/EurekaJacksonCodecTest.java rename to eureka-client-core/src/test/java/com/netflix/discovery/converters/EurekaJacksonCodecTest.java diff --git a/eureka-client/src/test/java/com/netflix/discovery/converters/EurekaJsonAndXmlJacksonCodecTest.java b/eureka-client-core/src/test/java/com/netflix/discovery/converters/EurekaJsonAndXmlJacksonCodecTest.java similarity index 100% rename from eureka-client/src/test/java/com/netflix/discovery/converters/EurekaJsonAndXmlJacksonCodecTest.java rename to eureka-client-core/src/test/java/com/netflix/discovery/converters/EurekaJsonAndXmlJacksonCodecTest.java diff --git a/eureka-client/src/test/java/com/netflix/discovery/converters/JsonXStreamTest.java b/eureka-client-core/src/test/java/com/netflix/discovery/converters/JsonXStreamTest.java similarity index 100% rename from eureka-client/src/test/java/com/netflix/discovery/converters/JsonXStreamTest.java rename to eureka-client-core/src/test/java/com/netflix/discovery/converters/JsonXStreamTest.java diff --git a/eureka-client/src/test/java/com/netflix/discovery/converters/StringCacheTest.java b/eureka-client-core/src/test/java/com/netflix/discovery/converters/StringCacheTest.java similarity index 100% rename from eureka-client/src/test/java/com/netflix/discovery/converters/StringCacheTest.java rename to eureka-client-core/src/test/java/com/netflix/discovery/converters/StringCacheTest.java diff --git a/eureka-client/src/test/java/com/netflix/discovery/converters/XmlXStreamTest.java b/eureka-client-core/src/test/java/com/netflix/discovery/converters/XmlXStreamTest.java similarity index 100% rename from eureka-client/src/test/java/com/netflix/discovery/converters/XmlXStreamTest.java rename to eureka-client-core/src/test/java/com/netflix/discovery/converters/XmlXStreamTest.java diff --git a/eureka-client/src/test/java/com/netflix/discovery/converters/jackson/builder/StringInterningAmazonInfoBuilderTest.java b/eureka-client-core/src/test/java/com/netflix/discovery/converters/jackson/builder/StringInterningAmazonInfoBuilderTest.java similarity index 100% rename from eureka-client/src/test/java/com/netflix/discovery/converters/jackson/builder/StringInterningAmazonInfoBuilderTest.java rename to eureka-client-core/src/test/java/com/netflix/discovery/converters/jackson/builder/StringInterningAmazonInfoBuilderTest.java diff --git a/eureka-client/src/test/java/com/netflix/discovery/converters/wrappers/CodecWrappersTest.java b/eureka-client-core/src/test/java/com/netflix/discovery/converters/wrappers/CodecWrappersTest.java similarity index 100% rename from eureka-client/src/test/java/com/netflix/discovery/converters/wrappers/CodecWrappersTest.java rename to eureka-client-core/src/test/java/com/netflix/discovery/converters/wrappers/CodecWrappersTest.java diff --git a/eureka-client-core/src/test/java/com/netflix/discovery/guice/EurekaModuleTest.java b/eureka-client-core/src/test/java/com/netflix/discovery/guice/EurekaModuleTest.java new file mode 100644 index 000000000..185490d3c --- /dev/null +++ b/eureka-client-core/src/test/java/com/netflix/discovery/guice/EurekaModuleTest.java @@ -0,0 +1,81 @@ +package com.netflix.discovery.guice; + +import com.google.inject.AbstractModule; +import com.google.inject.Binding; +import com.google.inject.Key; +import com.google.inject.Scopes; +import com.netflix.appinfo.ApplicationInfoManager; +import com.netflix.appinfo.EurekaInstanceConfig; +import com.netflix.appinfo.InstanceInfo; +import com.netflix.appinfo.providers.MyDataCenterInstanceConfigProvider; +import com.netflix.config.ConfigurationManager; +import com.netflix.discovery.DiscoveryClient; +import com.netflix.discovery.DiscoveryManager; +import com.netflix.discovery.EurekaClient; +import com.netflix.discovery.EurekaClientConfig; +import com.netflix.discovery.shared.transport.jersey.TransportClientFactories; +import com.netflix.governator.InjectorBuilder; +import com.netflix.governator.LifecycleInjector; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +/** + * @author David Liu + */ +public class EurekaModuleTest { + + private LifecycleInjector injector; + + @Before + public void setUp() throws Exception { + ConfigurationManager.getConfigInstance().setProperty("eureka.region", "default"); + ConfigurationManager.getConfigInstance().setProperty("eureka.shouldFetchRegistry", "false"); + ConfigurationManager.getConfigInstance().setProperty("eureka.registration.enabled", "false"); + ConfigurationManager.getConfigInstance().setProperty("eureka.serviceUrl.default", "http://localhost:8080/eureka/v2"); + + injector = InjectorBuilder + .fromModule(new EurekaModule()) + .overrideWith(new AbstractModule() { + @Override + protected void configure() { + // the default impl of EurekaInstanceConfig is CloudInstanceConfig, which we only want in an AWS + // environment. Here we override that by binding MyDataCenterInstanceConfig to EurekaInstanceConfig. + bind(EurekaInstanceConfig.class).toProvider(MyDataCenterInstanceConfigProvider.class).in(Scopes.SINGLETON); + } + }) + .createInjector(); + } + + @After + public void tearDown() { + if (injector != null) { + injector.shutdown(); + } + ConfigurationManager.getConfigInstance().clear(); + } + + @SuppressWarnings("deprecation") + @Test + public void testDI() { + InstanceInfo instanceInfo = injector.getInstance(InstanceInfo.class); + Assert.assertEquals(ApplicationInfoManager.getInstance().getInfo(), instanceInfo); + + EurekaClient eurekaClient = injector.getInstance(EurekaClient.class); + DiscoveryClient discoveryClient = injector.getInstance(DiscoveryClient.class); + + Assert.assertEquals(DiscoveryManager.getInstance().getEurekaClient(), eurekaClient); + Assert.assertEquals(DiscoveryManager.getInstance().getDiscoveryClient(), discoveryClient); + Assert.assertEquals(eurekaClient, discoveryClient); + + EurekaClientConfig eurekaClientConfig = injector.getInstance(EurekaClientConfig.class); + Assert.assertEquals(DiscoveryManager.getInstance().getEurekaClientConfig(), eurekaClientConfig); + + EurekaInstanceConfig eurekaInstanceConfig = injector.getInstance(EurekaInstanceConfig.class); + Assert.assertEquals(DiscoveryManager.getInstance().getEurekaInstanceConfig(), eurekaInstanceConfig); + + Binding binding = injector.getExistingBinding(Key.get(TransportClientFactories.class)); + Assert.assertNull(binding); // no bindings so defaulting to default of jersey1 + } +} diff --git a/eureka-client/src/test/java/com/netflix/discovery/provider/DiscoveryJerseyProviderTest.java b/eureka-client-core/src/test/java/com/netflix/discovery/provider/DiscoveryJerseyProviderTest.java similarity index 100% rename from eureka-client/src/test/java/com/netflix/discovery/provider/DiscoveryJerseyProviderTest.java rename to eureka-client-core/src/test/java/com/netflix/discovery/provider/DiscoveryJerseyProviderTest.java diff --git a/eureka-client/src/test/java/com/netflix/discovery/providers/DefaultEurekaClientConfigProviderTest.java b/eureka-client-core/src/test/java/com/netflix/discovery/providers/DefaultEurekaClientConfigProviderTest.java similarity index 100% rename from eureka-client/src/test/java/com/netflix/discovery/providers/DefaultEurekaClientConfigProviderTest.java rename to eureka-client-core/src/test/java/com/netflix/discovery/providers/DefaultEurekaClientConfigProviderTest.java diff --git a/eureka-client/src/test/java/com/netflix/discovery/shared/ApplicationsTest.java b/eureka-client-core/src/test/java/com/netflix/discovery/shared/ApplicationsTest.java similarity index 100% rename from eureka-client/src/test/java/com/netflix/discovery/shared/ApplicationsTest.java rename to eureka-client-core/src/test/java/com/netflix/discovery/shared/ApplicationsTest.java diff --git a/eureka-client/src/test/java/com/netflix/discovery/shared/resolver/AsyncResolverTest.java b/eureka-client-core/src/test/java/com/netflix/discovery/shared/resolver/AsyncResolverTest.java similarity index 100% rename from eureka-client/src/test/java/com/netflix/discovery/shared/resolver/AsyncResolverTest.java rename to eureka-client-core/src/test/java/com/netflix/discovery/shared/resolver/AsyncResolverTest.java diff --git a/eureka-client/src/test/java/com/netflix/discovery/shared/resolver/ReloadingClusterResolverTest.java b/eureka-client-core/src/test/java/com/netflix/discovery/shared/resolver/ReloadingClusterResolverTest.java similarity index 100% rename from eureka-client/src/test/java/com/netflix/discovery/shared/resolver/ReloadingClusterResolverTest.java rename to eureka-client-core/src/test/java/com/netflix/discovery/shared/resolver/ReloadingClusterResolverTest.java diff --git a/eureka-client/src/test/java/com/netflix/discovery/shared/resolver/ResolverUtilsTest.java b/eureka-client-core/src/test/java/com/netflix/discovery/shared/resolver/ResolverUtilsTest.java similarity index 100% rename from eureka-client/src/test/java/com/netflix/discovery/shared/resolver/ResolverUtilsTest.java rename to eureka-client-core/src/test/java/com/netflix/discovery/shared/resolver/ResolverUtilsTest.java diff --git a/eureka-client/src/test/java/com/netflix/discovery/shared/resolver/StaticClusterResolverTest.java b/eureka-client-core/src/test/java/com/netflix/discovery/shared/resolver/StaticClusterResolverTest.java similarity index 100% rename from eureka-client/src/test/java/com/netflix/discovery/shared/resolver/StaticClusterResolverTest.java rename to eureka-client-core/src/test/java/com/netflix/discovery/shared/resolver/StaticClusterResolverTest.java diff --git a/eureka-client/src/test/java/com/netflix/discovery/shared/resolver/aws/ApplicationsResolverTest.java b/eureka-client-core/src/test/java/com/netflix/discovery/shared/resolver/aws/ApplicationsResolverTest.java similarity index 100% rename from eureka-client/src/test/java/com/netflix/discovery/shared/resolver/aws/ApplicationsResolverTest.java rename to eureka-client-core/src/test/java/com/netflix/discovery/shared/resolver/aws/ApplicationsResolverTest.java diff --git a/eureka-client/src/test/java/com/netflix/discovery/shared/resolver/aws/ConfigClusterResolverTest.java b/eureka-client-core/src/test/java/com/netflix/discovery/shared/resolver/aws/ConfigClusterResolverTest.java similarity index 100% rename from eureka-client/src/test/java/com/netflix/discovery/shared/resolver/aws/ConfigClusterResolverTest.java rename to eureka-client-core/src/test/java/com/netflix/discovery/shared/resolver/aws/ConfigClusterResolverTest.java diff --git a/eureka-client/src/test/java/com/netflix/discovery/shared/resolver/aws/EurekaHttpResolverTest.java b/eureka-client-core/src/test/java/com/netflix/discovery/shared/resolver/aws/EurekaHttpResolverTest.java similarity index 100% rename from eureka-client/src/test/java/com/netflix/discovery/shared/resolver/aws/EurekaHttpResolverTest.java rename to eureka-client-core/src/test/java/com/netflix/discovery/shared/resolver/aws/EurekaHttpResolverTest.java diff --git a/eureka-client/src/test/java/com/netflix/discovery/shared/resolver/aws/SampleCluster.java b/eureka-client-core/src/test/java/com/netflix/discovery/shared/resolver/aws/SampleCluster.java similarity index 100% rename from eureka-client/src/test/java/com/netflix/discovery/shared/resolver/aws/SampleCluster.java rename to eureka-client-core/src/test/java/com/netflix/discovery/shared/resolver/aws/SampleCluster.java diff --git a/eureka-client/src/test/java/com/netflix/discovery/shared/resolver/aws/TestEurekaHttpResolver.java b/eureka-client-core/src/test/java/com/netflix/discovery/shared/resolver/aws/TestEurekaHttpResolver.java similarity index 100% rename from eureka-client/src/test/java/com/netflix/discovery/shared/resolver/aws/TestEurekaHttpResolver.java rename to eureka-client-core/src/test/java/com/netflix/discovery/shared/resolver/aws/TestEurekaHttpResolver.java diff --git a/eureka-client/src/test/java/com/netflix/discovery/shared/resolver/aws/ZoneAffinityClusterResolverTest.java b/eureka-client-core/src/test/java/com/netflix/discovery/shared/resolver/aws/ZoneAffinityClusterResolverTest.java similarity index 100% rename from eureka-client/src/test/java/com/netflix/discovery/shared/resolver/aws/ZoneAffinityClusterResolverTest.java rename to eureka-client-core/src/test/java/com/netflix/discovery/shared/resolver/aws/ZoneAffinityClusterResolverTest.java diff --git a/eureka-client/src/test/java/com/netflix/discovery/shared/transport/decorator/RedirectingEurekaHttpClientTest.java b/eureka-client-core/src/test/java/com/netflix/discovery/shared/transport/decorator/RedirectingEurekaHttpClientTest.java similarity index 100% rename from eureka-client/src/test/java/com/netflix/discovery/shared/transport/decorator/RedirectingEurekaHttpClientTest.java rename to eureka-client-core/src/test/java/com/netflix/discovery/shared/transport/decorator/RedirectingEurekaHttpClientTest.java diff --git a/eureka-client/src/test/java/com/netflix/discovery/shared/transport/decorator/RetryableEurekaHttpClientTest.java b/eureka-client-core/src/test/java/com/netflix/discovery/shared/transport/decorator/RetryableEurekaHttpClientTest.java similarity index 100% rename from eureka-client/src/test/java/com/netflix/discovery/shared/transport/decorator/RetryableEurekaHttpClientTest.java rename to eureka-client-core/src/test/java/com/netflix/discovery/shared/transport/decorator/RetryableEurekaHttpClientTest.java diff --git a/eureka-client/src/test/java/com/netflix/discovery/shared/transport/decorator/SessionedEurekaHttpClientTest.java b/eureka-client-core/src/test/java/com/netflix/discovery/shared/transport/decorator/SessionedEurekaHttpClientTest.java similarity index 100% rename from eureka-client/src/test/java/com/netflix/discovery/shared/transport/decorator/SessionedEurekaHttpClientTest.java rename to eureka-client-core/src/test/java/com/netflix/discovery/shared/transport/decorator/SessionedEurekaHttpClientTest.java diff --git a/eureka-client/src/test/java/com/netflix/discovery/util/DeserializerStringCacheTest.java b/eureka-client-core/src/test/java/com/netflix/discovery/util/DeserializerStringCacheTest.java similarity index 100% rename from eureka-client/src/test/java/com/netflix/discovery/util/DeserializerStringCacheTest.java rename to eureka-client-core/src/test/java/com/netflix/discovery/util/DeserializerStringCacheTest.java diff --git a/eureka-client/src/test/java/com/netflix/discovery/util/DiscoveryBuildInfoTest.java b/eureka-client-core/src/test/java/com/netflix/discovery/util/DiscoveryBuildInfoTest.java similarity index 100% rename from eureka-client/src/test/java/com/netflix/discovery/util/DiscoveryBuildInfoTest.java rename to eureka-client-core/src/test/java/com/netflix/discovery/util/DiscoveryBuildInfoTest.java diff --git a/eureka-client/src/test/java/com/netflix/discovery/util/EurekaEntityFunctionsTest.java b/eureka-client-core/src/test/java/com/netflix/discovery/util/EurekaEntityFunctionsTest.java similarity index 100% rename from eureka-client/src/test/java/com/netflix/discovery/util/EurekaEntityFunctionsTest.java rename to eureka-client-core/src/test/java/com/netflix/discovery/util/EurekaEntityFunctionsTest.java diff --git a/eureka-client/src/test/java/com/netflix/discovery/util/EurekaUtilsTest.java b/eureka-client-core/src/test/java/com/netflix/discovery/util/EurekaUtilsTest.java similarity index 100% rename from eureka-client/src/test/java/com/netflix/discovery/util/EurekaUtilsTest.java rename to eureka-client-core/src/test/java/com/netflix/discovery/util/EurekaUtilsTest.java diff --git a/eureka-client/src/test/java/com/netflix/discovery/util/RateLimiterTest.java b/eureka-client-core/src/test/java/com/netflix/discovery/util/RateLimiterTest.java similarity index 100% rename from eureka-client/src/test/java/com/netflix/discovery/util/RateLimiterTest.java rename to eureka-client-core/src/test/java/com/netflix/discovery/util/RateLimiterTest.java diff --git a/eureka-client-jersey2/build.gradle b/eureka-client-jersey2/build.gradle index 2eab90735..e5ef76b06 100644 --- a/eureka-client-jersey2/build.gradle +++ b/eureka-client-jersey2/build.gradle @@ -24,7 +24,7 @@ configurations.all { } dependencies { - compile project(':eureka-client') + compile project(':eureka-client-core') compile 'org.glassfish.jersey.core:jersey-client:2.23.1' compile 'org.glassfish.jersey.connectors:jersey-apache-connector:2.23.1' diff --git a/eureka-client-jersey2/src/main/java/com/netflix/discovery/shared/transport/jersey2/Jersey2TransportClientFactories.java b/eureka-client-jersey2/src/main/java/com/netflix/discovery/shared/transport/jersey2/Jersey2TransportClientFactories.java index 6de5f5f44..9d99975ab 100644 --- a/eureka-client-jersey2/src/main/java/com/netflix/discovery/shared/transport/jersey2/Jersey2TransportClientFactories.java +++ b/eureka-client-jersey2/src/main/java/com/netflix/discovery/shared/transport/jersey2/Jersey2TransportClientFactories.java @@ -14,7 +14,6 @@ import com.netflix.discovery.shared.transport.EurekaHttpClient; import com.netflix.discovery.shared.transport.TransportClientFactory; import com.netflix.discovery.shared.transport.decorator.MetricsCollectingEurekaHttpClient; -import com.netflix.discovery.shared.transport.jersey.EurekaJerseyClient; import com.netflix.discovery.shared.transport.jersey.TransportClientFactories; public class Jersey2TransportClientFactories implements TransportClientFactories { @@ -60,10 +59,4 @@ public void shutdown() { }; } - @Override - public TransportClientFactory newTransportClientFactory(Collection additionalFilters, - EurekaJerseyClient providedJerseyClient) { - throw new UnsupportedOperationException(); - } - } \ No newline at end of file diff --git a/eureka-client/build.gradle b/eureka-client/build.gradle index af9dfdceb..e709cc4fb 100644 --- a/eureka-client/build.gradle +++ b/eureka-client/build.gradle @@ -1,36 +1,11 @@ apply plugin: 'nebula.test-jar' -configurations.all { - // jersey2 - exclude group: 'org.glassfish.jersey' -} - dependencies { - compile "com.netflix.netflix-commons:netflix-eventbus:0.3.0" - compile 'com.thoughtworks.xstream:xstream:1.4.18' - compile "com.netflix.archaius:archaius-core:${archaiusVersion}" - compile 'javax.ws.rs:jsr311-api:1.1.1' - compile "com.netflix.servo:servo-core:${servoVersion}" + compile project(':eureka-client-core') + compile "com.sun.jersey:jersey-core:${jerseyVersion}" compile "com.sun.jersey:jersey-client:${jerseyVersion}" compile "com.sun.jersey.contribs:jersey-apache-client4:${jerseyVersion}" - compile "org.apache.httpcomponents:httpclient:${apacheHttpClientVersion}" - compile "com.google.code.findbugs:jsr305:${jsr305Version}" - compile "commons-configuration:commons-configuration:${commonsConfigurationVersion}" - compile "com.google.inject:guice:${guiceVersion}" - - compile "com.github.vlsi.compactmap:compactmap:2.0" - - compile "com.fasterxml.jackson.core:jackson-annotations:${jacksonVersion}" - compile "com.fasterxml.jackson.core:jackson-core:${jacksonVersion}" - compile "com.fasterxml.jackson.core:jackson-databind:${jacksonDatabindVersion}" - - // Eureka client uses JSON encoding by default - compileOnly "com.fasterxml.jackson.dataformat:jackson-dataformat-xml:${jacksonVersion}" - // Prefered jackson Stax serializer. Default Oracle has issues (adds empty namespace) and is slower - compileOnly "com.fasterxml.woodstox:woodstox-core:${woodstoxVersion}" - - runtimeOnly "org.codehaus.jettison:jettison:${jettisonVersion}" testCompile project(':eureka-test-utils') testCompile "junit:junit:${junit_version}" diff --git a/eureka-client/src/test/java/com/netflix/discovery/shared/transport/EurekaHttpClientsTest.java b/eureka-client/src/test/java/com/netflix/discovery/shared/transport/EurekaHttpClientsTest.java index f0d7933c5..86535651e 100644 --- a/eureka-client/src/test/java/com/netflix/discovery/shared/transport/EurekaHttpClientsTest.java +++ b/eureka-client/src/test/java/com/netflix/discovery/shared/transport/EurekaHttpClientsTest.java @@ -40,7 +40,6 @@ import com.netflix.discovery.shared.resolver.aws.ApplicationsResolver; import com.netflix.discovery.shared.resolver.aws.AwsEndpoint; import com.netflix.discovery.shared.resolver.aws.EurekaHttpResolver; -import com.netflix.discovery.shared.resolver.aws.TestEurekaHttpResolver; import com.netflix.discovery.shared.transport.jersey.Jersey1TransportClientFactories; import com.netflix.discovery.util.EurekaEntityComparators; import com.netflix.discovery.util.InstanceInfoGenerator; @@ -302,4 +301,11 @@ public boolean await(long timeout, TimeUnit unit) throws Exception { return latch.await(timeout, unit); } } + + static class TestEurekaHttpResolver extends EurekaHttpResolver { + public TestEurekaHttpResolver(EurekaClientConfig clientConfig, EurekaTransportConfig transportConfig, EurekaHttpClientFactory clientFactory, String vipAddress) { + super(clientConfig, transportConfig, clientFactory, vipAddress); + } + } + } \ No newline at end of file diff --git a/eureka-core/src/main/java/com/netflix/eureka/DefaultEurekaServerConfig.java b/eureka-core/src/main/java/com/netflix/eureka/DefaultEurekaServerConfig.java index 8d1f38b36..ba395089a 100644 --- a/eureka-core/src/main/java/com/netflix/eureka/DefaultEurekaServerConfig.java +++ b/eureka-core/src/main/java/com/netflix/eureka/DefaultEurekaServerConfig.java @@ -25,7 +25,7 @@ import java.util.Set; import javax.annotation.Nullable; -import javax.inject.Singleton; +import com.google.inject.Singleton; import com.netflix.config.ConfigurationManager; import com.netflix.config.DynamicBooleanProperty; diff --git a/eureka-core/src/main/java/com/netflix/eureka/DefaultEurekaServerContext.java b/eureka-core/src/main/java/com/netflix/eureka/DefaultEurekaServerContext.java index 9a96419db..8f80c1329 100644 --- a/eureka-core/src/main/java/com/netflix/eureka/DefaultEurekaServerContext.java +++ b/eureka-core/src/main/java/com/netflix/eureka/DefaultEurekaServerContext.java @@ -28,8 +28,8 @@ import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; -import javax.inject.Inject; -import javax.inject.Singleton; +import com.google.inject.Inject; +import com.google.inject.Singleton; /** * Represent the local server context and exposes getters to components of the diff --git a/eureka-core/src/main/java/com/netflix/eureka/GzipEncodingEnforcingFilter.java b/eureka-core/src/main/java/com/netflix/eureka/GzipEncodingEnforcingFilter.java index 02ad4d046..4fdc9351a 100644 --- a/eureka-core/src/main/java/com/netflix/eureka/GzipEncodingEnforcingFilter.java +++ b/eureka-core/src/main/java/com/netflix/eureka/GzipEncodingEnforcingFilter.java @@ -1,6 +1,6 @@ package com.netflix.eureka; -import javax.inject.Singleton; +import com.google.inject.Singleton; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; diff --git a/eureka-core/src/main/java/com/netflix/eureka/RateLimitingFilter.java b/eureka-core/src/main/java/com/netflix/eureka/RateLimitingFilter.java index 317d1d563..53077a385 100644 --- a/eureka-core/src/main/java/com/netflix/eureka/RateLimitingFilter.java +++ b/eureka-core/src/main/java/com/netflix/eureka/RateLimitingFilter.java @@ -16,8 +16,8 @@ package com.netflix.eureka; -import javax.inject.Inject; -import javax.inject.Singleton; +import com.google.inject.Inject; +import com.google.inject.Singleton; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; diff --git a/eureka-core/src/main/java/com/netflix/eureka/ServerRequestAuthFilter.java b/eureka-core/src/main/java/com/netflix/eureka/ServerRequestAuthFilter.java index 26a4a217d..eb63971a8 100644 --- a/eureka-core/src/main/java/com/netflix/eureka/ServerRequestAuthFilter.java +++ b/eureka-core/src/main/java/com/netflix/eureka/ServerRequestAuthFilter.java @@ -1,7 +1,7 @@ package com.netflix.eureka; -import javax.inject.Inject; -import javax.inject.Singleton; +import com.google.inject.Inject; +import com.google.inject.Singleton; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; diff --git a/eureka-core/src/main/java/com/netflix/eureka/StatusFilter.java b/eureka-core/src/main/java/com/netflix/eureka/StatusFilter.java index b6715a524..ecf6321f9 100644 --- a/eureka-core/src/main/java/com/netflix/eureka/StatusFilter.java +++ b/eureka-core/src/main/java/com/netflix/eureka/StatusFilter.java @@ -16,7 +16,7 @@ package com.netflix.eureka; -import javax.inject.Singleton; +import com.google.inject.Singleton; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; diff --git a/eureka-core/src/main/java/com/netflix/eureka/aws/AwsAsgUtil.java b/eureka-core/src/main/java/com/netflix/eureka/aws/AwsAsgUtil.java index 972f5aa59..7508fa95f 100644 --- a/eureka-core/src/main/java/com/netflix/eureka/aws/AwsAsgUtil.java +++ b/eureka-core/src/main/java/com/netflix/eureka/aws/AwsAsgUtil.java @@ -31,8 +31,8 @@ import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; -import javax.inject.Inject; -import javax.inject.Singleton; +import com.google.inject.Inject; +import com.google.inject.Singleton; import com.amazonaws.ClientConfiguration; import com.amazonaws.auth.BasicAWSCredentials; diff --git a/eureka-core/src/main/java/com/netflix/eureka/aws/AwsBinderDelegate.java b/eureka-core/src/main/java/com/netflix/eureka/aws/AwsBinderDelegate.java index 4cfbaa114..8a5c7e59b 100644 --- a/eureka-core/src/main/java/com/netflix/eureka/aws/AwsBinderDelegate.java +++ b/eureka-core/src/main/java/com/netflix/eureka/aws/AwsBinderDelegate.java @@ -7,8 +7,8 @@ import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; -import javax.inject.Inject; -import javax.inject.Singleton; +import com.google.inject.Inject; +import com.google.inject.Singleton; @Singleton public class AwsBinderDelegate implements AwsBinder { diff --git a/eureka-core/src/main/java/com/netflix/eureka/aws/EIPManager.java b/eureka-core/src/main/java/com/netflix/eureka/aws/EIPManager.java index bb1297158..091bb9f77 100644 --- a/eureka-core/src/main/java/com/netflix/eureka/aws/EIPManager.java +++ b/eureka-core/src/main/java/com/netflix/eureka/aws/EIPManager.java @@ -46,8 +46,8 @@ import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; -import javax.inject.Inject; -import javax.inject.Singleton; +import com.google.inject.Inject; +import com.google.inject.Singleton; /** * An AWS specific elastic ip binding utility for binding eureka diff --git a/eureka-core/src/main/java/com/netflix/eureka/aws/ElasticNetworkInterfaceBinder.java b/eureka-core/src/main/java/com/netflix/eureka/aws/ElasticNetworkInterfaceBinder.java index 75631878a..a219436b0 100644 --- a/eureka-core/src/main/java/com/netflix/eureka/aws/ElasticNetworkInterfaceBinder.java +++ b/eureka-core/src/main/java/com/netflix/eureka/aws/ElasticNetworkInterfaceBinder.java @@ -24,7 +24,7 @@ import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; -import javax.inject.Inject; +import com.google.inject.Inject; import java.net.MalformedURLException; import java.net.URL; import java.util.Collection; diff --git a/eureka-core/src/main/java/com/netflix/eureka/aws/Route53Binder.java b/eureka-core/src/main/java/com/netflix/eureka/aws/Route53Binder.java index 5b89fab4a..889f6fdce 100644 --- a/eureka-core/src/main/java/com/netflix/eureka/aws/Route53Binder.java +++ b/eureka-core/src/main/java/com/netflix/eureka/aws/Route53Binder.java @@ -15,8 +15,8 @@ import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; -import javax.inject.Inject; -import javax.inject.Singleton; +import com.google.inject.Inject; +import com.google.inject.Singleton; import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; diff --git a/eureka-core/src/main/java/com/netflix/eureka/cluster/PeerEurekaNodes.java b/eureka-core/src/main/java/com/netflix/eureka/cluster/PeerEurekaNodes.java index 0f221ec74..c535c372f 100644 --- a/eureka-core/src/main/java/com/netflix/eureka/cluster/PeerEurekaNodes.java +++ b/eureka-core/src/main/java/com/netflix/eureka/cluster/PeerEurekaNodes.java @@ -1,7 +1,7 @@ package com.netflix.eureka.cluster; -import javax.inject.Inject; -import javax.inject.Singleton; +import com.google.inject.Inject; +import com.google.inject.Singleton; import java.net.URI; import java.net.URISyntaxException; import java.util.ArrayList; diff --git a/eureka-core/src/main/java/com/netflix/eureka/registry/AwsInstanceRegistry.java b/eureka-core/src/main/java/com/netflix/eureka/registry/AwsInstanceRegistry.java index 4002b3a51..c47c9255b 100644 --- a/eureka-core/src/main/java/com/netflix/eureka/registry/AwsInstanceRegistry.java +++ b/eureka-core/src/main/java/com/netflix/eureka/registry/AwsInstanceRegistry.java @@ -29,8 +29,8 @@ import com.netflix.eureka.registry.rule.OverrideExistsRule; import com.netflix.eureka.resources.ServerCodecs; -import javax.inject.Inject; -import javax.inject.Singleton; +import com.google.inject.Inject; +import com.google.inject.Singleton; /** * Override some methods with aws specific use cases. diff --git a/eureka-core/src/main/java/com/netflix/eureka/registry/PeerAwareInstanceRegistryImpl.java b/eureka-core/src/main/java/com/netflix/eureka/registry/PeerAwareInstanceRegistryImpl.java index 44c94cc94..0e3e79f78 100644 --- a/eureka-core/src/main/java/com/netflix/eureka/registry/PeerAwareInstanceRegistryImpl.java +++ b/eureka-core/src/main/java/com/netflix/eureka/registry/PeerAwareInstanceRegistryImpl.java @@ -57,8 +57,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.inject.Inject; -import javax.inject.Singleton; +import com.google.inject.Inject; +import com.google.inject.Singleton; import static com.netflix.eureka.Names.METRIC_REGISTRY_PREFIX; diff --git a/eureka-core/src/main/java/com/netflix/eureka/registry/RemoteRegionRegistry.java b/eureka-core/src/main/java/com/netflix/eureka/registry/RemoteRegionRegistry.java index 130e0e97a..c91ce1ebd 100644 --- a/eureka-core/src/main/java/com/netflix/eureka/registry/RemoteRegionRegistry.java +++ b/eureka-core/src/main/java/com/netflix/eureka/registry/RemoteRegionRegistry.java @@ -15,7 +15,7 @@ */ package com.netflix.eureka.registry; -import javax.inject.Inject; +import com.google.inject.Inject; import javax.ws.rs.core.MediaType; import java.net.InetAddress; import java.net.URL; diff --git a/eureka-core/src/main/java/com/netflix/eureka/resources/ASGResource.java b/eureka-core/src/main/java/com/netflix/eureka/resources/ASGResource.java index 3a607b869..e6db3051c 100644 --- a/eureka-core/src/main/java/com/netflix/eureka/resources/ASGResource.java +++ b/eureka-core/src/main/java/com/netflix/eureka/resources/ASGResource.java @@ -16,7 +16,7 @@ package com.netflix.eureka.resources; -import javax.inject.Inject; +import com.google.inject.Inject; import javax.ws.rs.HeaderParam; import javax.ws.rs.PUT; import javax.ws.rs.Path; diff --git a/eureka-core/src/main/java/com/netflix/eureka/resources/ApplicationsResource.java b/eureka-core/src/main/java/com/netflix/eureka/resources/ApplicationsResource.java index 5ae4b33fa..d0c42a4bc 100755 --- a/eureka-core/src/main/java/com/netflix/eureka/resources/ApplicationsResource.java +++ b/eureka-core/src/main/java/com/netflix/eureka/resources/ApplicationsResource.java @@ -17,7 +17,7 @@ package com.netflix.eureka.resources; import javax.annotation.Nullable; -import javax.inject.Inject; +import com.google.inject.Inject; import javax.ws.rs.GET; import javax.ws.rs.HeaderParam; import javax.ws.rs.Path; diff --git a/eureka-core/src/main/java/com/netflix/eureka/resources/DefaultServerCodecs.java b/eureka-core/src/main/java/com/netflix/eureka/resources/DefaultServerCodecs.java index a3d49142a..8ac50ef10 100644 --- a/eureka-core/src/main/java/com/netflix/eureka/resources/DefaultServerCodecs.java +++ b/eureka-core/src/main/java/com/netflix/eureka/resources/DefaultServerCodecs.java @@ -7,8 +7,8 @@ import com.netflix.eureka.EurekaServerConfig; import com.netflix.eureka.registry.Key; -import javax.inject.Inject; -import javax.inject.Singleton; +import com.google.inject.Inject; +import com.google.inject.Singleton; /** * @author David Liu diff --git a/eureka-core/src/main/java/com/netflix/eureka/resources/InstancesResource.java b/eureka-core/src/main/java/com/netflix/eureka/resources/InstancesResource.java index 65e2e1edb..eb804c715 100644 --- a/eureka-core/src/main/java/com/netflix/eureka/resources/InstancesResource.java +++ b/eureka-core/src/main/java/com/netflix/eureka/resources/InstancesResource.java @@ -16,7 +16,7 @@ package com.netflix.eureka.resources; -import javax.inject.Inject; +import com.google.inject.Inject; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.PathParam; diff --git a/eureka-core/src/main/java/com/netflix/eureka/resources/PeerReplicationResource.java b/eureka-core/src/main/java/com/netflix/eureka/resources/PeerReplicationResource.java index 9d64249fc..57ba6ee0d 100644 --- a/eureka-core/src/main/java/com/netflix/eureka/resources/PeerReplicationResource.java +++ b/eureka-core/src/main/java/com/netflix/eureka/resources/PeerReplicationResource.java @@ -16,7 +16,7 @@ package com.netflix.eureka.resources; -import javax.inject.Inject; +import com.google.inject.Inject; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.Produces; diff --git a/eureka-core/src/main/java/com/netflix/eureka/resources/SecureVIPResource.java b/eureka-core/src/main/java/com/netflix/eureka/resources/SecureVIPResource.java index 93ea0bcf9..a8b024dc6 100644 --- a/eureka-core/src/main/java/com/netflix/eureka/resources/SecureVIPResource.java +++ b/eureka-core/src/main/java/com/netflix/eureka/resources/SecureVIPResource.java @@ -21,7 +21,7 @@ import com.netflix.eureka.EurekaServerContextHolder; import com.netflix.eureka.registry.Key; -import javax.inject.Inject; +import com.google.inject.Inject; import javax.ws.rs.GET; import javax.ws.rs.HeaderParam; import javax.ws.rs.Path; diff --git a/eureka-core/src/main/java/com/netflix/eureka/resources/ServerInfoResource.java b/eureka-core/src/main/java/com/netflix/eureka/resources/ServerInfoResource.java index e36965257..9a0f824ba 100644 --- a/eureka-core/src/main/java/com/netflix/eureka/resources/ServerInfoResource.java +++ b/eureka-core/src/main/java/com/netflix/eureka/resources/ServerInfoResource.java @@ -6,7 +6,7 @@ import com.netflix.eureka.EurekaServerContextHolder; import com.netflix.eureka.registry.PeerAwareInstanceRegistry; -import javax.inject.Inject; +import com.google.inject.Inject; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; diff --git a/eureka-core/src/main/java/com/netflix/eureka/resources/StatusResource.java b/eureka-core/src/main/java/com/netflix/eureka/resources/StatusResource.java index 70698d943..d222831f1 100644 --- a/eureka-core/src/main/java/com/netflix/eureka/resources/StatusResource.java +++ b/eureka-core/src/main/java/com/netflix/eureka/resources/StatusResource.java @@ -16,7 +16,7 @@ package com.netflix.eureka.resources; -import javax.inject.Inject; +import com.google.inject.Inject; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; diff --git a/eureka-core/src/main/java/com/netflix/eureka/resources/VIPResource.java b/eureka-core/src/main/java/com/netflix/eureka/resources/VIPResource.java index 2c69ccff9..c9d24a4d4 100644 --- a/eureka-core/src/main/java/com/netflix/eureka/resources/VIPResource.java +++ b/eureka-core/src/main/java/com/netflix/eureka/resources/VIPResource.java @@ -21,7 +21,7 @@ import com.netflix.eureka.EurekaServerContextHolder; import com.netflix.eureka.registry.Key; -import javax.inject.Inject; +import com.google.inject.Inject; import javax.ws.rs.GET; import javax.ws.rs.HeaderParam; import javax.ws.rs.Path; diff --git a/eureka-core/src/main/java/com/netflix/eureka/transport/JerseyRemoteRegionClientFactory.java b/eureka-core/src/main/java/com/netflix/eureka/transport/JerseyRemoteRegionClientFactory.java index 09de818fc..373764985 100644 --- a/eureka-core/src/main/java/com/netflix/eureka/transport/JerseyRemoteRegionClientFactory.java +++ b/eureka-core/src/main/java/com/netflix/eureka/transport/JerseyRemoteRegionClientFactory.java @@ -16,7 +16,7 @@ package com.netflix.eureka.transport; -import javax.inject.Inject; +import com.google.inject.Inject; import java.net.InetAddress; import java.net.UnknownHostException; import java.util.Collections; diff --git a/eureka-examples/src/main/java/com/netflix/eureka/ExampleServiceBase.java b/eureka-examples/src/main/java/com/netflix/eureka/ExampleServiceBase.java index c19babd3b..a28f569e4 100644 --- a/eureka-examples/src/main/java/com/netflix/eureka/ExampleServiceBase.java +++ b/eureka-examples/src/main/java/com/netflix/eureka/ExampleServiceBase.java @@ -7,8 +7,8 @@ import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; -import javax.inject.Inject; -import javax.inject.Singleton; +import com.google.inject.Inject; +import com.google.inject.Singleton; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; diff --git a/eureka-server-governator/build.gradle b/eureka-server-governator/build.gradle index 66101bebb..f8ad6c6bc 100644 --- a/eureka-server-governator/build.gradle +++ b/eureka-server-governator/build.gradle @@ -3,7 +3,7 @@ apply plugin: 'org.gretty' dependencies { compile project(':eureka-core') - compile project(':eureka-client') + compile project(':eureka-client-core') compile "com.netflix.governator:governator:${governatorVersion}" compile "com.netflix.governator:governator-servlet:${governatorVersion}" compile "com.sun.jersey:jersey-server:${jerseyVersion}" diff --git a/eureka-server/build.gradle b/eureka-server/build.gradle index 7cf551ee4..58cfe212e 100644 --- a/eureka-server/build.gradle +++ b/eureka-server/build.gradle @@ -1,7 +1,7 @@ apply plugin: 'war' dependencies { - compile project(':eureka-client') + compile project(':eureka-client-core') compile project(':eureka-core') compile "com.sun.jersey:jersey-server:$jerseyVersion" compile "com.sun.jersey:jersey-servlet:$jerseyVersion" diff --git a/settings.gradle b/settings.gradle index a001300d1..31f897112 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,6 +1,7 @@ rootProject.name='eureka' -include 'eureka-client', - 'eureka-client-jersey2', +include 'eureka-client-core', + 'eureka-client', + 'eureka-client-jersey2', 'eureka-client-archaius2', 'eureka-server', 'eureka-server-governator',