Skip to content

Commit e115562

Browse files
committed
Fix after code review - add license notice, reformat imports, edit docs.
1 parent ae2bba4 commit e115562

File tree

8 files changed

+117
-20
lines changed

8 files changed

+117
-20
lines changed

docs/src/main/asciidoc/spring-cloud-commons.adoc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,8 @@ To disable the description field of the `DiscoveryClientHealthIndicator`, set `s
255255
Otherwise, it can bubble up as the `description` of the rolled up `HealthIndicator`.
256256

257257
==== Ordering `DiscoveryClient` instances
258-
`DiscoveryClient` interface extends `Ordered` to let you define the order of the returned discovery clients, similar to
258+
`DiscoveryClient` interface extends `Ordered`. This is useful when using multiple discovery
259+
clients, as it allows you to define the order of the returned discovery clients, similar to
259260
how you can order the beans loaded by a Spring application. By default, the order of any `DiscoveryClient` is set to
260261
`0`. If you want to set a different order for your custom `DiscoveryClient` implementations, you just need to override
261262
the `getOrder()` method so that it returns the value that is suitable for your setup. Apart from this, you can use

spring-cloud-commons/src/main/java/org/springframework/cloud/client/discovery/DiscoveryClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2013-2015 the original author or authors.
2+
* Copyright 2013-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

spring-cloud-commons/src/main/java/org/springframework/cloud/client/discovery/composite/CompositeDiscoveryClient.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
* Copyright 2018 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
package org.springframework.cloud.client.discovery.composite;
218

319
import java.util.ArrayList;

spring-cloud-commons/src/main/java/org/springframework/cloud/client/discovery/simple/SimpleDiscoveryClient.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
* Copyright 2018 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
package org.springframework.cloud.client.discovery.simple;
218

319
import java.util.ArrayList;

spring-cloud-commons/src/main/java/org/springframework/cloud/client/discovery/simple/SimpleDiscoveryProperties.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
* Copyright 2018 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
package org.springframework.cloud.client.discovery.simple;
218

319
import java.net.URI;

spring-cloud-commons/src/test/java/org/springframework/cloud/client/discovery/composite/CompositeDiscoveryClientOrderTest.java

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
1-
package org.springframework.cloud.client.discovery.composite;
1+
/*
2+
* Copyright 2018 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
216

3-
import static org.assertj.core.api.Assertions.assertThat;
4-
import static org.springframework.cloud.client.discovery.composite.CompositeDiscoveryClientTestsConfig.CUSTOM_DISCOVERY_CLIENT;
5-
import static org.springframework.cloud.client.discovery.composite.CompositeDiscoveryClientTestsConfig.CUSTOM_SERVICE_ID;
6-
import static org.springframework.cloud.client.discovery.composite.CompositeDiscoveryClientTestsConfig.DEFAULT_ORDER_DISCOVERY_CLIENT;
7-
import static org.springframework.cloud.client.discovery.composite.CompositeDiscoveryClientTestsConfig.FOURTH_DISCOVERY_CLIENT;
17+
package org.springframework.cloud.client.discovery.composite;
818

919
import java.util.List;
1020

@@ -17,14 +27,20 @@
1727
import org.springframework.cloud.client.discovery.DiscoveryClient;
1828
import org.springframework.test.context.junit4.SpringRunner;
1929

30+
import static org.assertj.core.api.Assertions.assertThat;
31+
import static org.springframework.cloud.client.discovery.composite.CompositeDiscoveryClientTestsConfig.CUSTOM_DISCOVERY_CLIENT;
32+
import static org.springframework.cloud.client.discovery.composite.CompositeDiscoveryClientTestsConfig.CUSTOM_SERVICE_ID;
33+
import static org.springframework.cloud.client.discovery.composite.CompositeDiscoveryClientTestsConfig.DEFAULT_ORDER_DISCOVERY_CLIENT;
34+
import static org.springframework.cloud.client.discovery.composite.CompositeDiscoveryClientTestsConfig.FOURTH_DISCOVERY_CLIENT;
35+
2036
/**
2137
* Tests for the support of ordered {@link DiscoveryClient} instances in {@link CompositeDiscoveryClient}
2238
*
2339
* @author Olga Maciaszek-Sharma
2440
*/
2541
@RunWith(SpringRunner.class)
2642
@SpringBootTest(properties = "spring.cloud.discovery.client.simple.order:2", classes = {
27-
CompositeDiscoveryClientTestsConfig.class })
43+
CompositeDiscoveryClientTestsConfig.class})
2844
public class CompositeDiscoveryClientOrderTest {
2945

3046
@Autowired

spring-cloud-commons/src/test/java/org/springframework/cloud/client/discovery/composite/CompositeDiscoveryClientTests.java

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,20 @@
1-
package org.springframework.cloud.client.discovery.composite;
1+
/*
2+
* Copyright 2018 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
216

3-
import static org.assertj.core.api.Assertions.assertThat;
4-
import static org.springframework.cloud.client.discovery.composite.CompositeDiscoveryClientTestsConfig.CUSTOM_SERVICE_ID;
17+
package org.springframework.cloud.client.discovery.composite;
518

619
import java.net.URI;
720

@@ -14,9 +27,12 @@
1427
import org.springframework.cloud.client.discovery.DiscoveryClient;
1528
import org.springframework.test.context.junit4.SpringRunner;
1629

30+
import static org.assertj.core.api.Assertions.assertThat;
31+
import static org.springframework.cloud.client.discovery.composite.CompositeDiscoveryClientTestsConfig.CUSTOM_SERVICE_ID;
32+
1733
/**
1834
* Tests for behavior of Composite Discovery Client
19-
*
35+
*
2036
* @author Biju Kunjummen
2137
*/
2238

@@ -26,8 +42,8 @@
2642
"spring.cloud.discovery.client.simple.instances.service1[0].uri=http://s1-1:8080",
2743
"spring.cloud.discovery.client.simple.instances.service1[1].uri=https://s1-2:8443",
2844
"spring.cloud.discovery.client.simple.instances.service2[0].uri=https://s2-1:8080",
29-
"spring.cloud.discovery.client.simple.instances.service2[1].uri=https://s2-2:443", }, classes = {
30-
CompositeDiscoveryClientTestsConfig.class })
45+
"spring.cloud.discovery.client.simple.instances.service2[1].uri=https://s2-2:443",}, classes = {
46+
CompositeDiscoveryClientTestsConfig.class})
3147
public class CompositeDiscoveryClientTests {
3248

3349
@Autowired
@@ -45,17 +61,17 @@ public void getInstancesByServiceIdShouldDelegateCall() {
4561
assertThat(s1.getUri()).isEqualTo(URI.create("http://s1-1:8080"));
4662
assertThat(s1.isSecure()).isEqualTo(false);
4763
}
48-
64+
4965
@Test
5066
public void getServicesShouldAggregateAllServiceNames() {
5167
assertThat(this.discoveryClient.getServices()).containsOnlyOnce("service1", "service2", "custom");
5268
}
53-
69+
5470
@Test
5571
public void getDescriptionShouldBeComposite() {
5672
assertThat(this.discoveryClient.description()).isEqualTo("Composite Discovery Client");
5773
}
58-
74+
5975
@Test
6076
public void getInstancesShouldRespectOrder() {
6177
assertThat(this.discoveryClient.getInstances(CUSTOM_SERVICE_ID)).hasSize(1);

spring-cloud-commons/src/test/java/org/springframework/cloud/client/discovery/composite/CompositeDiscoveryClientTestsConfig.java

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
1-
package org.springframework.cloud.client.discovery.composite;
1+
/*
2+
* Copyright 2018 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
216

3-
import static java.util.Collections.singletonList;
17+
package org.springframework.cloud.client.discovery.composite;
418

519
import java.util.Collections;
620
import java.util.List;
@@ -12,6 +26,8 @@
1226
import org.springframework.context.annotation.Bean;
1327
import org.springframework.context.annotation.Configuration;
1428

29+
import static java.util.Collections.singletonList;
30+
1531
/**
1632
* Test configuration for {@link CompositeDiscoveryClient} tests.
1733
*

0 commit comments

Comments
 (0)