@Test
  public void testState() throws IOException {
    final File fcontent = File.createTempFile("foo", "bar");
    final Properties properties = new Properties();
    final Date dt = new Date();

    properties.put("int", 10453);
    properties.put("long", 1000000L);
    properties.put("date", dt);

    final OutputStream out = new FileOutputStream(fcontent);
    properties.store(out);

    final Properties loadProperties = new Properties();

    final InputStream in = new FileInputStream(fcontent);
    loadProperties.load(in);

    assertNotNull(properties.get("int"));
    assertNotNull(properties.get("long"));
    assertNotNull(properties.get("date"));

    assertEquals(10453, properties.get("int"));
    assertEquals(1000000L, properties.get("long"));
    assertEquals(dt, properties.get("date"));
  }
 @BeforeClass
 public static void setUpClass() throws Exception {
   Properties props = new Properties();
   props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
   props.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
   props.put(Context.PROVIDER_URL, "localhost:1099");
   ic = new InitialContext(props);
 }
Example #3
0
  private Properties createConf(boolean local) {
    Properties conf = new Properties();
    if (local) {
      conf.put(CLIENT_IN_PROCESS.key, "true");
      conf.put("spark.master", "local");
      conf.put("spark.app.name", "SparkClientSuite Local App");
    } else {
      String classpath = System.getProperty("java.class.path");
      conf.put("spark.master", "local");
      conf.put("spark.app.name", "SparkClientSuite Remote App");
      conf.put("spark.driver.extraClassPath", classpath);
      conf.put("spark.executor.extraClassPath", classpath);
      conf.put(LIVY_JARS.key, "");
    }

    return conf;
  }