Package eu.planets_project.ifr.core.servreg.api

Examples of eu.planets_project.ifr.core.servreg.api.Response


    private void init() throws MalformedURLException {
        /* We create one registry and register one description: */
        description = ServiceDescription.create("Test", "Type").endpoint(
                new URL("http://no.where")).build();
        Response register = registry.register(description);
        if (!register.success()) {
            String message = register.getMessage();
            System.err.println(message);
        }
        Assert.assertEquals(true, register.success());
        /* Some client instantiates a registry backed by the same directory: */
        newRegistry = createRegistry();
        checkIfPresent(description, newRegistry);
        /* Now, we change something in the original registry: */
        ServiceDescription newDescription = ServiceDescription
View Full Code Here


   
    private void addToServiceRegistry() {
        // Attempt to register:
        ServiceDescription toReg =  new ServiceDescription.Builder( this.getDescription() ).endpoint(
                this.getLocation() ).build();
        Response response = ServiceRegistryBackingBean.registry.register( toReg );
        log.info("Got response success: "+response.success());
        log.info("Got response: "+response.getMessage());
        if( response.success() ) {
            log.info("Updated. "+this.getDescription().getEndpoint());
        }
        this.setRegistered(true);
    }
View Full Code Here

        }
        this.setRegistered(true);
    }
   
    private void removeFromServiceRegistry() {
        Response response = ServiceRegistryBackingBean.registry.delete(
                new ServiceDescription.Builder( this.getDescription().getName(), this.getDescription().getType()
                        ).endpoint( this.getDescription().getEndpoint() ).build() );
//        Response response = RegistryBackingBean.registry.delete( this.getDescription() );
        log.info("Got response: "+response.getMessage());
        if( response.success() )
            log.info("Deregistered: "+this.getLocation());
        this.setRegistered(false);
    }
View Full Code Here

        description1 = new ServiceDescription.Builder(NAME, TYPE1).description(DESCRIPTION).inputFormats(PRONOM_TIFF,
                PRONOM_PNG).endpoint(endpoint1).build();
        /* We register another one using the TIFF extension ID as input format: */
        description2 = new ServiceDescription.Builder(NAME, TYPE2).inputFormats(EXT_TIFF, PRONOM_PNG).endpoint(
                endpoint2).build();
        Response register = registry.register(description1);
        if (!register.success()) {
            System.err.println(register.getMessage());
        }
        /* Register another description, which is restricted, and will not be returned unless authenticated via UI: */
        register = registry.register(new ServiceDescription.Builder(NAME, TYPE1).description(DESCRIPTION).inputFormats(
                PRONOM_TIFF, PRONOM_PNG).endpoint(endpoint4).properties(Property.authorizedRoles("admin, provider"))
                .build());
        if (!register.success()) {
            System.err.println(register.getMessage());
        }
        Assert.assertTrue("Could not register when it should work", register.success());
        /* But we can't register descriptions without an endpoint: */
        Response fail = registry.register(new ServiceDescription.Builder(NAME, TYPE1).build());
        Assert.assertFalse("Could register when it should not work", fail.success());
        registry.register(description2);
        /* We finally register one service using the mime URI: */
        Assert.assertTrue("Failed to register using mime type", registry.register(
                new ServiceDescription.Builder("third", TYPE2).inputFormats(MIME_TIFF).endpoint(endpoint3).build())
                .success());
View Full Code Here

    /**
     * Register a single service description.
     */
    @Test
    public void registerServiceDescription() {
        Response message = registry.register(description1);
        Assert.assertEquals("Double registration!", 3, registry.query(null).size());
        Assert.assertNotNull("No result message;", message);
        System.out.println("Registered: " + message);
    }
View Full Code Here

    /**
     * Test service deletion.
     */
    @Test
    public void deleteByExample() {
        Response response = registry.delete(new ServiceDescription.Builder(null, TYPE1).endpoint(endpoint1).build());
        Assert.assertTrue(response.success());
        List<ServiceDescription> services = registry.query(null);
        Assert.assertEquals(2, services.size());
    }
View Full Code Here

    /**
     * We don't allow duplicate endpoints so check.
     */
    @Test
    public void duplicateEndpointGuard() {
        Response response = registry.register(new ServiceDescription.Builder(null, TYPE1).endpoint(endpoint1).build());
        Assert.assertFalse(response.success());
        List<ServiceDescription> services = registry.query(null);
        Assert.assertEquals(3, services.size());
    }
View Full Code Here

TOP

Related Classes of eu.planets_project.ifr.core.servreg.api.Response

Copyright © 2018 www.massapicom. 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.