From db77297fa1db5879dcedad77b12c2a2ba3015b9e Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Thu, 10 May 2018 20:19:35 +0300 Subject: [PATCH 1/2] update charset class --- .../org/baeldung/httpclient/sec/HttpClientAuthLiveTest.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/httpclient/src/test/java/org/baeldung/httpclient/sec/HttpClientAuthLiveTest.java b/httpclient/src/test/java/org/baeldung/httpclient/sec/HttpClientAuthLiveTest.java index 7a75729ea5..c9956e5852 100644 --- a/httpclient/src/test/java/org/baeldung/httpclient/sec/HttpClientAuthLiveTest.java +++ b/httpclient/src/test/java/org/baeldung/httpclient/sec/HttpClientAuthLiveTest.java @@ -24,6 +24,7 @@ import org.junit.Test; import java.io.IOException; import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; import static org.hamcrest.Matchers.equalTo; import static org.junit.Assert.assertThat; @@ -89,7 +90,7 @@ public class HttpClientAuthLiveTest { public final void givenAuthorizationHeaderIsSetManually_whenExecutingGetRequest_thenSuccess2() throws IOException { final HttpGet request = new HttpGet(URL_SECURED_BY_BASIC_AUTHENTICATION); final String auth = DEFAULT_USER + ":" + DEFAULT_PASS; - final byte[] encodedAuth = Base64.encodeBase64(auth.getBytes(Charset.forName("ISO-8859-1"))); + final byte[] encodedAuth = Base64.encodeBase64(auth.getBytes(StandardCharsets.ISO_8859_1)); final String authHeader = "Basic " + new String(encodedAuth); request.setHeader(HttpHeaders.AUTHORIZATION, authHeader); @@ -129,7 +130,7 @@ public class HttpClientAuthLiveTest { private String authorizationHeader(final String username, final String password) { final String auth = username + ":" + password; - final byte[] encodedAuth = Base64.encodeBase64(auth.getBytes(Charset.forName("ISO-8859-1"))); + final byte[] encodedAuth = Base64.encodeBase64(auth.getBytes(StandardCharsets.ISO_8859_1)); return "Basic " + new String(encodedAuth); } From 6fdd23bd3d8fbfcaa263d4279ef6c8c597b657b1 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Thu, 10 May 2018 21:08:56 +0300 Subject: [PATCH 2/2] fix boot project --- .../boot/monitor/jmx/MonitoringConfig.java | 21 ------------------- spring-boot/src/test/resources/data.sql | 5 ----- spring-boot/src/test/resources/schema.sql | 5 ----- 3 files changed, 31 deletions(-) delete mode 100644 spring-boot/src/main/java/org/baeldung/boot/monitor/jmx/MonitoringConfig.java delete mode 100644 spring-boot/src/test/resources/data.sql delete mode 100644 spring-boot/src/test/resources/schema.sql diff --git a/spring-boot/src/main/java/org/baeldung/boot/monitor/jmx/MonitoringConfig.java b/spring-boot/src/main/java/org/baeldung/boot/monitor/jmx/MonitoringConfig.java deleted file mode 100644 index 28c6ac5953..0000000000 --- a/spring-boot/src/main/java/org/baeldung/boot/monitor/jmx/MonitoringConfig.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.baeldung.boot.monitor.jmx; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -import com.codahale.metrics.JmxReporter; -import com.codahale.metrics.MetricRegistry; - -@Configuration -public class MonitoringConfig { - @Autowired - private MetricRegistry registry; - - @Bean - public JmxReporter jmxReporter() { - JmxReporter reporter = JmxReporter.forRegistry(registry).build(); - reporter.start(); - return reporter; - } -} diff --git a/spring-boot/src/test/resources/data.sql b/spring-boot/src/test/resources/data.sql deleted file mode 100644 index f36e034ce1..0000000000 --- a/spring-boot/src/test/resources/data.sql +++ /dev/null @@ -1,5 +0,0 @@ -INSERT INTO country (name) VALUES ('India'); -INSERT INTO country (name) VALUES ('Brazil'); -INSERT INTO country (name) VALUES ('USA'); -INSERT INTO country (name) VALUES ('Italy'); -COMMIT; diff --git a/spring-boot/src/test/resources/schema.sql b/spring-boot/src/test/resources/schema.sql deleted file mode 100644 index 15d7788cd7..0000000000 --- a/spring-boot/src/test/resources/schema.sql +++ /dev/null @@ -1,5 +0,0 @@ -CREATE TABLE country ( - id INTEGER NOT NULL AUTO_INCREMENT, - name VARCHAR(128) NOT NULL, - PRIMARY KEY (id) -);