Search in sources :

Example 36 with Client

use of com.hw.helper.Client in project mt-auth by publicdevop2019.

the class BizClientIdempotentTest method create_client_w_same_changeId_two_times_concurrent.

@Test
public void create_client_w_same_changeId_two_times_concurrent() {
    Client oldClient = action.getClientAsResource(CLIENT_ID_RESOURCE_ID);
    String s = UUID.randomUUID().toString();
    Runnable runnable2 = () -> {
        ResponseEntity<String> client1 = action.createClient(oldClient, s);
        Assert.assertEquals(HttpStatus.OK, client1.getStatusCode());
    };
    ArrayList<Runnable> runnables = new ArrayList<>();
    runnables.add(runnable2);
    runnables.add(runnable2);
    try {
        assertConcurrent("", runnables, 30000);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
}
Also used : ArrayList(java.util.ArrayList) Client(com.hw.helper.Client) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

Client (com.hw.helper.Client)36 Test (org.junit.Test)30 DefaultOAuth2AccessToken (org.springframework.security.oauth2.common.DefaultOAuth2AccessToken)23 HttpEntity (org.springframework.http.HttpEntity)18 HttpHeaders (org.springframework.http.HttpHeaders)18 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)12 HashSet (java.util.HashSet)7 ArrayList (java.util.ArrayList)6 GrantTypeEnum (com.hw.helper.GrantTypeEnum)4 LinkedMultiValueMap (org.springframework.util.LinkedMultiValueMap)4 MultiValueMap (org.springframework.util.MultiValueMap)4 ClientType (com.hw.helper.ClientType)3 SumTotal (com.hw.helper.SumTotal)3 AtomicReference (java.util.concurrent.atomic.AtomicReference)3 ResponseEntity (org.springframework.http.ResponseEntity)3 IOException (java.io.IOException)1 Base64 (java.util.Base64)1 Map (java.util.Map)1 Ignore (org.junit.Ignore)1 OAuth2RefreshToken (org.springframework.security.oauth2.common.OAuth2RefreshToken)1