/*
 * Copyright 2015 Red Hat, Inc. and/or its affiliates.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.dashbuilder.dataset;

import org.dashbuilder.test.BaseCDITest;
import org.jboss.arquillian.junit.Arquillian;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;

@RunWith(Arquillian.class)
public class DataSetSubsystemCDITest extends BaseCDITest {

    DataSetFilterTest dataSetFilterTest = new DataSetFilterTest();
    DataSetGroupTest dataSetGroupTest = new DataSetGroupTest();
    DataSetNestedGroupTest nestedGroupTest = new DataSetNestedGroupTest();
    DataSetSortTest dataSetSortTest = new DataSetSortTest();
    DataSetTrimTest dataSetTrimTest = new DataSetTrimTest();

    @Before
    public void setUp() throws Exception {
        dataSetFilterTest.setUp();
        dataSetGroupTest.setUp();
        nestedGroupTest.setUp();
        dataSetSortTest.setUp();
        dataSetTrimTest.setUp();
    }

    @Test
    public void testFilter() throws Exception {
        dataSetFilterTest.testColumnTypes();
        dataSetFilterTest.testFilterByString();
        dataSetFilterTest.testFilterByNumber();
        dataSetFilterTest.testFilterByDate();
        dataSetFilterTest.testFilterMultiple();
        dataSetFilterTest.testANDExpression();
        dataSetFilterTest.testNOTExpression();
        dataSetFilterTest.testORExpression();
        dataSetFilterTest.testORExpressionMultilple();
        dataSetFilterTest.testLogicalExprNonEmpty();
        dataSetFilterTest.testCombinedExpression();
        dataSetFilterTest.testCombinedExpression2();
        dataSetFilterTest.testCombinedExpression3();
        dataSetFilterTest.testLikeOperatorCaseSensitive();
        dataSetFilterTest.testLikeOperatorNonCaseSensitive();
        dataSetFilterTest.testFilterByStringWithPreProcessor();
    }

    @Test
    public void testGroup() throws Exception {
        dataSetGroupTest.testDataSetFunctions();
        dataSetGroupTest.testGroupByLabelDynamic();
        dataSetGroupTest.testGroupByYearDynamic();
        dataSetGroupTest.testGroupByMonthDynamic();
        dataSetGroupTest.testGroupByMonthDynamicNonEmpty();
        dataSetGroupTest.testGroupByDayDynamic();
        dataSetGroupTest.testGroupByWeek();
        dataSetGroupTest.testGroupByMonthReverse();
        dataSetGroupTest.testGroupByMonthFixed();
        dataSetGroupTest.testGroupByMonthFirstMonth();
        dataSetGroupTest.testGroupByMonthFirstMonthReverse();
        dataSetGroupTest.testGroupByQuarter();
        dataSetGroupTest.testGroupByDateOneRow();
        dataSetGroupTest.testGroupByDateOneDay();
        dataSetGroupTest.testGroupAndCountSameColumn();
        dataSetGroupTest.testGroupNumberAsLabel();
    }

    @Test
    public void testNestedGroups() throws Exception {
        nestedGroupTest.testGroupSelectionFilter();
        nestedGroupTest.testNestedGroupFromMultipleSelection();
        nestedGroupTest.testNestedGroupRequiresSelection();
        nestedGroupTest.testNoResultsSelection();
        nestedGroupTest.testThreeNestedLevels();
        nestedGroupTest.testGroupByQuarter();
    }

    @Test
    public void testSort() throws Exception {
        dataSetSortTest.testSortByString();
        dataSetSortTest.testSortByNumber();
        dataSetSortTest.testSortByDate();
        dataSetSortTest.testSortMultiple();
        dataSetSortTest.testGroupAndSort();
    }

    @Test
    public void testTrim() throws Exception {
        dataSetTrimTest.testTrim();
        dataSetTrimTest.testDuplicatedColumns();
    }
}

@@ -649,16 +649,50 @@
 taset;%0A%0A
+import org.dashbuilder.Bootstrap;%0A
 import o
@@ -852,16 +852,45 @@
 nWith;%0A%0A
+import javax.inject.Inject;%0A%0A
 @RunWith
@@ -968,16 +968,54 @@
 Test %7B%0A%0A
+    @Inject%0A    Bootstrap bootstrap;%0A%0A
     Data
@@ -1045,30 +1045,29 @@
 lterTest
- = new
+;%0A   
  DataSet
 FilterTe
@@ -1062,20 +1062,34 @@
 aSet
-Filter
+GroupTest dataSetGroup
 Test
-()
 ;%0A  
@@ -1089,32 +1089,38 @@
 est;%0A    DataSet
+Nested
 GroupTest dataSe
@@ -1109,36 +1109,219 @@
 edGroupTest 
-dataSetGroup
+nestedGroupTest;%0A    DataSetSortTest dataSetSortTest;%0A    DataSetTrimTest dataSetTrimTest;%0A%0A    @Before%0A    public void setUp() throws Exception %7B%0A        bootstrap.init();%0A%0A        dataSetFilter
 Test = new D
@@ -1322,29 +1322,30 @@
  new DataSet
-Group
+Filter
 Test();%0A    
@@ -1340,37 +1340,35 @@
 Test();%0A    
-D
+    d
 ataSet
-Nested
 GroupTest ne
@@ -1356,32 +1356,66 @@
 dataSetGroupTest
+ = new DataSetGroupTest();%0A       
  nestedGroupTest
@@ -1447,39 +1447,27 @@
 Test();%0A    
-DataSetSortTest
+   
  dataSetSort
@@ -1496,39 +1496,27 @@
 Test();%0A    
-DataSetTrimTest
+   
  dataSetTrim
@@ -1550,63 +1550,8 @@
 );%0A%0A
-    @Before%0A    public void setUp() throws Exception %7B%0A
     

Fix CDI tests failing on Jenkins