Search in sources :

Example 31 with Props

use of voldemort.utils.Props in project voldemort by voldemort.

the class VoldemortConfig method loadFromVoldemortHome.

public static VoldemortConfig loadFromVoldemortHome(String voldemortHome, String voldemortConfigDir) {
    if (!Utils.isReadableDir(voldemortHome))
        throw new ConfigurationException("Attempt to load configuration from VOLDEMORT_HOME, " + voldemortHome + " failed. That is not a readable directory.");
    if (voldemortConfigDir == null) {
        voldemortConfigDir = voldemortHome + File.separator + "config";
    }
    String propertiesFile = voldemortConfigDir + File.separator + "server.properties";
    if (!Utils.isReadableFile(propertiesFile))
        throw new ConfigurationException(propertiesFile + " is not a readable configuration file.");
    Props properties = null;
    try {
        properties = new Props(new File(propertiesFile));
        properties.put(VOLDEMORT_HOME, voldemortHome);
        properties.put(METADATA_DIRECTORY, voldemortConfigDir);
    } catch (IOException e) {
        throw new ConfigurationException(e);
    }
    return new VoldemortConfig(properties);
}
Also used : ConfigurationException(voldemort.utils.ConfigurationException) IOException(java.io.IOException) Props(voldemort.utils.Props) File(java.io.File)

Example 32 with Props

use of voldemort.utils.Props in project voldemort by voldemort.

the class PartitionPrefixedBdbStorageEngineTest method setUp.

@Before
public void setUp() throws Exception {
    bdbMasterDir = TestUtils.createTempDir();
    FileDeleteStrategy.FORCE.delete(bdbMasterDir);
    // lets use all the default values.
    Props props = new Props();
    props.put("node.id", 1);
    props.put("voldemort.home", "test/common/voldemort/config");
    VoldemortConfig voldemortConfig = new VoldemortConfig(props);
    voldemortConfig.setBdbCacheSize(10 * 1024 * 1024);
    voldemortConfig.setBdbOneEnvPerStore(true);
    voldemortConfig.setBdbDataDirectory(bdbMasterDir.toURI().getPath());
    voldemortConfig.setBdbPrefixKeysWithPartitionId(true);
    bdbStorage = new BdbStorageConfiguration(voldemortConfig);
}
Also used : Props(voldemort.utils.Props) VoldemortConfig(voldemort.server.VoldemortConfig) Before(org.junit.Before)

Example 33 with Props

use of voldemort.utils.Props in project voldemort by voldemort.

the class StreamingClientTest method testUnInitializedClientPreventNPE.

/**
     * Checks if the streamingClient stays calm and not throw NPE when calling
     * commit before it has been initialized
     */
@Test
public void testUnInitializedClientPreventNPE() {
    Props property = new Props();
    property.put("streaming.platform.bootstrapURL", SERVER_LOCAL_URL + serverPorts[0]);
    StreamingClientConfig config = new StreamingClientConfig(property);
    BaseStreamingClient streamer = new BaseStreamingClient(config);
    try {
        streamer.commitToVoldemort();
    } catch (NullPointerException e) {
        e.printStackTrace();
        Assert.fail("Should not throw NPE at this stage even though streamingSession not initialized");
    }
}
Also used : Props(voldemort.utils.Props) Test(org.junit.Test)

Aggregations

Props (voldemort.utils.Props)33 VoldemortConfig (voldemort.server.VoldemortConfig)14 File (java.io.File)13 StoreDefinition (voldemort.store.StoreDefinition)10 Test (org.junit.Test)9 ByteArray (voldemort.utils.ByteArray)9 IOException (java.io.IOException)8 Path (org.apache.hadoop.fs.Path)6 Cluster (voldemort.cluster.Cluster)6 JobConf (org.apache.hadoop.mapred.JobConf)4 VoldemortException (voldemort.VoldemortException)4 BdbStorageConfiguration (voldemort.store.bdb.BdbStorageConfiguration)4 ObsoleteVersionException (voldemort.versioning.ObsoleteVersionException)4 HashMap (java.util.HashMap)3 Map (java.util.Map)3 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)3 OptionParser (joptsimple.OptionParser)3 OptionSet (joptsimple.OptionSet)3 Before (org.junit.Before)3 DefaultSerializerFactory (voldemort.serialization.DefaultSerializerFactory)3