Examples of StoreDefinitionsMapper


Examples of voldemort.xml.StoreDefinitionsMapper

    @Test
    public void testAddAvroSchema() throws Exception {
        // backwards incompatible schema should fail
        try {
            logger.info("Now inserting stores with non backward compatible schema. Should see exception");
            adminClient.storeMgmtOps.addStore(new StoreDefinitionsMapper().readStore(new StringReader(storeXmlWithBackwardIncompatibleSchema)));
            Assert.fail("Did not throw exception");
        } catch(VoldemortException e) {

        }

        // invalid key schema should fail
        try {
            logger.info("Now inserting stores with int32 avro key. Should see exception");
            adminClient.storeMgmtOps.addStore(new StoreDefinitionsMapper().readStore(new StringReader(storeXmlWithInvalidAvroKeySchema)));
            Assert.fail("Did not throw exception for invalid key schema");
        } catch(VoldemortException e) {
            logger.error("As expected", e);
        }

        // invalid value schema should fail
        try {
            logger.info("Now inserting stores with html characters in avro value schema");
            adminClient.storeMgmtOps.addStore(new StoreDefinitionsMapper().readStore(new StringReader(storeXmlWithInvalidAvroValueSchema)));
            Assert.fail("Did not throw exception for invalid value schema");
        } catch(VoldemortException e) {
            logger.error("As expected", e);
        }

        for(VoldemortServer vs: vservers.values()) {
            assertNull(vs.getStoreRepository().getLocalStore("test"));
        }
        logger.info("Now inserting stores with backward compatible schema. Should not see exception");
        adminClient.storeMgmtOps.addStore(new StoreDefinitionsMapper().readStore(new StringReader(storeXmlWithBackwardCompatibleSchema)));

        for(VoldemortServer vs: vservers.values()) {
            assertNotNull(vs.getStoreRepository().getLocalStore("test"));
        }
    }
View Full Code Here

Examples of voldemort.xml.StoreDefinitionsMapper

    public void testUpdateAvroSchema() throws Exception {
        for(VoldemortServer vs: vservers.values()) {
            assertNull(vs.getStoreRepository().getLocalStore("test"));
        }
        logger.info("Now inserting stores with backward compatible schema. Should not see exception");
        adminClient.storeMgmtOps.addStore(new StoreDefinitionsMapper().readStore(new StringReader(storeXmlWithBackwardCompatibleSchema)));


        try {
            logger.info("Now updating store with non backward compatible schema. Should see exception");
            List<StoreDefinition> stores = new ArrayList<StoreDefinition>();
            stores.add(new StoreDefinitionsMapper().readStore(new StringReader(storeXmlWithBackwardIncompatibleSchema)));
            adminClient.metadataMgmtOps.updateRemoteStoreDefList(stores);
            Assert.fail("Did not throw exception");
        } catch(VoldemortException e) {

        }
View Full Code Here

Examples of voldemort.xml.StoreDefinitionsMapper

        JobConf conf = job;
        try {

            this.cluster = new ClusterMapper().readCluster(new StringReader(conf.get("cluster.xml")));
            List<StoreDefinition> storeDefs = new StoreDefinitionsMapper().readStoreList(new StringReader(conf.get("stores.xml")));
            if(storeDefs.size() != 1)
                throw new IllegalStateException("Expected to find only a single store, but found multiple!");
            this.storeDef = storeDefs.get(0);

            this.numChunks = conf.getInt("num.chunks", -1);
View Full Code Here

Examples of voldemort.xml.StoreDefinitionsMapper

        ClientConfig clientConfig = new ClientConfig().setMaxConnectionsPerNode(maxConnectionsPerNode)
                                                      .setMaxThreads(maxThreads);

        String storeDefinitionFile = "test/common/voldemort/config/single-store.xml";
        StoreDefinition storeDefinition = new StoreDefinitionsMapper().readStoreList(new File(storeDefinitionFile))
                                                                      .get(0);

        SocketStoreFactory socketStoreFactory = new ClientRequestExecutorPool(clientConfig.getSelectors(),
                                                                              clientConfig.getMaxConnectionsPerNode(),
                                                                              clientConfig.getConnectionTimeout(TimeUnit.MILLISECONDS),
View Full Code Here

Examples of voldemort.xml.StoreDefinitionsMapper

            srcAdminClient = new AdminClient(srcCluster,
                                             new AdminClientConfig(),
                                             new ClientConfig());

            List<StoreDefinition> storeDefs = new StoreDefinitionsMapper().readStoreList(new File(STORES_XML));

            primaryResolvingStoreDef = StoreUtils.getStoreDef(storeDefs,
                                                              PRIMARY_RESOLVING_STORE_NAME);
            globallyResolvingStoreDef = StoreUtils.getStoreDef(storeDefs,
                                                               GLOBALLY_RESOLVING_STORE_NAME);
View Full Code Here

Examples of voldemort.xml.StoreDefinitionsMapper

            serverPorts = new int[numServers];

            File tempStoreXml = new File(TestUtils.createTempDir(), "stores.xml");
            try {
                FileUtils.writeStringToFile(tempStoreXml,
                                            new StoreDefinitionsMapper().writeStoreList(Lists.newArrayList(storeDef)));
            } catch(IOException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
                throw e1;
            }
View Full Code Here

Examples of voldemort.xml.StoreDefinitionsMapper

    public void testHashConsistencyAcrossRoutingStrategies() {
        // check that as long as the cluster.xml is the same, a key will hash to
        // the same partition, immaterial of whether it is zone or consistent
        // routing strategy

        StoreDefinitionsMapper mapper = new StoreDefinitionsMapper();
        List<StoreDefinition> storeDefs = mapper.readStoreList(new StringReader(VoldemortTestConstants.getTwoStoresWithZonesXml()));

        StoreDefinition consistentStore = storeDefs.get(0);
        StoreDefinition zoneStore = storeDefs.get(1);

        assertEquals(consistentStore.getName(), "cstore");
View Full Code Here

Examples of voldemort.xml.StoreDefinitionsMapper

                                                               .setPreferredWrites(1)
                                                               .setRequiredWrites(1)
                                                               .build();

        File storesXml = new File(TestUtils.createTempDir(), "stores.xml");
        StoreDefinitionsMapper storeDefMapper = new StoreDefinitionsMapper();
        FileWriter writer = new FileWriter(storesXml);
        writer.write(storeDefMapper.writeStoreList(Lists.newArrayList(storeDef)));
        writer.close();

        return storesXml.getAbsolutePath();
    }
View Full Code Here

Examples of voldemort.xml.StoreDefinitionsMapper

    }

    private void runRetentionEnforcingStoreTest(boolean onlineDeletes) throws InterruptedException {

        time.setTime(System.currentTimeMillis());
        StoreDefinition retentionStoreDef = new StoreDefinitionsMapper().readStoreList(new StringReader(VoldemortTestConstants.getStoreDefinitionsWithRetentionXml()))
                                                                        .get(0);
        RetentionEnforcingStore store = new RetentionEnforcingStore(engine,
                                                                    retentionStoreDef,
                                                                    onlineDeletes,
                                                                    time);
View Full Code Here

Examples of voldemort.xml.StoreDefinitionsMapper

                                                        useNio,
                                                        null,
                                                        storesXmlfile,
                                                        serverProperties);

        storeDefs = new StoreDefinitionsMapper().readStoreList(new File(storesXmlfile));

        Properties adminProperties = new Properties();
        adminProperties.setProperty("max_connections", "20");
        adminClient = new AdminClient(cluster,
                                      new AdminClientConfig(adminProperties),
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.