Package org.apache.marmotta.client.model.config

Examples of org.apache.marmotta.client.model.config.Configuration


                    Map<String,Map<String,Object>> resultMap =
                            mapper.readValue(response.getEntity().getContent(),new TypeReference<Map<String,Map<String,Object>>>(){});
                   
                    Set<Configuration> result = new HashSet<Configuration>();
                    for(Map.Entry<String,Map<String,Object>> entry : resultMap.entrySet()) {
                        result.add(new Configuration(entry.getKey(),entry.getValue().get("value")));
                    }
                    return result;
                default:
                    log.error("error retrieving list of configuration keys: {} {}",new Object[] {response.getStatusLine().getStatusCode(),response.getStatusLine().getReasonPhrase()});
                    throw new MarmottaClientException("error retrieving list of configuration keys: "+response.getStatusLine().getStatusCode() + " " + response.getStatusLine().getReasonPhrase());
View Full Code Here


                            mapper.readValue(response.getEntity().getContent(),new TypeReference<Map<String,Object>>(){});

                    if(resultMap.isEmpty()) {
                        return null;
                    } else {
                        return new Configuration(key,resultMap.get(key));
                    }
                case 404:
                    log.info("configuration with key {} does not exist", key);
                    return null;
                default:
View Full Code Here

    @Test
    public void testGetConfiguration() throws MarmottaClientException, IOException {
        ConfigurationClient client = new ConfigurationClient(config);

        Configuration c_version = client.getConfiguration("kiwi.version");
        Assert.assertNotNull(c_version);

        Configuration c_path = client.getConfiguration("kiwi.path");
        Assert.assertNotNull(c_path);
        Assert.assertEquals(marmotta.getContext(), c_path.getString());

        /*
         * is not managed by the webservice anymore
        Configuration c_allow = client.getConfiguration("kiwi.allow_methods");
        Assert.assertNotNull(c_allow);
View Full Code Here

    public void testSetConfiguration() throws MarmottaClientException, IOException {
        ConfigurationClient client = new ConfigurationClient(config);

        // set a single-value string configuration
        client.setConfiguration("marmottaclient.test.single", "abc");
        Configuration c_single = client.getConfiguration("marmottaclient.test.single");
        Assert.assertNotNull(c_single);
        Assert.assertEquals("abc",c_single.getString());
        client.deleteConfiguration("marmottaclient.test.single");
        c_single = client.getConfiguration("marmottaclient.test.single");
        Assert.assertNull(c_single);

        // set a single-value boolean configuration
        client.setConfiguration("marmottaclient.test.bool",true);
        Configuration c_bool = client.getConfiguration("marmottaclient.test.bool");
        Assert.assertNotNull(c_bool);
        Assert.assertEquals("true",c_bool.getString());
        client.deleteConfiguration("marmottaclient.test.bool");
        c_bool = client.getConfiguration("marmottaclient.test.bool");
        Assert.assertNull(c_bool);


        // set a list value configuration
        client.setConfiguration("marmottaclient.test.list", Lists.newArrayList("abc","efg","hij"));
        Configuration c_list = client.getConfiguration("marmottaclient.test.list");
        Assert.assertNotNull(c_list);
        Assert.assertThat(c_list.getList(), Matchers.hasItem("efg"));
        client.deleteConfiguration("marmottaclient.test.list");
        c_list = client.getConfiguration("marmottaclient.test.list");
        Assert.assertNull(c_list);
    }
View Full Code Here

                    Map<String,Map<String,Object>> resultMap =
                            mapper.readValue(response.getEntity().getContent(),new TypeReference<Map<String,Map<String,Object>>>(){});
                   
                    Set<Configuration> result = new HashSet<Configuration>();
                    for(Map.Entry<String,Map<String,Object>> entry : resultMap.entrySet()) {
                        result.add(new Configuration(entry.getKey(),entry.getValue().get("value")));
                    }
                    return result;
                default:
                    log.error("error retrieving list of configuration keys: {} {}",new Object[] {response.getStatusLine().getStatusCode(),response.getStatusLine().getReasonPhrase()});
                    throw new MarmottaClientException("error retrieving list of configuration keys: "+response.getStatusLine().getStatusCode() + " " + response.getStatusLine().getReasonPhrase());
View Full Code Here

                            mapper.readValue(response.getEntity().getContent(),new TypeReference<Map<String,Object>>(){});

                    if(resultMap.isEmpty()) {
                        return null;
                    } else {
                        return new Configuration(key,resultMap.get(key));
                    }
                case 404:
                    log.info("configuration with key {} does not exist", key);
                    return null;
                default:
View Full Code Here

TOP

Related Classes of org.apache.marmotta.client.model.config.Configuration

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.