Skip to content

Commit ce09990

Browse files
dszczukockipivovarit
authored andcommitted
BAEL-1931 rename SampleService to SampleClient (eugenp#6682)
* BAEL-1931 rename SampleService to SampleClient * remove not null assertion * remove fixed method order * disable usage of local kerberos ticket cache
1 parent 7fc7e61 commit ce09990

File tree

3 files changed

+11
-13
lines changed

3 files changed

+11
-13
lines changed

spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/client/KerberosClientApp.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ class KerberosClientApp {
1212
System.setProperty("java.security.krb5.conf",
1313
Paths.get(".\\krb-test-workdir\\krb5.conf").normalize().toAbsolutePath().toString());
1414
System.setProperty("sun.security.krb5.debug", "true");
15+
// disable usage of local kerberos ticket cache
16+
System.setProperty("http.use.global.creds", "false");
1517
}
1618

1719
public static void main(String[] args) {

spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/client/SampleService.java renamed to spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/client/SampleClient.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
import org.springframework.web.client.RestTemplate;
66

77
@Service
8-
class SampleService {
8+
class SampleClient {
99

1010
@Value("${app.access-url}")
1111
private String endpoint;
1212

1313
private RestTemplate restTemplate;
1414

15-
public SampleService(RestTemplate restTemplate) {
15+
public SampleClient(RestTemplate restTemplate) {
1616
this.restTemplate = restTemplate;
1717
}
1818

spring-security-sso/spring-security-sso-kerberos/src/test/java/kerberos/client/SampleServiceManualTest.java renamed to spring-security-sso/spring-security-sso-kerberos/src/test/java/kerberos/client/SampleClientManualTest.java

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package kerberos.client;
22

3-
import org.junit.FixMethodOrder;
43
import org.junit.Test;
54
import org.junit.runner.RunWith;
65
import org.springframework.beans.factory.annotation.Autowired;
@@ -10,7 +9,6 @@
109
import org.springframework.web.client.RestTemplate;
1110

1211
import static org.junit.Assert.assertEquals;
13-
import static org.junit.jupiter.api.Assertions.assertNotNull;
1412
import static org.junit.jupiter.api.Assertions.assertThrows;
1513

1614
/**
@@ -23,21 +21,19 @@
2321
*/
2422
@RunWith(SpringRunner.class)
2523
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
26-
@FixMethodOrder
27-
public class SampleServiceManualTest {
24+
public class SampleClientManualTest {
2825

2926
@Autowired
30-
private SampleService sampleService;
27+
private SampleClient sampleClient;
3128

3229
@Test
33-
public void a_givenKerberizedRestTemplate_whenServiceCall_thenSuccess() {
34-
assertNotNull(sampleService);
35-
assertEquals("data from kerberized server", sampleService.getData());
30+
public void givenKerberizedRestTemplate_whenServiceCall_thenSuccess() {
31+
assertEquals("data from kerberized server", sampleClient.getData());
3632
}
3733

3834
@Test
39-
public void b_givenRestTemplate_whenServiceCall_thenFail() {
40-
sampleService.setRestTemplate(new RestTemplate());
41-
assertThrows(RestClientException.class, sampleService::getData);
35+
public void givenRestTemplate_whenServiceCall_thenFail() {
36+
sampleClient.setRestTemplate(new RestTemplate());
37+
assertThrows(RestClientException.class, sampleClient::getData);
4238
}
4339
}

0 commit comments

Comments
 (0)