org.apache.commons.collections.set.ListOrderedSet Java Examples

The following examples show how to use org.apache.commons.collections.set.ListOrderedSet. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SaveToCassandraOperationsServiceTest.java    From Decision with Apache License 2.0 6 votes vote down vote up
@Test
public void testAlterTable() throws Exception {
    Exception ex= null;
    try {

        columns.add(new ColumnNameTypeValue("newfield", ColumnType.STRING, "my new value"));
        Set<String> oldColumnNamesnew= new ListOrderedSet();
        oldColumnNamesnew.add("id");
        oldColumnNamesnew.add("name");
        oldColumnNamesnew.add("enabled");
        oldColumnNamesnew.add("timestamp");

        service.alterTable(TABLE, oldColumnNamesnew, columns);

    } catch (Exception e)  {
        ex= e;
    }
    assertEquals("Expected null but exception found", null, ex);

}
 
Example #2
Source File: StreamToActionBusCallbackTest.java    From Decision with Apache License 2.0 6 votes vote down vote up
@Before
public void setUp() throws Exception {
    siddhiManager= new StreamingSiddhiConfiguration().siddhiManager();
    siddhiManager.defineStream(StreamsHelper.STREAM_DEFINITION);
    metadataService= new StreamMetadataService(siddhiManager);
    javaToSiddhiSerializer= new JavaToSiddhiSerializer(metadataService);
    javaToAvroSerializer = new JavaToAvroSerializer(new SpecificDatumReader(InsertMessage.getClassSchema()));

    Set<StreamAction> activeActions= new ListOrderedSet();
    activeActions.add(StreamAction.LISTEN);

    producer= Mockito.mock(Producer.class);
    avroProducer= Mockito.mock(Producer.class);
    //List<KeyedMessage<String, String>> km= any();
    //doNothing().when(producer).send(km);
    doNothing().when(producer).send(Matchers.<List<KeyedMessage<String, String>>>any());

    cbk= new StreamToActionBusCallback(activeActions, streamName, avroProducer,
            javaToSiddhiSerializer, javaToAvroSerializer);
}
 
Example #3
Source File: DumpMetadataTask.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
/**
 * Determines the columns that are present in the given result set.
 * 
 * @param resultSet The result set
 * @return The columns
 */
private Set getColumnsInResultSet(ResultSet resultSet) throws SQLException
{
    ListOrderedSet    result   = new ListOrderedSet();
    ResultSetMetaData metaData = resultSet.getMetaData();

    for (int idx = 1; idx <= metaData.getColumnCount(); idx++)
    {
        result.add(metaData.getColumnName(idx).toUpperCase());
    }
    
    return result;
}
 
Example #4
Source File: DumpMetadataTask.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
/**
 * Determines the columns that are present in the given result set.
 * 
 * @param resultSet The result set
 * @return The columns
 */
private Set getColumnsInResultSet(ResultSet resultSet) throws SQLException
{
    ListOrderedSet    result   = new ListOrderedSet();
    ResultSetMetaData metaData = resultSet.getMetaData();

    for (int idx = 1; idx <= metaData.getColumnCount(); idx++)
    {
        result.add(metaData.getColumnName(idx).toUpperCase());
    }
    
    return result;
}
 
Example #5
Source File: StreamsHelper.java    From Decision with Apache License 2.0 5 votes vote down vote up
public static StratioStreamingMessage getSampleMessage()    {
    Set<StreamAction> actions= new ListOrderedSet();
    actions.add(StreamAction.LISTEN);
    StratioStreamingMessage message= new StratioStreamingMessage(STREAM_NAME, Long.parseLong("1234567890"), COLUMNS);
    message.setActiveActions(actions);
    return message;
}
 
Example #6
Source File: ActionBaseFunctionHelper.java    From Decision with Apache License 2.0 5 votes vote down vote up
protected void initialize()  {
    conf= ConfigFactory.load();

    ZOO_HOST= getHostsStringFromList(conf.getStringList("zookeeper.hosts"));
    MONGO_HOST= getHostsStringFromList(conf.getStringList("mongo.hosts"));

    siddhiManager= new StreamingSiddhiConfiguration().siddhiManager();
    streamStatusDao= new StreamStatusDao();
    ServiceConfiguration serviceConfiguration= new ServiceConfiguration();
    callbackService= serviceConfiguration.callbackService();

    streamOperationsService= new StreamOperationService(siddhiManager, streamStatusDao, callbackService);

    streamOperationsService.createStream(StreamsHelper.STREAM_NAME, StreamsHelper.COLUMNS);
    String queryId= streamOperationsService.addQuery(StreamsHelper.STREAM_NAME, StreamsHelper.QUERY);
    message= StreamsHelper.getSampleMessage();
    message.setRequest(StreamsHelper.QUERY);

    validators= new ListOrderedSet();
    StreamNameNotEmptyValidation validation= new StreamNameNotEmptyValidation();
    validators.add(validation);

    Properties properties = new Properties();
    properties.put("serializer.class", "kafka.serializer.StringEncoder");
    properties.put("metadata.broker.list",  conf.getStringList("kafka.hosts").get(0));
    properties.put("producer.type", "async");

    producer = new kafka.javaapi.producer.Producer<String, String>(new ProducerConfig(properties));

    ConfigurationContext configurationContext = new ConfigurationContext();
    try {
        ClusterSyncManager.getClusterSyncManager(configurationContext, null);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
Example #7
Source File: SetUtils.java    From Penetration_Testing_POC with Apache License 2.0 2 votes vote down vote up
/**
 * Returns a set that maintains the order of elements that are added
 * backed by the given set.
 * <p>
 * If an element is added twice, the order is determined by the first add.
 * The order is observed through the iterator or toArray.
 *
 * @param set  the set to order, must not be null
 * @return an ordered set backed by the given set
 * @throws IllegalArgumentException  if the Set is null
 */
public static Set orderedSet(Set set) {
    return ListOrderedSet.decorate(set);
}