Skip to content

Commit

Permalink
apply spotless
Browse files Browse the repository at this point in the history
  • Loading branch information
lony2003 committed May 31, 2024
1 parent f4a5308 commit 58c4703
Show file tree
Hide file tree
Showing 13 changed files with 92 additions and 81 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,18 @@

package icu.fangkehou.dapr.client.config;

import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.DeprecatedConfigurationProperty;
import org.springframework.boot.convert.DurationUnit;

import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.time.Duration;
import java.time.temporal.ChronoUnit;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.DeprecatedConfigurationProperty;
import org.springframework.boot.convert.DurationUnit;

import lombok.EqualsAndHashCode;
import lombok.ToString;

/**
* The properties for creating dapr client.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,20 @@

package icu.fangkehou.dapr.client.test;

import icu.fangkehou.dapr.client.config.DaprClientConfig;
import io.dapr.client.DaprClient;
import static org.junit.jupiter.api.Assertions.assertEquals;

import java.nio.charset.StandardCharsets;
import java.time.Duration;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.test.context.junit.jupiter.SpringExtension;

import java.nio.charset.StandardCharsets;
import java.time.Duration;

import static org.junit.jupiter.api.Assertions.assertEquals;
import icu.fangkehou.dapr.client.config.DaprClientConfig;
import io.dapr.client.DaprClient;

@SpringBootTest(properties = {
"dapr.client.sidecar-ip=102.102.102.102",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@

package icu.fangkehou.dapr.client.test;

import icu.fangkehou.dapr.client.config.DaprClientConfig;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties;

import icu.fangkehou.dapr.client.config.DaprClientConfig;

/**
* Dummy config - because Spring needs one.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class DaprClientSecretStoreConfigManager {
private final DaprClientConfig daprClientConfig;

public DaprClientSecretStoreConfigManager(DaprSecretStoreConfig daprSecretStoreConfig,
DaprClientConfig daprClientConfig) {
DaprClientConfig daprClientConfig) {
this.daprSecretStoreConfig = daprSecretStoreConfig;
this.daprClientConfig = daprClientConfig;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@

package icu.fangkehou.dapr.secretstore.config;

import org.springframework.boot.context.properties.ConfigurationProperties;

import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.springframework.boot.context.properties.ConfigurationProperties;

/**
* The properties for creating dapr client.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,7 @@

package icu.fangkehou.dapr.secretstore.configdata;

import icu.fangkehou.dapr.secretstore.config.DaprClientSecretStoreConfigManager;
import icu.fangkehou.dapr.secretstore.config.DaprSecretStoreConfig;
import icu.fangkehou.dapr.secretstore.parser.DaprSecretStoreParserHandler;
import io.dapr.client.DaprClient;
import org.apache.commons.logging.Log;
import org.springframework.boot.context.config.ConfigData;
import org.springframework.boot.context.config.ConfigDataLoader;
import org.springframework.boot.context.config.ConfigDataLoaderContext;
import org.springframework.boot.context.config.ConfigDataResourceNotFoundException;
import org.springframework.boot.logging.DeferredLogFactory;
import org.springframework.core.env.PropertySource;
import reactor.core.publisher.Mono;
import static org.springframework.boot.context.config.ConfigData.Option.*;

import java.io.IOException;
import java.time.Duration;
Expand All @@ -36,7 +25,19 @@
import java.util.List;
import java.util.Map;

import static org.springframework.boot.context.config.ConfigData.Option.*;
import org.apache.commons.logging.Log;
import org.springframework.boot.context.config.ConfigData;
import org.springframework.boot.context.config.ConfigDataLoader;
import org.springframework.boot.context.config.ConfigDataLoaderContext;
import org.springframework.boot.context.config.ConfigDataResourceNotFoundException;
import org.springframework.boot.logging.DeferredLogFactory;
import org.springframework.core.env.PropertySource;

import icu.fangkehou.dapr.secretstore.config.DaprClientSecretStoreConfigManager;
import icu.fangkehou.dapr.secretstore.config.DaprSecretStoreConfig;
import icu.fangkehou.dapr.secretstore.parser.DaprSecretStoreParserHandler;
import io.dapr.client.DaprClient;
import reactor.core.publisher.Mono;

public class DaprSecretStoreConfigDataLoader implements ConfigDataLoader<DaprSecretStoreConfigDataResource> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

package icu.fangkehou.dapr.secretstore.configdata;

import icu.fangkehou.dapr.client.config.DaprClientConfig;
import icu.fangkehou.dapr.secretstore.config.DaprClientSecretStoreConfigManager;
import icu.fangkehou.dapr.secretstore.config.DaprSecretStoreConfig;
import java.util.ArrayList;
import java.util.List;

import org.apache.commons.logging.Log;
import org.springframework.boot.BootstrapRegistry;
import org.springframework.boot.ConfigurableBootstrapContext;
Expand All @@ -29,8 +29,9 @@
import org.springframework.boot.logging.DeferredLogFactory;
import org.springframework.core.Ordered;

import java.util.ArrayList;
import java.util.List;
import icu.fangkehou.dapr.client.config.DaprClientConfig;
import icu.fangkehou.dapr.secretstore.config.DaprClientSecretStoreConfigManager;
import icu.fangkehou.dapr.secretstore.config.DaprSecretStoreConfig;

public class DaprSecretStoreConfigDataLocationResolver
implements ConfigDataLocationResolver<DaprSecretStoreConfigDataResource>, Ordered {
Expand Down Expand Up @@ -110,8 +111,8 @@ public int getOrder() {
}

private void registerConfigManager(DaprSecretStoreConfig properties,
DaprClientConfig clientConfig,
ConfigurableBootstrapContext bootstrapContext) {
DaprClientConfig clientConfig,
ConfigurableBootstrapContext bootstrapContext) {
if (!bootstrapContext.isRegistered(DaprClientSecretStoreConfigManager.class)) {
bootstrapContext.register(DaprClientSecretStoreConfigManager.class,
BootstrapRegistry.InstanceSupplier
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@

package icu.fangkehou.dapr.feign;

import static java.nio.charset.StandardCharsets.UTF_8;

import java.io.*;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.charset.Charset;
import java.time.Duration;
import java.util.*;
import java.util.concurrent.TimeUnit;

import feign.Client;
import feign.Request;
import feign.Response;
Expand All @@ -28,16 +38,6 @@
import io.dapr.utils.TypeRef;
import reactor.core.publisher.Mono;

import java.io.*;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.charset.Charset;
import java.time.Duration;
import java.util.*;
import java.util.concurrent.TimeUnit;

import static java.nio.charset.StandardCharsets.UTF_8;

/**
* This module directs Feign's requests to <a href="https://dapr.io/">Dapr</a>, which is a microservice framework. Ex.
* <p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,23 @@
package icu.fangkehou.dapr.feign;


import static org.junit.jupiter.api.Assertions.assertEquals;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.junit.jupiter.MockitoExtension;

import feign.Feign;
import feign.Headers;
import feign.RequestLine;
import feign.Response;
import io.dapr.client.DaprClient;
import io.dapr.client.domain.InvokeBindingRequest;
import io.dapr.utils.TypeRef;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.junit.jupiter.MockitoExtension;
import reactor.core.publisher.Mono;

import static org.junit.jupiter.api.Assertions.assertEquals;

@ExtendWith(MockitoExtension.class)
public class DaprFeignClientBindingTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,25 @@
package icu.fangkehou.dapr.feign;


import static org.junit.jupiter.api.Assertions.assertEquals;

import java.nio.charset.StandardCharsets;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.junit.jupiter.MockitoExtension;

import feign.Feign;
import feign.Headers;
import feign.RequestLine;
import feign.Response;
import io.dapr.client.DaprClient;
import io.dapr.client.domain.InvokeMethodRequest;
import io.dapr.utils.TypeRef;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.junit.jupiter.MockitoExtension;
import reactor.core.publisher.Mono;

import java.nio.charset.StandardCharsets;

import static org.junit.jupiter.api.Assertions.assertEquals;

@ExtendWith(MockitoExtension.class)
public class DaprFeignClientMethodTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@

package icu.fangkehou.test.daprtest.feign;

import icu.fangkehou.dapr.feign.annotation.UseDaprClient;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;

import icu.fangkehou.dapr.feign.annotation.UseDaprClient;

@FeignClient(name = "dapr", url = "method.myApp")
@UseDaprClient
public interface DaprFeignTestClient {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@

package icu.fangkehou.test.daprtest;

import icu.fangkehou.dapr.secretstore.config.DaprClientSecretStoreConfigManager;
import icu.fangkehou.test.daprtest.feign.DaprFeignTestClient;
import io.dapr.client.DaprClient;
import io.dapr.client.domain.InvokeMethodRequest;
import io.dapr.utils.TypeRef;
import static org.junit.jupiter.api.Assertions.assertEquals;

import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mockito;
Expand All @@ -30,13 +31,13 @@
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.test.util.ReflectionTestUtils;
import reactor.core.publisher.Mono;

import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;

import static org.junit.jupiter.api.Assertions.assertEquals;
import icu.fangkehou.dapr.secretstore.config.DaprClientSecretStoreConfigManager;
import icu.fangkehou.test.daprtest.feign.DaprFeignTestClient;
import io.dapr.client.DaprClient;
import io.dapr.client.domain.InvokeMethodRequest;
import io.dapr.utils.TypeRef;
import reactor.core.publisher.Mono;

@SpringBootTest
@ExtendWith({SpringExtension.class, MockitoExtension.class})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@

package icu.fangkehou.test.daprtest;

import icu.fangkehou.dapr.secretstore.config.DaprClientSecretStoreConfigManager;
import icu.fangkehou.test.daprtest.config.DaprSecretConfigTest;
import io.dapr.client.DaprClient;
import static org.junit.jupiter.api.Assertions.assertEquals;

import java.util.HashMap;
import java.util.Map;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mockito;
Expand All @@ -28,12 +30,11 @@
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.test.util.ReflectionTestUtils;
import reactor.core.publisher.Mono;

import java.util.HashMap;
import java.util.Map;

import static org.junit.jupiter.api.Assertions.assertEquals;
import icu.fangkehou.dapr.secretstore.config.DaprClientSecretStoreConfigManager;
import icu.fangkehou.test.daprtest.config.DaprSecretConfigTest;
import io.dapr.client.DaprClient;
import reactor.core.publisher.Mono;

@SpringBootTest(properties = {
"spring.config.import=dapr:secret:mysecret",
Expand Down

0 comments on commit 58c4703

Please sign in to comment.