Search in sources :

Example 46 with Client

use of org.powerbot.bot.rt6.client.Client in project ORCID-Source by ORCID.

the class JpaJaxbClientAdapterTest method getClient.

private Client getClient() {
    Client client = new Client();
    client.setAllowAutoDeprecate(true);
    client.setPersistentTokensEnabled(true);
    client.setClientType(ClientType.CREATOR);
    client.setDescription("description");
    client.setGroupProfileId("group-profile-id");
    client.setId("id");
    client.setName("client-name");
    client.setWebsite("client-website");
    client.setAuthenticationProviderId("authentication-provider-id");
    Set<ClientRedirectUri> clientRedirectUris = new HashSet<ClientRedirectUri>();
    ClientRedirectUri rUri1 = new ClientRedirectUri();
    Set<ScopePathType> scopes1 = new HashSet<ScopePathType>();
    scopes1.add(ScopePathType.ACTIVITIES_READ_LIMITED);
    rUri1.setPredefinedClientScopes(scopes1);
    rUri1.setRedirectUri("redirect-uri-1");
    rUri1.setRedirectUriType("type-1");
    rUri1.setUriActType("uri-act-type-1");
    rUri1.setUriGeoArea("uri-geo-area-1");
    ClientRedirectUri rUri2 = new ClientRedirectUri();
    Set<ScopePathType> scopes2 = new HashSet<ScopePathType>();
    scopes2.add(ScopePathType.ACTIVITIES_UPDATE);
    rUri2.setPredefinedClientScopes(scopes2);
    rUri2.setRedirectUri("redirect-uri-2");
    rUri2.setRedirectUriType("type-2");
    rUri2.setUriActType("uri-act-type-2");
    rUri2.setUriGeoArea("uri-geo-area-2");
    ClientRedirectUri rUri3 = new ClientRedirectUri();
    Set<ScopePathType> scopes3 = new HashSet<ScopePathType>();
    scopes3.add(ScopePathType.AFFILIATIONS_CREATE);
    rUri3.setPredefinedClientScopes(scopes3);
    rUri3.setRedirectUri("redirect-uri-3");
    rUri3.setRedirectUriType("type-3");
    rUri3.setUriActType("uri-act-type-3");
    rUri3.setUriGeoArea("uri-geo-area-3");
    clientRedirectUris.add(rUri1);
    clientRedirectUris.add(rUri2);
    clientRedirectUris.add(rUri3);
    client.setClientRedirectUris(clientRedirectUris);
    return client;
}
Also used : ClientRedirectUri(org.orcid.jaxb.model.v3.dev1.client.ClientRedirectUri) ScopePathType(org.orcid.jaxb.model.message.ScopePathType) Client(org.orcid.jaxb.model.v3.dev1.client.Client) HashSet(java.util.HashSet)

Example 47 with Client

use of org.powerbot.bot.rt6.client.Client in project ORCID-Source by ORCID.

the class JpaJaxbClientAdapterTest method toClientTest.

@Test
public void toClientTest() {
    ClientDetailsEntity entity = getClientDetailsEntity();
    Client client = adapter.toClient(entity);
    assertEquals(getClient(), client);
}
Also used : ClientDetailsEntity(org.orcid.persistence.jpa.entities.ClientDetailsEntity) Client(org.orcid.jaxb.model.v3.dev1.client.Client) Test(org.junit.Test)

Example 48 with Client

use of org.powerbot.bot.rt6.client.Client in project ORCID-Source by ORCID.

the class JpaJaxbClientAdapterTest method toEntityTest.

@Test
public void toEntityTest() {
    Client client = getClient();
    ClientDetailsEntity entity = adapter.toEntity(client);
    ClientDetailsEntity toCompare = getClientDetailsEntity();
    // Configuration values should be the default
    assertFalse(entity.isPersistentTokensEnabled());
    assertNull(entity.getAuthenticationProviderId());
    assertEquals(toCompare.getClientDescription(), entity.getClientDescription());
    assertEquals(toCompare.getClientId(), entity.getClientId());
    assertEquals(toCompare.getClientName(), entity.getClientName());
    assertEquals(toCompare.getClientRegisteredRedirectUris(), entity.getClientRegisteredRedirectUris());
    assertEquals(toCompare.getClientWebsite(), entity.getClientWebsite());
    assertEquals(toCompare.isAllowAutoDeprecate(), entity.isAllowAutoDeprecate());
    assertFalse(entity.isPersistentTokensEnabled());
    assertNull(entity.getClientType());
    assertNull(entity.getAuthenticationProviderId());
    assertNull(entity.getEmailAccessReason());
    assertNull(entity.getGroupProfileId());
    assertNull(entity.getClientSecrets());
    assertEquals(Collections.EMPTY_SET, entity.getClientAuthorizedGrantTypes());
    assertEquals(Collections.EMPTY_SET, entity.getClientResourceIds());
    assertEquals(Collections.EMPTY_SET, entity.getClientScopes());
    assertEquals(Collections.EMPTY_SET, entity.getCustomEmails());
    assertEquals(Collections.EMPTY_LIST, entity.getClientGrantedAuthorities());
}
Also used : ClientDetailsEntity(org.orcid.persistence.jpa.entities.ClientDetailsEntity) Client(org.orcid.jaxb.model.v3.dev1.client.Client) Test(org.junit.Test)

Example 49 with Client

use of org.powerbot.bot.rt6.client.Client in project ORCID-Source by ORCID.

the class ClientManagerReadOnlyTest method getClientTest.

@Test
public void getClientTest() {
    String seed = RandomStringUtils.randomAlphanumeric(30);
    when(daoMock.findByClientId(anyString(), anyLong())).thenReturn(getClientDetailsEntity(seed));
    Client client = clientManagerReadOnly.get(seed);
    assertEquals(getClient(seed), client);
}
Also used : ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) Client(org.orcid.jaxb.model.v3.dev1.client.Client) Test(org.junit.Test)

Example 50 with Client

use of org.powerbot.bot.rt6.client.Client in project hpcourse by cscenter.

the class SimpleTests method submitHardTask.

public void submitHardTask() {
    new Thread(new Runnable() {

        @Override
        public void run() {
            Client client = new Client("localhost", 1500);
            client.submitTask(getHardTask());
        }
    }).start();
}
Also used : Client(client.Client)

Aggregations

Client (org.powerbot.bot.rt4.client.Client)36 Client (org.powerbot.bot.rt6.client.Client)33 Point (java.awt.Point)26 ArrayList (java.util.ArrayList)13 Client (org.orcid.jaxb.model.v3.dev1.client.Client)11 Test (org.junit.Test)8 Tile (org.powerbot.script.Tile)8 ClientDetailsEntity (org.orcid.persistence.jpa.entities.ClientDetailsEntity)6 HashSet (java.util.HashSet)5 Rectangle (java.awt.Rectangle)4 Reflector (org.powerbot.bot.Reflector)4 Condition (org.powerbot.script.Condition)4 Client (client.Client)3 LinkedList (java.util.LinkedList)3 CopyOnWriteArrayList (java.util.concurrent.CopyOnWriteArrayList)3 ClientRedirectUri (org.orcid.jaxb.model.v3.dev1.client.ClientRedirectUri)3 Graphics (java.awt.Graphics)2 AtomicReference (java.util.concurrent.atomic.AtomicReference)2 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)2 ScopePathType (org.orcid.jaxb.model.message.ScopePathType)2