Examples of convertValue()


Examples of org.apache.howl.mapreduce.HowlOutputStorageDriver.convertValue()

    HowlOutputStorageDriver osd = new RCFileOutputDriver();

    osd.setSchema(jc, schema);
    osd.initialize(jc, new Properties());

    BytesRefArrayWritable bytesWritableOutput = (BytesRefArrayWritable) osd.convertValue(record);

    assertTrue(bytesWritableOutput.compareTo(bytesWritable) == 0);
  }

  private byte[][] buildBytesArray() throws UnsupportedEncodingException {
View Full Code Here

Examples of org.codehaus.jackson.map.ObjectMapper.convertValue()

 
        ObjectMapper om = new ObjectMapper();
 
        JsonNode node = om.readValue(decoded, JsonNode.class);
 
        Map<String, String> endpoints = om.convertValue(
          node.get("endpoint_entry"),
          new TypeReference<Map<String, String>>() {
          });
 
        for (Map.Entry<String, String> entry : endpoints.entrySet()) {
View Full Code Here

Examples of org.codehaus.jackson.map.ObjectMapper.convertValue()

  RemoteDependencyDeclaration rdep = new RemoteDependencyDeclaration(
    compref, id, multiple, rr, providerURL);

  ObjectMapper om = new ObjectMapper();

  List<String> instanceconstraints = om.convertValue(
    json.get(JSON_INSTANCE_CONSTRAINT),
    new TypeReference<ArrayList<String>>() {
    });

  rdep.getInstanceConstraints().addAll(instanceconstraints);
View Full Code Here

Examples of org.jbehave.core.steps.ParameterConverters.BooleanConverter.convertValue()

        assertThat(converter.accept(Boolean.TYPE), equalTo(true));
        assertThat(converter.accept(Boolean.class), equalTo(true));
        assertThat(converter.accept(WrongType.class), is(false));
        assertThat(converter.accept(mock(Type.class)), is(false));
        Type type = SomeSteps.methodFor("aMethodWithBoolean").getGenericParameterTypes()[0];
        assertThat((Boolean) converter.convertValue("true", type), is(true));
        assertThat((Boolean) converter.convertValue("false", type), is(false));
        assertThat((Boolean) converter.convertValue("whatever", type), is(false));
    }

    @Test
View Full Code Here

Examples of org.jbehave.core.steps.ParameterConverters.BooleanListConverter.convertValue()

    @Test
    public void shouldConvertBooleanList() throws IntrospectionException {
        ParameterConverter converter = new BooleanListConverter();
        Type type = SomeSteps.methodFor("aMethodWithBooleanList").getGenericParameterTypes()[0];
        assertThat(converter.accept(type), equalTo(true));
        List<Boolean> list = (List<Boolean>) converter.convertValue("true,false,true", type);
        assertThat(list.get(0), is(true));
        assertThat(list.get(1), is(false));
        assertThat(list.get(2), is(true));
    }
View Full Code Here

Examples of org.jbehave.core.steps.ParameterConverters.DateConverter.convertValue()

        assertThat(converter.accept(Date.class), equalTo(true));
        assertThat(converter.accept(WrongType.class), is(false));
        assertThat(converter.accept(mock(Type.class)), is(false));
        Type type = SomeSteps.methodFor("aMethodWithDate").getGenericParameterTypes()[0];
        String date = "01/01/2010";
        assertThat((Date) converter.convertValue(date, type), equalTo(DateConverter.DEFAULT_FORMAT.parse(date)));
    }

    @Test
    public void shouldConvertDateWithCustomFormat() throws ParseException, IntrospectionException {
        DateFormat customFormat = new SimpleDateFormat("yyyy-MM-dd");
View Full Code Here

Examples of org.jbehave.core.steps.ParameterConverters.EnumConverter.convertValue()

        ParameterConverter converter = new EnumConverter();
        assertThat(converter.accept(SomeEnum.class), equalTo(true));
        assertThat(converter.accept(WrongType.class), is(false));
        assertThat(converter.accept(mock(Type.class)), is(false));
        Type type = SomeSteps.methodFor("aMethodWithEnum").getGenericParameterTypes()[0];
        assertThat((SomeEnum) converter.convertValue("ONE", type), equalTo(SomeEnum.ONE));
    }
   
   
    @Test(expected = ParameterConvertionFailed.class)
    public void shouldFailToConvertEnumForValueNotDefined() throws IntrospectionException {
View Full Code Here

Examples of org.jbehave.core.steps.ParameterConverters.EnumConverter.convertValue()

   
    @Test(expected = ParameterConvertionFailed.class)
    public void shouldFailToConvertEnumForValueNotDefined() throws IntrospectionException {
        ParameterConverter converter = new EnumConverter();
        Type type = SomeSteps.methodFor("aMethodWithEnum").getGenericParameterTypes()[0];
        converter.convertValue("FOUR", type);
    }

    @SuppressWarnings("unchecked")
    @Test
    public void shouldConvertEnumList() throws IntrospectionException {
View Full Code Here

Examples of org.jbehave.core.steps.ParameterConverters.EnumListConverter.convertValue()

    @Test
    public void shouldConvertEnumList() throws IntrospectionException {
        ParameterConverter converter = new EnumListConverter();
        Type type = SomeSteps.methodFor("aMethodWithEnumList").getGenericParameterTypes()[0];
        assertThat(converter.accept(type), equalTo(true));
        List<SomeEnum> list = (List<SomeEnum>)converter.convertValue("ONE,TWO,THREE", type);
        assertThat(list.get(0), equalTo(SomeEnum.ONE));
        assertThat(list.get(1), equalTo(SomeEnum.TWO));
        assertThat(list.get(2), equalTo(SomeEnum.THREE));
    }
View Full Code Here

Examples of org.jbehave.core.steps.ParameterConverters.ExamplesTableConverter.convertValue()

        assertThat(converter.accept(ExamplesTable.class), is(true));
        assertThat(converter.accept(WrongType.class), is(false));
        assertThat(converter.accept(mock(Type.class)), is(false));
        Type type = SomeSteps.methodFor("aMethodWithExamplesTable").getGenericParameterTypes()[0];
        String value = "|col1|col2|\n|row11|row12|\n|row21|row22|\n";
        ExamplesTable table = (ExamplesTable) converter.convertValue(value, type);
        assertThat(table.getRowCount(), equalTo(2));
        Map<String, String> row1 = table.getRow(0);
        assertThat(row1.get("col1"), equalTo("row11"));
        assertThat(row1.get("col2"), equalTo("row12"));
        Map<String, String> row2 = table.getRow(1);
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.