Package org.jboss.aerogear.simplepush.server.datastore

Examples of org.jboss.aerogear.simplepush.server.datastore.InMemoryDataStore


    public static final int DEFAULT_PORT = 7777;

    @Override
    public void start() {
        final SimplePushServerConfig config = fromConfig(container.config());
        final DataStore datastore = new InMemoryDataStore();
        final byte[] privateKey = DefaultSimplePushServer.generateAndStorePrivateKey(datastore, config);
        final SimplePushServer simplePushServer = new DefaultSimplePushServer(datastore, config, privateKey);
        final HttpServer httpServer = vertx.createHttpServer();
        setupHttpNotificationHandler(httpServer, simplePushServer);
        setupSimplePushSockJSServer(httpServer, simplePushServer);
View Full Code Here


    public synchronized void start(StartContext context) throws StartException {
    }

    @Override
    public synchronized DataStore getValue() throws IllegalStateException, IllegalArgumentException {
        return new InMemoryDataStore();
    }
View Full Code Here

        if (dataStore == null) {
            throw new IllegalArgumentException("datastore element must be specified");
        }
        final JsonNode inMemory = dataStore.get("in-memory");
        if (inMemory != null) {
            return new InMemoryDataStore();
        }
        final JsonNode redis = dataStore.get("redis");
        if (redis != null) {
            return new RedisDataStore(redis.get("host").asText(), redis.get("port").asInt());
        }
View Full Code Here

    private static final DefaultEventExecutorGroup eventExecutorGroup = new DefaultEventExecutorGroup(1);

    @BeforeClass
    public static void startSimplePushServer() throws Exception {
        final SockJsConfig sockJSConfig = SockJsConfig.withPrefix("/simplepush").cookiesNeeded().build();
        final DataStore datastore = new InMemoryDataStore();
        final ServerBootstrap sb = new ServerBootstrap();
        final SimplePushServerConfig simplePushConfig = DefaultSimplePushConfig.create()
                .userAgentReaperTimeout(2000L)
                .password("test")
                .build();
View Full Code Here

    private SimplePushServer simplePushServer() {
        final SimplePushServerConfig config = DefaultSimplePushConfig.create()
                .userAgentReaperTimeout(20L)
                .password("test")
                .build();
        final DataStore store = new InMemoryDataStore();
        final byte[] privateKey = DefaultSimplePushServer.generateAndStorePrivateKey(store, config);
        return new DefaultSimplePushServer(store, config, privateKey);
    }
View Full Code Here

    @Test
    public void rawWebSocketUpgradeRequest() throws Exception {
        final SimplePushServerConfig simplePushConfig = DefaultSimplePushConfig.create().password("test").build();
        final SockJsConfig sockjsConf = SockJsConfig.withPrefix("/simplepush").webSocketProtocols("push-notification").build();
        final byte[] privateKey = CryptoUtil.secretKey(simplePushConfig.password(), "someSaltForTesting".getBytes());
        final SimplePushServer pushServer = new DefaultSimplePushServer(new InMemoryDataStore(), simplePushConfig, privateKey);
        final SimplePushServiceFactory factory = new SimplePushServiceFactory(sockjsConf, pushServer);
        final EmbeddedChannel channel = createChannel(factory);
        final FullHttpRequest request = websocketUpgradeRequest(factory.config().prefix() + Transports.Type.WEBSOCKET.path());
        request.headers().set(Names.SEC_WEBSOCKET_PROTOCOL, "push-notification");
        channel.writeInbound(request);
View Full Code Here

        assertThat(pingResponse.getPingMessage(), equalTo(PingMessage.PING_MESSAGE));
        channel.close();
    }

    private SimplePushServer defaultPushServer() {
        final DataStore store = new InMemoryDataStore();
        final SimplePushServerConfig config = DefaultSimplePushConfig.create().password("test").build();
        final byte[] privateKey = DefaultSimplePushServer.generateAndStorePrivateKey(store, config);
        return new DefaultSimplePushServer(store, config, privateKey);
    }
View Full Code Here

    private SockJsServiceFactory defaultFactory() {
        final SimplePushServerConfig simplePushConfig = DefaultSimplePushConfig.create().password("test").build();
        final SockJsConfig sockjsConf = SockJsConfig.withPrefix("/simplepush").build();
        final byte[] privateKey = CryptoUtil.secretKey(simplePushConfig.password(), "someSaltForTesting".getBytes());
        final SimplePushServer pushServer = new DefaultSimplePushServer(new InMemoryDataStore(), simplePushConfig, privateKey);
        return new SimplePushServiceFactory(sockjsConf, pushServer);
    }
View Full Code Here

        doNotificationWithoutVersion(endpointToken, channelId, simplePushServer, channel);
        channel.close();
    }

    private SimplePushServer defaultPushServer() {
        final DataStore store = new InMemoryDataStore();
        final SimplePushServerConfig config = DefaultSimplePushConfig.create().password("testToken").build();
        final byte[] privateKey = DefaultSimplePushServer.generateAndStorePrivateKey(store, config);
        return new DefaultSimplePushServer(store, config, privateKey);
    }
View Full Code Here

public class InMemorySimplePushServerTest extends DefaultSimplePushServerTest {

    @Override
    protected DataStore createDataStore() {
        return new InMemoryDataStore();
    }
View Full Code Here

TOP

Related Classes of org.jboss.aerogear.simplepush.server.datastore.InMemoryDataStore

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.