1
0
mirror of https://gitee.com/mirrors/Spring-Cloud-Alibaba.git synced 2021-06-26 13:25:11 +08:00

format code with maven plugins

This commit is contained in:
fangjian0423
2019-09-26 17:15:41 +08:00
parent ed6942d9df
commit 2435167e1e
529 changed files with 6304 additions and 5164 deletions

View File

@@ -1,11 +1,11 @@
/*
* Copyright (C) 2018 the original author or authors.
* Copyright 2013-2018 the original author or authors.
*
* 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
* https://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,
@@ -16,11 +16,13 @@
package com.alibaba.alicloud.ans.ribbon;
import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;
import com.alibaba.alicloud.ans.AnsAutoConfiguration;
import com.alibaba.alicloud.ans.AnsDiscoveryClientAutoConfiguration;
import com.netflix.client.config.DefaultClientConfigImpl;
import com.netflix.client.config.IClientConfig;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
@@ -32,21 +34,19 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.web.client.RestTemplate;
import com.alibaba.alicloud.ans.AnsAutoConfiguration;
import com.alibaba.alicloud.ans.AnsDiscoveryClientAutoConfiguration;
import com.netflix.client.config.DefaultClientConfigImpl;
import com.netflix.client.config.IClientConfig;
import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;
/**
* @author xiaojing
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = AnsRibbonClientConfigurationTests.TestConfig.class, properties = {
"spring.application.name=myTestService1",
"spring.cloud.alicloud.ans.server-list=127.0.0.1",
"spring.cloud.alicloud.ans.server-port=8080",
"spring.cloud.alicloud.ans.endpoint=test-endpoint" }, webEnvironment = RANDOM_PORT)
@SpringBootTest(classes = AnsRibbonClientConfigurationTests.TestConfig.class,
properties = { "spring.application.name=myTestService1",
"spring.cloud.alicloud.ans.server-list=127.0.0.1",
"spring.cloud.alicloud.ans.server-port=8080",
"spring.cloud.alicloud.ans.endpoint=test-endpoint" },
webEnvironment = RANDOM_PORT)
public class AnsRibbonClientConfigurationTests {
@Autowired
@@ -82,6 +82,7 @@ public class AnsRibbonClientConfigurationTests {
AnsRibbonTestConfiguration.class, RibbonAnsAutoConfiguration.class,
AnsRibbonClientConfiguration.class })
public static class TestConfig {
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright (C) 2018 the original author or authors.
* Copyright 2013-2018 the original author or authors.
*
* 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
* https://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,
@@ -16,18 +16,16 @@
package com.alibaba.alicloud.ans.ribbon;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.stream.Collectors;
import com.alibaba.alicloud.ans.test.AnsMockTest;
import com.alibaba.ans.core.NamingService;
import com.alibaba.ans.shaded.com.taobao.vipserver.client.core.Host;
import com.netflix.client.config.IClientConfig;
import org.assertj.core.api.Assertions;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -35,11 +33,11 @@ import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.alibaba.alicloud.ans.test.AnsMockTest;
import com.alibaba.ans.core.NamingService;
import com.alibaba.ans.shaded.com.taobao.vipserver.client.core.Host;
import com.netflix.client.config.IClientConfig;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
/**
* @author xiaojing
@@ -139,4 +137,5 @@ public class AnsServerListTests {
assertThat(servers.get(0).getHealthService().isValid()).isEqualTo(true);
}
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright (C) 2018 the original author or authors.
* Copyright 2013-2018 the original author or authors.
*
* 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
* https://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,
@@ -16,20 +16,16 @@
package com.alibaba.alicloud.ans.ribbon;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
import java.util.Arrays;
import java.util.List;
import com.alibaba.ans.shaded.com.taobao.vipserver.client.core.Host;
import com.netflix.loadbalancer.Server;
import org.junit.Test;
import com.alibaba.ans.shaded.com.taobao.vipserver.client.core.Host;
import com.netflix.loadbalancer.Server;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
/**
* @author xiaolongzuo
@@ -44,19 +40,18 @@ public class AnsServiceListTests {
public void testAnsServer() {
AnsServerList serverList = getAnsServerList();
List<AnsServer> servers = serverList.getInitialListOfServers();
assertNotNull("servers was null", servers);
assertEquals("servers was not size 1", 1, servers.size());
assertThat(servers).isNotNull();
assertThat(servers.size()).isEqualTo(1);
Server des = assertAnsServer(servers);
assertEquals("hostPort was wrong", IP_ADDR + ":" + PORT, des.getHostPort());
assertThat(des.getHostPort()).isEqualTo(IP_ADDR + ":" + PORT);
}
protected Server assertAnsServer(List<AnsServer> servers) {
Server actualServer = servers.get(0);
assertTrue("server was not a DomainExtractingServer",
actualServer instanceof AnsServer);
assertThat(actualServer instanceof AnsServer).isEqualTo(Boolean.TRUE);
AnsServer des = AnsServer.class.cast(actualServer);
assertNotNull("host is null", des.getHealthService());
assertEquals("unit was wrong", "DEFAULT", des.getHealthService().getUnit());
assertThat(des.getHealthService()).isNotNull();
assertThat(des.getHealthService().getUnit()).isEqualTo("DEFAULT");
return des;
}