Package co.nubetech.crux.model

Examples of co.nubetech.crux.model.ValueType


    assertNull(bytes);
  }

  @Test
  public void testAddToByteArrayNullToNotNull() throws CruxException {
    ValueType valueType = new ValueType();
    valueType.setClassName("java.lang.String");

    String value = null;
    byte[] bytes = BytesHelper.addToByteArray(valueType, value,
        Bytes.toBytes(true));
    assertArrayEquals(Bytes.toBytes(true), bytes);
View Full Code Here


    assertArrayEquals(Bytes.toBytes(true), bytes);
  }

  @Test
  public void testAddToByteArrayLongToNull() throws CruxException {
    ValueType valueType = new ValueType();
    valueType.setClassName("java.lang.Long");

    Long value = 10l;
    byte[] bytes = BytesHelper.addToByteArray(valueType, "10", null);
    assertEquals(0, Bytes.compareTo(Bytes.toBytes(10l), bytes));
  }
View Full Code Here

    assertEquals(0, Bytes.compareTo(Bytes.toBytes(10l), bytes));
  }

  @Test
  public void testAddToByteArrayLongToString() throws CruxException {
    ValueType valueType = new ValueType();
    valueType.setClassName("java.lang.Long");

    byte[] bytes = BytesHelper.addToByteArray(valueType, "10",
        Bytes.toBytes("I am a string"));
    byte[] expected = Bytes.add(Bytes.toBytes("I am a string"),
        Bytes.toBytes(10l));
View Full Code Here

    assertArrayEquals(expected, bytes);
  }

  @Test
  public void testAddToByteArrayLongToIntToString() throws CruxException {
    ValueType valueType = new ValueType();
    // int to string
    valueType.setClassName("java.lang.Integer");

    byte[] bytes = BytesHelper.addToByteArray(valueType, "10",
        Bytes.toBytes("I am a string"));
    byte[] expected = Bytes.add(Bytes.toBytes("I am a string"),
        Bytes.toBytes(10));
    assertArrayEquals(expected, bytes);

    // long to above
    valueType.setClassName("java.lang.Long");
    expected = Bytes.add(bytes, Bytes.toBytes(100l));
    bytes = BytesHelper.addToByteArray(valueType, "100", bytes);
    assertArrayEquals(expected, bytes);
  }
View Full Code Here

    assertArrayEquals(expected, bytes);
  }

  @Test(expected = CruxException.class)
  public void testNotSupportedType() throws CruxException {
    ValueType type = new ValueType();
    type.setClassName("co.nubetech.crux.util.CruxException");

    BytesHelper.addToByteArray(type, "value", null);
  }
View Full Code Here

        Bytes.toShort(BytesHelper.getBytes("java.lang.Short", "200")));
  }

  @Test
  public void testAddToByteArrayBooleanToNull() throws CruxException {
    ValueType valueType = new ValueType();
    valueType.setClassName("java.lang.Boolean");
    byte[] bytes = BytesHelper.addToByteArray(valueType, "true", null);
    assertEquals(0, Bytes.compareTo(Bytes.toBytes(true), bytes));
  }
View Full Code Here

    mapping.setTableName("tableDoesNotExist");

    RowAlias rAlias = new RowAlias();
    rAlias.setAlias("rowkey");
    rAlias.setLength(18);
    ValueType valueType = new ValueType();
    valueType.setClassName("java.lang.String");
    rAlias.setValueType(valueType);
    mapping.addRowAlias(rAlias);

    RowAliasFilter rowFilter = new RowAliasFilter();
    FilterType filter1 = new FilterType();
View Full Code Here

    mapping.setTableName("tableDoesNotExist");

    RowAlias rAlias = new RowAlias();
    rAlias.setAlias("rowkey");
    rAlias.setLength(18);
    ValueType valueType = new ValueType();
    valueType.setClassName("java.lang.String");
    rAlias.setValueType(valueType);

    RowAlias rAlias1 = new RowAlias();
    rAlias1.setAlias("rowkey1");
    rAlias1.setLength(3);
View Full Code Here

  @Test
  public void testGetColumnFilterLongGreaterThan() throws CruxException {
    FilterType type = new FilterType();
    type.setType("Greater Than");

    ValueType valueType = new ValueType();
    valueType.setClassName("java.lang.Long");

    ColumnAlias alias = new ColumnAlias();
    alias.setColumnFamily("cf");
    alias.setQualifier("qualifier");
    alias.setValueType(valueType);
View Full Code Here

  @Test
  public void testGetColumnFilterLongEquals() throws CruxException {
    FilterType type = new FilterType();
    type.setType("Equals");

    ValueType valueType = new ValueType();
    valueType.setClassName("java.lang.Long");

    ColumnAlias alias = new ColumnAlias();
    alias.setColumnFamily("cf");
    alias.setQualifier("qualifier");
    alias.setValueType(valueType);
View Full Code Here

TOP

Related Classes of co.nubetech.crux.model.ValueType

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.