Package com.hazelcast.config

Examples of com.hazelcast.config.GroupConfig


    }

    private Config newConfig(String mapName, boolean sizeLimited) {
        Config cfg = new Config();

        cfg.setGroupConfig(new GroupConfig(getClass().getSimpleName()));

        MapStoreConfig mapStoreConfig = new MapStoreConfig()
        .setImplementation( new CountingMapLoader(mapStoreEntryCount, loadedValueCount) )
        .setInitialLoadMode( MapStoreConfig.InitialLoadMode.EAGER );
View Full Code Here


        return authenticated;
    }

    private boolean authenticate(UsernamePasswordCredentials credentials) {
        ClientEngineImpl clientEngine = getService();
        GroupConfig groupConfig = clientEngine.getConfig().getGroupConfig();
        String nodeGroupName = groupConfig.getName();
        String nodeGroupPassword = groupConfig.getPassword();
        boolean usernameMatch = nodeGroupName.equals(credentials.getUsername());
        boolean passwordMatch = nodeGroupPassword.equals(credentials.getPassword());
        return usernameMatch && passwordMatch;
    }
View Full Code Here

    @Test(timeout = 120000)
    public void testInitialLoadModeEager() {
        int size = 10000;
        TestHazelcastInstanceFactory nodeFactory = createHazelcastInstanceFactory(4);
        Config cfg = new Config();
        GroupConfig groupConfig = new GroupConfig("testEager");
        cfg.setGroupConfig(groupConfig);
        MapStoreConfig mapStoreConfig = new MapStoreConfig();
        mapStoreConfig.setEnabled(true);
        mapStoreConfig.setImplementation(new SimpleMapLoader(size, true));
        mapStoreConfig.setInitialLoadMode(MapStoreConfig.InitialLoadMode.EAGER);
View Full Code Here

        final int instanceCount = 2;
        final int size = 10000;
        final TestHazelcastInstanceFactory nodeFactory = createHazelcastInstanceFactory(instanceCount);
        final CountDownLatch countDownLatch = new CountDownLatch(instanceCount - 1);
        final Config cfg = new Config();
        GroupConfig groupConfig = new GroupConfig("testEager");
        cfg.setGroupConfig(groupConfig);
        MapStoreConfig mapStoreConfig = new MapStoreConfig();
        mapStoreConfig.setEnabled(true);
        mapStoreConfig.setImplementation(new SimpleMapLoader(size, true));
        mapStoreConfig.setInitialLoadMode(MapStoreConfig.InitialLoadMode.EAGER);
View Full Code Here

        final int instanceCount = 2;
        final int size = 10000;
        final TestHazelcastInstanceFactory nodeFactory = createHazelcastInstanceFactory(instanceCount);
        final CountDownLatch countDownLatch = new CountDownLatch(instanceCount - 1);
        final Config cfg = new Config();
        GroupConfig groupConfig = new GroupConfig("testEager");
        cfg.setGroupConfig(groupConfig);
        MapStoreConfig mapStoreConfig = new MapStoreConfig();
        mapStoreConfig.setEnabled(true);
        mapStoreConfig.setImplementation(new SimpleMapLoader(size, true));
        mapStoreConfig.setInitialLoadMode(MapStoreConfig.InitialLoadMode.EAGER);
View Full Code Here

    }

    public static void main(String[] args) throws InterruptedException {

        Config config = new Config();
        config.setGroupConfig(new GroupConfig("test", "test"));
        config.getNetworkConfig().setPort(6701);

        HazelcastInstance hazelcastInstance = Hazelcast.newHazelcastInstance(config);
        IMap<Integer, GenericEvent> map = hazelcastInstance.getMap("test");
        map.addIndex("userId", false);

        Hazelcast.newHazelcastInstance(config);

        ClientConfig clientConfig = new ClientConfig();
        clientConfig.getNetworkConfig().addAddress("localhost:6701", "localhost:6702");
        clientConfig.setGroupConfig(new GroupConfig("test", "test"));
        clientConfig.getNetworkConfig().setConnectionAttemptLimit(100);
        clientConfig.getNetworkConfig().setSmartRouting(false);

        HazelcastInstance client = HazelcastClient.newHazelcastClient(clientConfig);
        IMap<Integer, GenericEvent> mapClient = client.getMap("test");
View Full Code Here

        socketChannelWrapperFactory = clientExtension.getSocketChannelWrapperFactory();
        socketInterceptor = initSocketInterceptor(networkConfig.getSocketInterceptorConfig());
    }

    private Credentials initCredentials(ClientConfig config) {
        final GroupConfig groupConfig = config.getGroupConfig();
        final ClientSecurityConfig securityConfig = config.getSecurityConfig();
        Credentials c = securityConfig.getCredentials();
        if (c == null) {
            final String credentialsClassname = securityConfig.getCredentialsClassname();
            if (credentialsClassname != null) {
                try {
                    c = ClassLoaderUtil.newInstance(config.getClassLoader(), credentialsClassname);
                } catch (Exception e) {
                    throw ExceptionUtil.rethrow(e);
                }
            }
        }
        if (c == null) {
            c = new UsernamePasswordCredentials(groupConfig.getName(), groupConfig.getPassword());
        }
        return c;
    }
View Full Code Here

    @Before
    public void launchHazelcastServer() {
        Hazelcast.newHazelcastInstance();
        ClientConfig config = new ClientConfig();
        config.setGroupConfig(new GroupConfig("dev", "dev-pass"));
        config.getNetworkConfig().addAddress("127.0.0.1");
        client = HazelcastClient.newHazelcastClient(config);
    }
View Full Code Here

        assertEquals(3, config.getNetworkConfig().getSocketOptions().getLingerSeconds());
    }

    @Test
    public void testGroupConfig() {
        final GroupConfig groupConfig = clientConfig.getGroupConfig();
        assertEquals("dev", groupConfig.getName());
        assertEquals("dev-pass", groupConfig.getPassword());
    }
View Full Code Here

        this.groupPassword = groupPassword;
    }

    @Override
    public void run() {
        GroupConfig groupConfig = getNodeEngine().getConfig().getGroupConfig();
        if (!groupName.equals(groupConfig.getName())) {
            response = Boolean.FALSE;
        } else if (!groupPassword.equals(groupConfig.getPassword())) {
            response = Boolean.FALSE;
        }
    }
View Full Code Here

TOP

Related Classes of com.hazelcast.config.GroupConfig

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.