diff --git a/iep-admin/src/main/java/com/netflix/iep/admin/AdminServer.java b/iep-admin/src/main/java/com/netflix/iep/admin/AdminServer.java index 78c1a70b..31148432 100644 --- a/iep-admin/src/main/java/com/netflix/iep/admin/AdminServer.java +++ b/iep-admin/src/main/java/com/netflix/iep/admin/AdminServer.java @@ -82,26 +82,6 @@ private void createContext(String path, HttpHandler handler) { server.createContext(path, new AccessLogHandler(handler)); } - /** - * @deprecated This is a no-op, the server will be automatically started when it - * is constructed. - */ - @Deprecated - public void start() { - } - - /** - * @deprecated Use {@link #close()} instead. - */ - @Deprecated - public void stop() { - try { - close(); - } catch (Exception e) { - throw new RuntimeException("failed to stop AdminServer", e); - } - } - @Override public void close() throws Exception { LOGGER.info("shutting down admin on port {}", config.port()); server.stop((int) config.shutdownDelay().toMillis()); diff --git a/iep-admin/src/test/java/com/netflix/iep/admin/endpoints/SpectatorEndpointTest.java b/iep-admin/src/test/java/com/netflix/iep/admin/endpoints/SpectatorEndpointTest.java index d2029bab..2baf8a70 100644 --- a/iep-admin/src/test/java/com/netflix/iep/admin/endpoints/SpectatorEndpointTest.java +++ b/iep-admin/src/test/java/com/netflix/iep/admin/endpoints/SpectatorEndpointTest.java @@ -17,7 +17,6 @@ import com.netflix.spectator.api.DefaultRegistry; import com.netflix.spectator.api.Registry; -import com.netflix.spectator.api.patterns.PolledMeter; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; @@ -44,8 +43,7 @@ public SpectatorEndpointTest() { registry.distributionSummary("distSummary1", "a", "1").record(47); - registry.gauge("gauge1", 100.0); - PolledMeter.update(registry); + registry.gauge("gauge1").set(100.0); } @SuppressWarnings("unchecked") diff --git a/iep-config/src/main/java/com/netflix/iep/config/DynamicPropertiesConfiguration.java b/iep-config/src/main/java/com/netflix/iep/config/DynamicPropertiesConfiguration.java index b6692dca..2a7bd215 100644 --- a/iep-config/src/main/java/com/netflix/iep/config/DynamicPropertiesConfiguration.java +++ b/iep-config/src/main/java/com/netflix/iep/config/DynamicPropertiesConfiguration.java @@ -16,7 +16,7 @@ package com.netflix.iep.config; import com.netflix.archaius.api.Property; -import com.netflix.archaius.api.PropertyFactory; +import com.netflix.archaius.api.PropertyRepository; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; @@ -31,7 +31,7 @@ public class DynamicPropertiesConfiguration implements AutoCloseable { private final IConfiguration instance; @Inject - public DynamicPropertiesConfiguration(PropertyFactory factory) { + public DynamicPropertiesConfiguration(PropertyRepository factory) { instance = new DynamicPropertiesConfigurationInstance(factory); Configuration.setConfiguration(instance); } @@ -41,17 +41,17 @@ protected IConfiguration getInstance() { } protected class DynamicPropertiesConfigurationInstance implements IConfiguration { - private final PropertyFactory factory; + private final PropertyRepository factory; private final Map> props = new ConcurrentHashMap<>(); - protected DynamicPropertiesConfigurationInstance(PropertyFactory factory) { + protected DynamicPropertiesConfigurationInstance(PropertyRepository factory) { this.factory = factory; } public String get(String key) { Property prop = props.get(key); if (prop == null) { - prop = factory.getProperty(key).asString(null); + prop = factory.get(key, String.class).orElse(null); props.put(key, prop); } return prop.get(); diff --git a/iep-config/src/test/java/com/netflix/iep/config/ConfigurationTests.java b/iep-config/src/test/java/com/netflix/iep/config/ConfigurationTests.java index 7eb65c71..427a9898 100644 --- a/iep-config/src/test/java/com/netflix/iep/config/ConfigurationTests.java +++ b/iep-config/src/test/java/com/netflix/iep/config/ConfigurationTests.java @@ -23,7 +23,6 @@ import static org.junit.Assert.*; import com.netflix.archaius.DefaultPropertyFactory; -import com.netflix.archaius.api.PropertyFactory; import com.netflix.archaius.config.MapConfig; import org.junit.Test; @@ -75,7 +74,7 @@ interface TestConfig extends IConfiguration { private TestConfig mkConfig() { return mkConfig(new HashMap<>()); } private TestConfig mkConfig(Map props) { return mkConfig(null, props); } private TestConfig mkConfig(String prefix, Map props) { - PropertyFactory factory = new DefaultPropertyFactory(new MapConfig(props)); + DefaultPropertyFactory factory = new DefaultPropertyFactory(new MapConfig(props)); Configuration.setConfiguration(new DynamicPropertiesConfiguration(factory).getInstance()); return Configuration.newProxy(TestConfig.class, prefix); } diff --git a/iep-config/src/test/java/com/netflix/iep/config/PropertyFileConfigurationTests.java b/iep-config/src/test/java/com/netflix/iep/config/PropertyFileConfigurationTests.java index df2386c1..aeb4aa46 100644 --- a/iep-config/src/test/java/com/netflix/iep/config/PropertyFileConfigurationTests.java +++ b/iep-config/src/test/java/com/netflix/iep/config/PropertyFileConfigurationTests.java @@ -22,7 +22,6 @@ import com.netflix.archaius.DefaultPropertyFactory; import com.netflix.archaius.api.Config; -import com.netflix.archaius.api.PropertyFactory; import org.junit.BeforeClass; import org.junit.Test; @@ -59,7 +58,7 @@ public static void setUp() throws Exception { put("resources.url", "file://" + userDir + "/src/test/resources"); }}; Config config = TestResourceConfiguration.load("config.test.properties", subs); - PropertyFactory factory = new DefaultPropertyFactory(config); + DefaultPropertyFactory factory = new DefaultPropertyFactory(config); Configuration.setConfiguration(new DynamicPropertiesConfiguration(factory).getInstance()); } diff --git a/iep-module-admin/src/main/java/com/netflix/iep/admin/guice/AdminModule.java b/iep-module-admin/src/main/java/com/netflix/iep/admin/guice/AdminModule.java index e75ba9a0..92f9d9ea 100644 --- a/iep-module-admin/src/main/java/com/netflix/iep/admin/guice/AdminModule.java +++ b/iep-module-admin/src/main/java/com/netflix/iep/admin/guice/AdminModule.java @@ -159,12 +159,10 @@ private static class AdminServerProvider implements Provider { * quick local testing of the module and common endpoints. */ public static void main(String[] args) { - Injector injector = Guice.createInjector(new AdminModule(), new AbstractModule() { + Guice.createInjector(new AdminModule(), new AbstractModule() { @Override protected void configure() { bind(Registry.class).toInstance(new DefaultRegistry()); } }); - AdminServer server = injector.getInstance(AdminServer.class); - server.start(); } } diff --git a/iep-module-archaius2/src/main/java/com/netflix/iep/archaius2/OverrideModule.java b/iep-module-archaius2/src/main/java/com/netflix/iep/archaius2/OverrideModule.java index 133e036a..4a01755a 100644 --- a/iep-module-archaius2/src/main/java/com/netflix/iep/archaius2/OverrideModule.java +++ b/iep-module-archaius2/src/main/java/com/netflix/iep/archaius2/OverrideModule.java @@ -17,12 +17,13 @@ import com.google.inject.AbstractModule; import com.google.inject.Guice; -import com.google.inject.Injector; import com.google.inject.Module; import com.google.inject.util.Modules; import com.netflix.archaius.guice.ArchaiusModule; -import com.netflix.iep.admin.AdminServer; +import com.netflix.iep.admin.guice.AdminModule; import com.netflix.iep.platformservice.PlatformServiceModule; +import com.netflix.spectator.api.DefaultRegistry; +import com.netflix.spectator.api.Registry; /** * Work around for overriding the AppConfig. @@ -45,8 +46,10 @@ public final class OverrideModule extends AbstractModule { public static void main(String[] args) { System.setProperty("netflix.iep.archaius.use-dynamic", "false"); - Injector injector = Guice.createInjector(new OverrideModule()); - AdminServer server = injector.getInstance(AdminServer.class); - server.start(); + Guice.createInjector(new OverrideModule(), new AdminModule(), new AbstractModule() { + @Override protected void configure() { + bind(Registry.class).toInstance(new DefaultRegistry()); + } + }); } } diff --git a/iep-module-eureka/src/main/java/com/netflix/iep/eureka/EurekaModule.java b/iep-module-eureka/src/main/java/com/netflix/iep/eureka/EurekaModule.java index 3484474c..be10f5ea 100644 --- a/iep-module-eureka/src/main/java/com/netflix/iep/eureka/EurekaModule.java +++ b/iep-module-eureka/src/main/java/com/netflix/iep/eureka/EurekaModule.java @@ -18,7 +18,6 @@ import com.google.inject.AbstractModule; import com.google.inject.Guice; import com.google.inject.Inject; -import com.google.inject.Injector; import com.google.inject.Provides; import com.google.inject.multibindings.Multibinder; import com.netflix.appinfo.ApplicationInfoManager; @@ -32,7 +31,6 @@ import com.netflix.discovery.DiscoveryClient; import com.netflix.discovery.EurekaClientConfig; import com.netflix.discovery.shared.transport.jersey.Jersey1DiscoveryClientOptionalArgs; -import com.netflix.iep.admin.AdminServer; import com.netflix.iep.admin.guice.AdminModule; import com.netflix.iep.service.Service; import org.apache.commons.configuration.Configuration; @@ -107,8 +105,6 @@ private EurekaInstanceConfig provideInstanceConfig(OptionalInjections opts) { public static void main(String[] args) { System.setProperty("netflix.iep.archaius.use-dynamic", "false"); - Injector injector = Guice.createInjector(new EurekaModule()); - AdminServer server = injector.getInstance(AdminServer.class); - server.start(); + Guice.createInjector(new EurekaModule()); } } diff --git a/iep-ses/src/main/java/com/netflix/iep/ses/EmailRequestBuilder.java b/iep-ses/src/main/java/com/netflix/iep/ses/EmailRequestBuilder.java index f3bc7fe0..c94f01fa 100644 --- a/iep-ses/src/main/java/com/netflix/iep/ses/EmailRequestBuilder.java +++ b/iep-ses/src/main/java/com/netflix/iep/ses/EmailRequestBuilder.java @@ -94,20 +94,6 @@ EmailRequestBuilder withBoundary(String boundary) { return this; } - /** - * Set the source or from address of the message. If not specified, then it must be - * provided when constructing the {@code SendRawEmailRequest} object. - * - * @deprecated Use {@link #withFromAddress(String)} instead. Renamed to avoid confusion - * as this will set the {@code From} header in the message which behaves differently than - * calling {@code SendRawEmailRequest.withSource} when using sending authorization. Will - * be removed in 2.0. - */ - @Deprecated - public EmailRequestBuilder withSource(String source) { - return withFromAddress(source); - } - /** * Set the source or from address of the message. If not specified, then it must be * provided when constructing the {@code SendRawEmailRequest} object. diff --git a/iep-ses/src/test/java/com/netflix/iep/ses/EmailRequestBuilderTest.java b/iep-ses/src/test/java/com/netflix/iep/ses/EmailRequestBuilderTest.java index bf4c78b5..360a0a80 100644 --- a/iep-ses/src/test/java/com/netflix/iep/ses/EmailRequestBuilderTest.java +++ b/iep-ses/src/test/java/com/netflix/iep/ses/EmailRequestBuilderTest.java @@ -36,16 +36,16 @@ @RunWith(JUnit4.class) public class EmailRequestBuilderTest { - private static boolean BLESS = false; - private static boolean SEND = false; + private static final boolean BLESS = false; + private static final boolean SEND = false; - private static String FROM = "bob@example.com"; - private static String TO = "andrew@example.com"; - private static String CC = "sue@example.com"; + private static final String FROM = "bob@example.com"; + private static final String TO = "andrew@example.com"; + private static final String CC = "sue@example.com"; - private static String FROM_ARN = "arn:aws:ses:us-east-1:123456789012:identity/example.com"; + private static final String FROM_ARN = "arn:aws:ses:us-east-1:123456789012:identity/example.com"; - private static String BOUNDARY = "331239ab-8a31-4cc6-84d6-5557f96ebc3a"; + private static final String BOUNDARY = "331239ab-8a31-4cc6-84d6-5557f96ebc3a"; private void writeResource(String name, byte[] data) throws IOException { // Path ends with: iep-ses/target/test-classes/des-example.png @@ -94,15 +94,6 @@ private void checkMessage(String name, EmailRequestBuilder builder) throws IOExc } } - @Test - public void simpleTextMessageSource() throws IOException { - checkMessage("simpleTextMessage", new EmailRequestBuilder() - .withSource(FROM) - .withToAddresses(TO) - .withSubject("Test message") - .withTextBody("Body of the email message.")); - } - @Test public void simpleTextMessage() throws IOException { checkMessage("simpleTextMessage", new EmailRequestBuilder()