Examples of OwnerClient


Examples of org.candlepin.client.OwnerClient

    }

    @Test
    @SuppressWarnings("unchecked")
    public void execute() throws JobExecutionException {
        OwnerClient oclient = mock(OwnerClient.class);
        ConsumerClient conclient = mock(ConsumerClient.class);
        when(conn.connect(eq(OwnerClient.class), any(Credentials.class),
            any(String.class))).thenReturn(oclient);
        when(conn.connect(eq(ConsumerClient.class), any(Credentials.class),
            any(String.class))).thenReturn(conclient);

        ClientResponse<Owner> resp = mock(ClientResponse.class);

        List<Pool> pools = new ArrayList<Pool>();
        pools.add(mock(Pool.class));

        List<Consumer> consumers = new ArrayList<Consumer>();
        Consumer consumer = mock(Consumer.class);
        when(consumer.getUuid()).thenReturn("357ec012");
        consumers.add(consumer);

        List<Entitlement> ents = new ArrayList<Entitlement>();
        Entitlement ent = mock(Entitlement.class);
        when(ent.getId()).thenReturn("ff8080812e9");
        ents.add(ent);

        ClientResponse<List<Pool>> prsp = mock(ClientResponse.class);
        ClientResponse<List<Consumer>> crsp = mock(ClientResponse.class);
        ClientResponse<List<Entitlement>> ersp = mock(ClientResponse.class);
        Response drsp = mock(Response.class);

        when(oclient.replicateOwner(eq("admin"))).thenReturn(resp);
        when(oclient.replicatePools(eq("admin"))).thenReturn(prsp);
        when(oclient.replicateEntitlements(eq("admin"))).thenReturn(ersp);
        when(oclient.replicateConsumers(eq("admin"))).thenReturn(crsp);
        when(oclient.deleteOwner(eq("admin"), eq(false))).thenReturn(drsp);
        when(conclient.replicateEntitlements(eq("357ec012"),
            any(String.class))).thenReturn(ersp);
        when(resp.getStatus()).thenReturn(200);
        when(prsp.getStatus()).thenReturn(200);
        when(crsp.getStatus()).thenReturn(200);
View Full Code Here

Examples of org.candlepin.client.OwnerClient

    }

    @Test(expected = NotFoundException.class)
    @SuppressWarnings("unchecked")
    public void executeNonExistentOwner() throws JobExecutionException {
        OwnerClient client = mock(OwnerClient.class);
        when(conn.connect(eq(OwnerClient.class), any(Credentials.class),
            any(String.class))).thenReturn(client);
        ClientResponse<Owner> resp = mock(ClientResponse.class);
        when(client.replicateOwner(eq("doesnotexist"))).thenReturn(resp);
        when(resp.getStatus()).thenReturn(404);

        JobDataMap map = new JobDataMap();
        map.put("owner_key", "doesnotexist");
        map.put("uri", "http://foo.example.com/candlepin");
View Full Code Here

Examples of org.candlepin.client.OwnerClient

    }

    @Test
    @SuppressWarnings("unchecked")
    public void bz874785NullPointer() throws JobExecutionException {
        OwnerClient oclient = mock(OwnerClient.class);
        ConsumerClient conclient = mock(ConsumerClient.class);
        when(conn.connect(eq(OwnerClient.class), any(Credentials.class),
            any(String.class))).thenReturn(oclient);
        when(conn.connect(eq(ConsumerClient.class), any(Credentials.class),
            any(String.class))).thenReturn(conclient);

        ClientResponse<Owner> resp = mock(ClientResponse.class);

        List<Pool> pools = new ArrayList<Pool>();
        pools.add(mock(Pool.class));

        List<Consumer> consumers = new ArrayList<Consumer>();
        Consumer consumer = mock(Consumer.class);
        when(consumer.getUuid()).thenReturn("357ec012");

        // return null getFacts and ensure we don't blow up because of it
        when(consumer.getFacts()).thenReturn(null);
        consumers.add(consumer);

        List<Entitlement> ents = new ArrayList<Entitlement>();
        Entitlement ent = mock(Entitlement.class);
        when(ent.getId()).thenReturn("ff8080812e9");
        ents.add(ent);

        ClientResponse<List<Pool>> prsp = mock(ClientResponse.class);
        ClientResponse<List<Consumer>> crsp = mock(ClientResponse.class);
        ClientResponse<List<Entitlement>> ersp = mock(ClientResponse.class);
        Response drsp = mock(Response.class);

        when(oclient.replicateOwner(eq("admin"))).thenReturn(resp);
        when(oclient.replicatePools(eq("admin"))).thenReturn(prsp);
        when(oclient.replicateEntitlements(eq("admin"))).thenReturn(ersp);
        when(oclient.replicateConsumers(eq("admin"))).thenReturn(crsp);
        when(oclient.deleteOwner(eq("admin"), eq(false))).thenReturn(drsp);
        when(conclient.replicateEntitlements(eq("357ec012"),
            any(String.class))).thenReturn(ersp);
        when(resp.getStatus()).thenReturn(200);
        when(prsp.getStatus()).thenReturn(200);
        when(crsp.getStatus()).thenReturn(200);
View Full Code Here

Examples of org.candlepin.client.OwnerClient

        validateInput(key, uri);

        Credentials creds = new UsernamePasswordCredentials(
            config.getString(ConfigProperties.SHARD_USERNAME),
            config.getString(ConfigProperties.SHARD_PASSWORD));
        OwnerClient oclient = conn.connect(OwnerClient.class, creds, uri);

        log.info("Migrating owner [" + key +
            "] from candlepin instance running on [" + uri + "]");
        replicateOwner(key, oclient);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.