Search in sources :

Example 1 with DataSourceAttributeModel

use of com.sldeditor.datasource.config.DataSourceAttributeModel in project sldeditor by robward-scisys.

the class DataSourceAttributeModelTest method testIsCellEditable.

/**
 * Test method for {@link com.sldeditor.datasource.config.DataSourceAttributeModel#isCellEditable(int, int)}.
 * Test method for {@link com.sldeditor.datasource.config.DataSourceAttributeModel#setConnectedToDataSource(boolean)}.
 */
@Test
public void testIsCellEditable() {
    DataSourceAttributeModel model = new DataSourceAttributeModel();
    // Not connected to data source
    assertTrue(model.isCellEditable(0, 0));
    assertTrue(model.isCellEditable(0, 1));
    // Connected to data source
    model.setConnectedToDataSource(true);
    assertFalse(model.isCellEditable(0, 0));
    assertTrue(model.isCellEditable(0, 2));
}
Also used : DataSourceAttributeModel(com.sldeditor.datasource.config.DataSourceAttributeModel) Test(org.junit.Test)

Example 2 with DataSourceAttributeModel

use of com.sldeditor.datasource.config.DataSourceAttributeModel in project sldeditor by robward-scisys.

the class DataSourceAttributeModelTest method testGetTypeData.

/**
 * Test method for {@link com.sldeditor.datasource.config.DataSourceAttributeModel#getTypeData()}.
 */
@Test
public void testGetTypeData() {
    DataSourceAttributeModel model = new DataSourceAttributeModel();
    assertTrue(model.getTypeData().length > 0);
}
Also used : DataSourceAttributeModel(com.sldeditor.datasource.config.DataSourceAttributeModel) Test(org.junit.Test)

Example 3 with DataSourceAttributeModel

use of com.sldeditor.datasource.config.DataSourceAttributeModel in project sldeditor by robward-scisys.

the class DataSourceAttributeModelTest method testTimestampField.

/**
 * Test method for {@link com.sldeditor.datasource.config.DataSourceAttributeModel#addNewField()}.
 */
@Test
public void testTimestampField() {
    DataSourceAttributeModel model = new DataSourceAttributeModel();
    assertEquals(0, model.getRowCount());
    model.addNewField();
    assertEquals(1, model.getRowCount());
    model.setValueAt("Timestamp", 0, 1);
    Object actualResult = model.getValueAt(0, 1);
    assertNotNull(actualResult);
}
Also used : DataSourceAttributeModel(com.sldeditor.datasource.config.DataSourceAttributeModel) Test(org.junit.Test)

Example 4 with DataSourceAttributeModel

use of com.sldeditor.datasource.config.DataSourceAttributeModel in project sldeditor by robward-scisys.

the class DataSourceAttributeModelTest method testAddNewField.

/**
 * Test method for {@link com.sldeditor.datasource.config.DataSourceAttributeModel#addNewField()}.
 * Test method for {@link com.sldeditor.datasource.config.DataSourceAttributeModel#removeFields(int[])}.
 */
@Test
public void testAddNewField() {
    DataSourceAttributeModel model = new DataSourceAttributeModel();
    assertEquals(0, model.getRowCount());
    model.addNewField();
    assertEquals(1, model.getRowCount());
    model.addNewField();
    model.addNewField();
    assertEquals(3, model.getRowCount());
    model.removeFields(null);
    assertEquals(3, model.getRowCount());
    int[] selectedRowIndexes = new int[3];
    selectedRowIndexes[0] = 0;
    selectedRowIndexes[1] = -1;
    selectedRowIndexes[2] = 5;
    model.removeFields(selectedRowIndexes);
    assertEquals(2, model.getRowCount());
}
Also used : DataSourceAttributeModel(com.sldeditor.datasource.config.DataSourceAttributeModel) Test(org.junit.Test)

Example 5 with DataSourceAttributeModel

use of com.sldeditor.datasource.config.DataSourceAttributeModel in project sldeditor by robward-scisys.

the class DataSourceAttributeModelTest method testGetColumnCount.

/**
 * Test method for {@link com.sldeditor.datasource.config.DataSourceAttributeModel#getColumnCount()}.
 * Test method for {@link com.sldeditor.datasource.config.DataSourceAttributeModel#getColumnName(int)}.
 */
@Test
public void testGetColumnCount() {
    DataSourceAttributeModel model = new DataSourceAttributeModel();
    assertEquals(3, model.getColumnCount());
    String col1 = model.getColumnName(0);
    String col2 = model.getColumnName(1);
    String col3 = model.getColumnName(2);
    assertFalse(col1.isEmpty());
    assertFalse(col2.isEmpty());
    assertFalse(col3.isEmpty());
}
Also used : DataSourceAttributeModel(com.sldeditor.datasource.config.DataSourceAttributeModel) Test(org.junit.Test)

Aggregations

DataSourceAttributeModel (com.sldeditor.datasource.config.DataSourceAttributeModel)6 Test (org.junit.Test)6 DataSourceAttributeData (com.sldeditor.datasource.attribute.DataSourceAttributeData)1 DataSourceAttributeListInterface (com.sldeditor.datasource.attribute.DataSourceAttributeListInterface)1 ArrayList (java.util.ArrayList)1