Ejemplo n.º 1
0
  /** Tests that when we're within range, it passes */
  @Test(expected = IllegalArgumentException.class)
  public void zeroBufferSize() {
    CassandraFig cassandraFig = mock(CassandraFig.class);

    final int thriftSize = 0;

    when(cassandraFig.getThriftBufferSize()).thenReturn(thriftSize);

    SerializationFig serializationFig = mock(SerializationFig.class);

    new SettingsValidation(cassandraFig, serializationFig);
  }
Ejemplo n.º 2
0
  /** Tests that when we're within range, it passes */
  @Test(expected = IllegalArgumentException.class)
  public void outOfBounds() {
    CassandraFig cassandraFig = mock(CassandraFig.class);

    final int thriftSize = 15728640;

    final int usableThriftSize = (int) (thriftSize * .9);

    when(cassandraFig.getThriftBufferSize()).thenReturn(thriftSize);

    SerializationFig serializationFig = mock(SerializationFig.class);

    when(serializationFig.getMaxEntitySize()).thenReturn(usableThriftSize + 1);

    new SettingsValidation(cassandraFig, serializationFig);
  }
Ejemplo n.º 3
0
  /** Tests that when we're within range, it passes */
  @Test
  public void withinBounds() {
    CassandraFig cassandraFig = mock(CassandraFig.class);

    final int thriftSize = 15728640;

    final int usableThriftSize = (int) (thriftSize * .9);

    when(cassandraFig.getThriftBufferSize()).thenReturn(thriftSize);

    SerializationFig serializationFig = mock(SerializationFig.class);

    when(serializationFig.getMaxEntitySize()).thenReturn(usableThriftSize);

    new SettingsValidation(cassandraFig, serializationFig);

    when(serializationFig.getMaxEntitySize()).thenReturn(usableThriftSize - 1);

    new SettingsValidation(cassandraFig, serializationFig);
  }
 @Override
 public UniqueValueSet load(
     final ApplicationScope colScope, final String type, final Collection<Field> fields)
     throws ConnectionException {
   return load(colScope, ConsistencyLevel.valueOf(cassandraFig.getReadCL()), type, fields);
 }