remove guava
This commit is contained in:
@@ -51,10 +51,6 @@
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ package org.springframework.cloud.consul.client;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.type.TypeFactory;
|
||||
import com.google.common.base.Throwables;
|
||||
import feign.Param;
|
||||
import feign.Response;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -16,6 +15,7 @@ import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import static org.springframework.util.ReflectionUtils.rethrowRuntimeException;
|
||||
/**
|
||||
* @author Spencer Gibb
|
||||
*/
|
||||
@@ -105,7 +105,7 @@ public class EventService {
|
||||
return objectMapper.readValue(response.body().asInputStream(),
|
||||
TypeFactory.defaultInstance().constructCollectionType(ArrayList.class, Event.class));
|
||||
} catch (IOException e) {
|
||||
Throwables.propagate(e);
|
||||
rethrowRuntimeException(e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -4,9 +4,7 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import static com.google.common.base.Charsets.UTF_8;
|
||||
import static com.google.common.base.MoreObjects.toStringHelper;
|
||||
import static com.google.common.io.BaseEncoding.base64;
|
||||
import static org.springframework.util.Base64Utils.*;
|
||||
|
||||
/**
|
||||
* @author Spencer Gibb
|
||||
@@ -50,21 +48,22 @@ public class Event {
|
||||
public String getDecoded() {
|
||||
if (payload == null)
|
||||
return null;
|
||||
return new String(base64().decode(payload), UTF_8);
|
||||
return new String(decodeFromString(payload));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return toStringHelper(this)
|
||||
.add("id", id)
|
||||
.add("name", name)
|
||||
.add("nodeFilter", nodeFilter)
|
||||
.add("serviceFilter", serviceFilter)
|
||||
.add("tagFilter", tagFilter)
|
||||
.add("version", version)
|
||||
.add("lTime", lTime)
|
||||
.add("payload", payload)
|
||||
.add("decodedPayload", getDecoded())
|
||||
.toString();
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuffer sb = new StringBuffer("Event{");
|
||||
sb.append("id='").append(id).append('\'');
|
||||
sb.append(", name='").append(name).append('\'');
|
||||
sb.append(", nodeFilter='").append(nodeFilter).append('\'');
|
||||
sb.append(", serviceFilter='").append(serviceFilter).append('\'');
|
||||
sb.append(", tagFilter='").append(tagFilter).append('\'');
|
||||
sb.append(", version=").append(version);
|
||||
sb.append(", lTime=").append(lTime);
|
||||
sb.append(", payload='").append(payload).append('\'');
|
||||
sb.append(", decoded='").append(getDecoded()).append('\'');
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,9 +3,7 @@ package org.springframework.cloud.consul.model;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import static com.google.common.base.Charsets.UTF_8;
|
||||
import static com.google.common.base.MoreObjects.toStringHelper;
|
||||
import static com.google.common.io.BaseEncoding.base64;
|
||||
import static org.springframework.util.Base64Utils.*;
|
||||
|
||||
/**
|
||||
* @author Spencer Gibb
|
||||
@@ -31,22 +29,7 @@ public class KeyValue {
|
||||
public String getDecoded() {
|
||||
if (value == null)
|
||||
return null;
|
||||
return new String(base64().decode(value), UTF_8);
|
||||
return new String(decodeFromString(value));
|
||||
}
|
||||
|
||||
public void setUnencoded(String unencoded) {
|
||||
setValue(base64().encode(unencoded.getBytes(UTF_8)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return toStringHelper(this)
|
||||
.add("key", key)
|
||||
.add("value", value)
|
||||
.add("decodedValue", getDecoded())
|
||||
.add("createIndex", createIndex)
|
||||
.add("modifyIndex", modifyIndex)
|
||||
.add("flags", flags)
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package org.springframework.cloud.consul.client;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import org.junit.FixMethodOrder;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -11,6 +10,7 @@ import org.springframework.cloud.consul.model.Check;
|
||||
import org.springframework.cloud.consul.model.Service;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
@@ -34,7 +34,7 @@ public class AgentClientIT {
|
||||
service.setId("test1id");
|
||||
service.setName("test1Name");
|
||||
service.setPort(9999);
|
||||
service.setTags(Lists.newArrayList("test1tag1", "test1tag2"));
|
||||
service.setTags(Arrays.asList("test1tag1", "test1tag2"));
|
||||
Check check = new Check();
|
||||
check.setScript("/usr/local/bin/gtrue");
|
||||
check.setInterval(60);
|
||||
|
||||
Reference in New Issue
Block a user