Package eu.stratosphere.configuration

Examples of eu.stratosphere.configuration.Configuration


    dataFileWriter.close();
  }
 
  @Test
  public void testDeserialisation() throws IOException {
    Configuration parameters = new Configuration();
    format.setFilePath(testFile.toURI().toString());
    format.configure(parameters);
    FileInputSplit[] splits = format.createInputSplits(1);
    Assert.assertEquals(splits.length, 1);
    format.open(splits[0]);
View Full Code Here


    String sourceTable = "books";
    String targetTable = "newbooks";
    String driverPath = "org.apache.derby.jdbc.EmbeddedDriver";
    String dbUrl = "jdbc:derby:memory:ebookshop";

    Configuration cfg = new Configuration();
    cfg.setString("driver", driverPath);
    cfg.setString("url", dbUrl);
    cfg.setString("query", "insert into " + targetTable + " (id, title, author, price, qty) values (?,?,?,?,?)");
    cfg.setInteger("fields", 5);
    cfg.setClass("type0", IntValue.class);
    cfg.setClass("type1", StringValue.class);
    cfg.setClass("type2", StringValue.class);
    cfg.setClass("type3", FloatValue.class);
    cfg.setClass("type4", IntValue.class);

    jdbcOutputFormat = new JDBCOutputFormat();
    jdbcOutputFormat.configure(cfg);
    jdbcOutputFormat.open(0,1);
View Full Code Here

  @Test
  public void testOpen() throws IOException {
    final int[] fileContent = {1,2,3,4,5,6,7,8};
    final FileInputSplit split = createTempFile(fileContent)
 
    final Configuration parameters = new Configuration();
    parameters.setInteger(FixedLengthInputFormat.RECORDLENGTH_PARAMETER_KEY, 8);
   
    format.configure(parameters);
    format.open(split);
    assertEquals(0, format.getSplitStart());
    assertEquals(0, format.getReadBufferSize() % 8);
    format.close();

    parameters.setInteger(FixedLengthInputFormat.RECORDLENGTH_PARAMETER_KEY, 13);
    format.configure(parameters);
    format.close();
    format.open(split);
    assertEquals(0, format.getReadBufferSize() % 13);
    format.close();
   
    parameters.setInteger(FixedLengthInputFormat.RECORDLENGTH_PARAMETER_KEY, 27);
    format.configure(parameters);
    format.close();
    format.open(split);
    assertEquals(0, format.getReadBufferSize() % 27);
    format.close();
View Full Code Here

  @Test
  public void testRead() throws IOException {
    final int[] fileContent = {1,2,3,4,5,6,7,8};
    final FileInputSplit split = createTempFile(fileContent);
   
    final Configuration parameters = new Configuration();
   
    parameters.setInteger(FixedLengthInputFormat.RECORDLENGTH_PARAMETER_KEY, 8);
   
    format.configure(parameters);
    format.open(split);
   
    Record record = new Record();
View Full Code Here

  @Test
  public void testReadFail() throws IOException {
    final int[] fileContent = {1,2,3,4,5,6,7,8,9};
    final FileInputSplit split = createTempFile(fileContent);
   
    final Configuration parameters = new Configuration();
    parameters.setInteger(FixedLengthInputFormat.RECORDLENGTH_PARAMETER_KEY, 8);
   
    format.configure(parameters);
    format.open(split);
   
    Record record = new Record();
View Full Code Here

    compareResultsByLinesInMemory(EXPECTED_RESULT, resultPath);
  }

  @Parameters
  public static Collection<Object[]> getConfigurations() {
    Configuration config = new Configuration();
    config.setInteger("dop", 4);
    return toParameterList(config);
  }
View Full Code Here

    compareResultsByLinesInMemory(EXPECTED, resultPath);
  }

  @Parameters
  public static Collection<Object[]> getConfigurations() {
    Configuration config = new Configuration();
    config.setInteger("All2AllSPTest#NoSubtasks", 4);
    return toParameterList(config);
  }
View Full Code Here

    compareResultsByLinesInMemory(EXPECTED, resultPath);
  }

  @Parameters
  public static Collection<Object[]> getConfigurations() {
    Configuration config = new Configuration();
    config.setInteger("ComputeEdgeDegreesTest#NumSubtasks", 4);
    return toParameterList(config);
  }
View Full Code Here

    return plan;
  }

  @Parameters
  public static Collection<Object[]> getConfigurations() {
    Configuration config1 = new Configuration();
    config1.setInteger("IterationAllReducer#NoSubtasks", NUM_SUBTASKS);
    return toParameterList(config1);
  }
View Full Code Here

 
  @Test
  public void testConfigure()
  {
    try {
      Configuration config = new Configuration();
     
      // check missing number of fields
      boolean validConfig = true;
      try {
        format.configure(config);
      } catch(IllegalArgumentException iae) {
        validConfig = false;
      } catch(IllegalStateException ise) {
        validConfig = false;
      }
      assertFalse(validConfig);
     
      // check missing file parser
      config.setInteger(CsvOutputFormat.NUM_FIELDS_PARAMETER, 2);
      validConfig = true;
      try {
        format.configure(config);
      } catch(IllegalArgumentException iae) {
        validConfig = false;
      } catch(IllegalStateException ise) {
        validConfig = false;
      }
      assertFalse(validConfig);
     
      // check valid config
      config.setClass(CsvOutputFormat.FIELD_TYPE_PARAMETER_PREFIX + 0, StringValue.class);
      config.setClass(CsvOutputFormat.FIELD_TYPE_PARAMETER_PREFIX + 1, IntValue.class);
      validConfig = true;
      try {
        format.configure(config);
      } catch(IllegalArgumentException iae) {
        validConfig = false;
      }
      assertTrue(validConfig);
     
      // check invalid file parser config
      config.setInteger(CsvOutputFormat.NUM_FIELDS_PARAMETER, 3);
      validConfig = true;
      try {
        format.configure(config);
      } catch(IllegalArgumentException iae) {
        validConfig = false;
      }
      assertFalse(validConfig);
     
      // check valid config
      config.setClass(CsvOutputFormat.FIELD_TYPE_PARAMETER_PREFIX + 2, StringValue.class);
      validConfig = true;
      try {
        format.configure(config);
      } catch(IllegalArgumentException iae) {
        validConfig = false;
      }
      assertTrue(validConfig);
     
      // check valid config
      config.setString(CsvOutputFormat.FIELD_DELIMITER_PARAMETER, "|");
      validConfig = true;
      try {
        format.configure(config);
      } catch(IllegalArgumentException iae) {
        validConfig = false;
        System.out.println(iae.getMessage());
      }
      assertTrue(validConfig);
     
      // check invalid text pos config
      config.setInteger(CsvOutputFormat.RECORD_POSITION_PARAMETER_PREFIX + 1, 0);
      validConfig = true;
      try {
        format.configure(config);
      } catch(IllegalArgumentException iae) {
        validConfig = false;
      }
      assertFalse(validConfig);
     
      // check valid text pos config
      config.setInteger(CsvOutputFormat.RECORD_POSITION_PARAMETER_PREFIX + 0, 3);
      config.setInteger(CsvOutputFormat.RECORD_POSITION_PARAMETER_PREFIX + 2, 9);
      validConfig = true;
      try {
        format.configure(config);
      } catch(IllegalArgumentException iae) {
        validConfig = false;
View Full Code Here

TOP

Related Classes of eu.stratosphere.configuration.Configuration

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.