Examples of toJSONString()


Examples of voldemort.server.rebalance.RebalancerState.toJsonString()

            System.out.println("Cleaning up " + MetadataStore.REBALANCING_STEAL_INFO + " to "
                               + state.toJsonString());
            doMetaSet(adminClient,
                      nodeIds,
                      MetadataStore.REBALANCING_STEAL_INFO,
                      state.toJsonString());
            System.out.println("Cleaning up " + MetadataStore.REBALANCING_SOURCE_CLUSTER_XML
                               + " to empty string");
            doMetaSet(adminClient, nodeIds, MetadataStore.REBALANCING_SOURCE_CLUSTER_XML, "");
        }
    }
View Full Code Here

Examples of voldemort.server.rebalance.RebalancerState.toJsonString()

                    if(!Utils.isReadableFile(metaFile)) {
                        throw new VoldemortException("Rebalancing steal info file path incorrect");
                    }
                    String rebalancingStealInfoJsonString = FileUtils.readFileToString(new File(metaFile));
                    RebalancerState state = RebalancerState.create(rebalancingStealInfoJsonString);
                    doMetaSet(adminClient, nodeIds, metaKey, state.toJsonString());
                } else {
                    throw new VoldemortException("Incorrect metadata key");
                }
            } else if(meta.size() == 4) {
                // set metadata pair cluster.xml, stores.xml
View Full Code Here

Examples of voldemort.server.rebalance.RebalancerState.toJsonString()

            valueStr = clusterMapper.writeCluster((Cluster) value.getValue());
        } else if(STORES_KEY.equals(key)) {
            valueStr = storeMapper.writeStoreList((List<StoreDefinition>) value.getValue());
        } else if(REBALANCING_STEAL_INFO.equals(key)) {
            RebalancerState rebalancerState = (RebalancerState) value.getValue();
            valueStr = rebalancerState.toJsonString();
        } else if(SERVER_STATE_KEY.equals(key) || NODE_ID_KEY.equals(key)
                  || SLOP_STREAMING_ENABLED_KEY.equals(key)
                  || PARTITION_STREAMING_ENABLED_KEY.equals(key)
                  || READONLY_FETCH_ENABLED_KEY.equals(key)) {
            valueStr = value.getValue().toString();
View Full Code Here

Examples of voldemort.store.readonly.ReadOnlyStorageMetadata.toJsonString()

        // Missing metadata checksum type
        metadataFile = new File(testSourceDirectory, ".metadata");
        ReadOnlyStorageMetadata metadata = new ReadOnlyStorageMetadata();
        metadata.add(ReadOnlyStorageMetadata.FORMAT, ReadOnlyStorageFormat.READONLY_V2.getCode());
        FileUtils.writeStringToFile(metadataFile, metadata.toJsonString());

        fetchedFile = fetcher.fetch(testSourceDirectory.getAbsolutePath(),
                                    testDestinationDirectory.getAbsolutePath() + "3");
        assertNotNull(fetchedFile);
        assertEquals(fetchedFile.getAbsolutePath(), testDestinationDirectory.getAbsolutePath()
View Full Code Here

Examples of voldemort.store.readonly.ReadOnlyStorageMetadata.toJsonString()

                                                    + "3");
        metadataFile.delete();

        // Incorrect checksum type + missing checksum
        metadata.add(ReadOnlyStorageMetadata.CHECKSUM_TYPE, "blah");
        FileUtils.writeStringToFile(metadataFile, metadata.toJsonString());
        fetchedFile = fetcher.fetch(testSourceDirectory.getAbsolutePath(),
                                    testDestinationDirectory.getAbsolutePath() + "4");
        assertNotNull(fetchedFile);
        assertEquals(fetchedFile.getAbsolutePath(), testDestinationDirectory.getAbsolutePath()
                                                    + "4");
View Full Code Here

Examples of voldemort.store.readonly.ReadOnlyStorageMetadata.toJsonString()

        metadataFile.delete();

        // Incorrect metadata checksum
        metadata.add(ReadOnlyStorageMetadata.CHECKSUM_TYPE, CheckSum.toString(CheckSumType.MD5));
        metadata.add(ReadOnlyStorageMetadata.CHECKSUM, "1234");
        FileUtils.writeStringToFile(metadataFile, metadata.toJsonString());
        fetchedFile = fetcher.fetch(testSourceDirectory.getAbsolutePath(),
                                    testDestinationDirectory.getAbsolutePath() + "5");
        assertNull(fetchedFile);
        metadataFile.delete();
View Full Code Here

Examples of voldemort.store.readonly.ReadOnlyStorageMetadata.toJsonString()

        // Correct metadata checksum - MD5
        metadata.add(ReadOnlyStorageMetadata.CHECKSUM,
                     new String(Hex.encodeHex(CheckSumTests.calculateCheckSum(testSourceDirectory.listFiles(),
                                                                              CheckSumType.MD5))));
        FileUtils.writeStringToFile(metadataFile, metadata.toJsonString());
        fetchedFile = fetcher.fetch(testSourceDirectory.getAbsolutePath(),
                                    testDestinationDirectory.getAbsolutePath() + "6");
        assertNotNull(fetchedFile);
        assertEquals(fetchedFile.getAbsolutePath(), testDestinationDirectory.getAbsolutePath()
                                                    + "6");
View Full Code Here

Examples of voldemort.store.readonly.ReadOnlyStorageMetadata.toJsonString()

        // Correct metadata checksum - ADLER32
        metadata.add(ReadOnlyStorageMetadata.CHECKSUM_TYPE, CheckSum.toString(CheckSumType.ADLER32));
        metadata.add(ReadOnlyStorageMetadata.CHECKSUM,
                     new String(Hex.encodeHex(CheckSumTests.calculateCheckSum(testSourceDirectory.listFiles(),
                                                                              CheckSumType.ADLER32))));
        FileUtils.writeStringToFile(metadataFile, metadata.toJsonString());
        fetchedFile = fetcher.fetch(testSourceDirectory.getAbsolutePath(),
                                    testDestinationDirectory.getAbsolutePath() + "7");
        assertNotNull(fetchedFile);
        assertEquals(fetchedFile.getAbsolutePath(), testDestinationDirectory.getAbsolutePath()
                                                    + "7");
View Full Code Here

Examples of voldemort.store.readonly.ReadOnlyStorageMetadata.toJsonString()

        // Correct metadata checksum - CRC32
        metadata.add(ReadOnlyStorageMetadata.CHECKSUM_TYPE, CheckSum.toString(CheckSumType.CRC32));
        metadata.add(ReadOnlyStorageMetadata.CHECKSUM,
                     new String(Hex.encodeHex(CheckSumTests.calculateCheckSum(testSourceDirectory.listFiles(),
                                                                              CheckSumType.CRC32))));
        FileUtils.writeStringToFile(metadataFile, metadata.toJsonString());
        fetchedFile = fetcher.fetch(testSourceDirectory.getAbsolutePath(),
                                    testDestinationDirectory.getAbsolutePath() + "8");
        assertNotNull(fetchedFile);
        assertEquals(fetchedFile.getAbsolutePath(), testDestinationDirectory.getAbsolutePath()
                                                    + "8");
View Full Code Here

Examples of voldemort.store.readonly.ReadOnlyStorageMetadata.toJsonString()

        metadata.add(ReadOnlyStorageMetadata.CHECKSUM_TYPE, CheckSum.toString(CheckSumType.MD5));
        // Correct metadata checksum - MD5
        metadata.add(ReadOnlyStorageMetadata.CHECKSUM,
                     new String(Hex.encodeHex(CheckSumTests.calculateCheckSum(testSourceDirectory.listFiles(),
                                                                              CheckSumType.MD5))));
        FileUtils.writeStringToFile(metadataFile, metadata.toJsonString());

        File tempDest = new File(testDestinationDirectory.getAbsolutePath() + "1");
        if(tempDest.exists()) {

            deleteDir(tempDest);
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.