Examples of GridClientConfiguration


Examples of org.gridgain.client.GridClientConfiguration

     *
     * @throws Exception In case of exception.
     */
    public void testCreation() throws Exception {
        // Validate default configuration.
        GridClientConfiguration cfg = new GridClientConfiguration();

        cfg.setServers(Arrays.asList("localhost:11211"));

        validateConfig(0, cfg);

        // Validate default properties-based configuration.
        cfg = new GridClientConfiguration();

        cfg.setServers(Arrays.asList("localhost:11211"));

        validateConfig(0, cfg);

        // Validate loaded configuration.
        Properties props = loadProperties(1, GRID_CLIENT_CONFIG);
        validateConfig(0, new GridClientConfiguration(props));

        // Validate loaded configuration with changed key prefixes.
        Properties props2 = new Properties();

        for (Map.Entry<Object, Object> e : props.entrySet())
            props2.put("new." + e.getKey(), e.getValue());

        validateConfig(0, new GridClientConfiguration("new.gg.client", props2));
        validateConfig(0, new GridClientConfiguration("new.gg.client.", props2));

        // Validate loaded test configuration.
        File tmp = uncommentProperties(GRID_CLIENT_CONFIG);

        props = loadProperties(25, tmp.toURI().toURL());
        validateConfig(2, new GridClientConfiguration(props));

        // Validate loaded test configuration with changed key prefixes.
        props2 = new Properties();

        for (Map.Entry<Object, Object> e : props.entrySet())
            props2.put("new." + e.getKey(), e.getValue());

        validateConfig(2, new GridClientConfiguration("new.gg.client", props2));
        validateConfig(2, new GridClientConfiguration("new.gg.client.", props2));

        // Validate loaded test configuration with empty key prefixes.
        props2 = new Properties();

        for (Map.Entry<Object, Object> e : props.entrySet())
            props2.put(e.getKey().toString().replace("gg.client.", ""), e.getValue());

        validateConfig(2, new GridClientConfiguration("", props2));
        validateConfig(2, new GridClientConfiguration(".", props2));
    }
View Full Code Here

Examples of org.gridgain.client.GridClientConfiguration

     * Validate spring client configuration.
     *
     * @throws Exception In case of any exception.
     */
    public void testSpringConfig() throws Exception {
        GridClientConfiguration cfg = new FileSystemXmlApplicationContext(
            GRID_CLIENT_SPRING_CONFIG.toString()).getBean(GridClientConfiguration.class);

        assertEquals(Arrays.asList("127.0.0.1:11211"), new ArrayList<>(cfg.getServers()));
        assertNull(cfg.getSecurityCredentialsProvider());

        Collection<GridClientDataConfiguration> dataCfgs = cfg.getDataConfigurations();

        assertEquals(1, dataCfgs.size());

        GridClientDataConfiguration dataCfg = dataCfgs.iterator().next();

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.