Skip to content

Commit

Permalink
BZ-1276354: Tasks with ID higher than 1000 does not being completed. …
Browse files Browse the repository at this point in the history
…(change locale issue BZ:1261052)
  • Loading branch information
nmirasch authored and csadilek committed Dec 4, 2015
1 parent 15ea50b commit f8833c9
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 10 deletions.
Expand Up @@ -93,6 +93,19 @@
<artifactId>jbpm-console-ng-generic-client</artifactId>
<type>jar</type>
</dependency>

<!-- Test -->
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.google.gwt.gwtmockito</groupId>
<artifactId>gwtmockito</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down
Expand Up @@ -38,6 +38,7 @@
import com.google.gwt.view.client.DefaultSelectionEventManager;
import com.google.gwt.view.client.NoSelectionModel;
import com.google.gwt.view.client.SelectionChangeEvent;
import org.jbpm.console.ng.gc.client.experimental.grid.base.ExtendedPagedTable;
import org.jbpm.console.ng.gc.client.list.base.AbstractListView;
import org.jbpm.console.ng.ht.client.i18n.Constants;
import org.jbpm.console.ng.ht.client.resources.HumanTasksImages;
Expand All @@ -63,6 +64,15 @@
public class TasksListGridViewImpl extends AbstractListView<TaskSummary, TasksListGridPresenter>
implements TasksListGridPresenter.TaskListView {

public static final String COL_ID_ID ="t.id";
public static final String COL_ID_NAME ="t.name";
public static final String COL_ID_DESCRIPTION ="t.description";
public static final String COL_ID_PRIORITY ="t.priority" ;
public static final String COL_ID_STATUS ="t.taskData.status";
public static final String COL_ID_CREATEON ="t.taskData.createdOn";
public static final String COL_ID_EXPIRATIONTIME ="t.taskData.expirationTime";
public static final String COL_ID_ACTIONS ="Actions";

interface Binder
extends
UiBinder<Widget, TasksListGridViewImpl> {
Expand Down Expand Up @@ -90,10 +100,12 @@ interface Binder
@Override
public void init(final TasksListGridPresenter presenter) {
List<String> bannedColumns = new ArrayList<String>();
bannedColumns.add(constants.Task());
bannedColumns.add(COL_ID_NAME);
bannedColumns.add(COL_ID_ACTIONS);
List<String> initColumns = new ArrayList<String>();
initColumns.add(constants.Task());
initColumns.add(constants.Description());
initColumns.add(COL_ID_NAME);
initColumns.add(COL_ID_DESCRIPTION);
initColumns.add(COL_ID_ACTIONS);
super.init(presenter, new GridGlobalPreferences("TaskListGrid", initColumns, bannedColumns));

selectedStyles = new RowStyles<TaskSummary>() {
Expand Down Expand Up @@ -361,7 +373,7 @@ public Number getValue(TaskSummary object) {
}
};
taskIdColumn.setSortable(true);
taskIdColumn.setDataStoreName("t.id");
taskIdColumn.setDataStoreName(COL_ID_ID);
return taskIdColumn;
}

Expand All @@ -373,7 +385,7 @@ public String getValue(TaskSummary object) {
}
};
taskNameColumn.setSortable(true);
taskNameColumn.setDataStoreName("t.name");
taskNameColumn.setDataStoreName(COL_ID_NAME);
return taskNameColumn;
}

Expand All @@ -385,7 +397,7 @@ public String getValue(TaskSummary object) {
}
};
descriptionColumn.setSortable(true);
descriptionColumn.setDataStoreName("t.description");
descriptionColumn.setDataStoreName(COL_ID_DESCRIPTION);
return descriptionColumn;
}

Expand All @@ -397,7 +409,7 @@ public Number getValue(TaskSummary object) {
}
};
taskPriorityColumn.setSortable(true);
taskPriorityColumn.setDataStoreName("t.priority");
taskPriorityColumn.setDataStoreName(COL_ID_PRIORITY);
return taskPriorityColumn;
}

Expand All @@ -409,7 +421,7 @@ public String getValue(TaskSummary object) {
}
};
statusColumn.setSortable(true);
statusColumn.setDataStoreName("t.taskData.status");
statusColumn.setDataStoreName(COL_ID_STATUS);
return statusColumn;
}

Expand All @@ -426,7 +438,7 @@ public String getValue(TaskSummary object) {
}
};
createdOnDateColumn.setSortable(true);
createdOnDateColumn.setDataStoreName("t.taskData.createdOn");
createdOnDateColumn.setDataStoreName(COL_ID_CREATEON);
return createdOnDateColumn;
}

Expand All @@ -443,7 +455,7 @@ public String getValue(TaskSummary object) {
}
};
dueDateColumn.setSortable(true);
dueDateColumn.setDataStoreName("t.taskData.expirationTime");
dueDateColumn.setDataStoreName(COL_ID_EXPIRATIONTIME);
return dueDateColumn;
}

Expand Down Expand Up @@ -492,6 +504,7 @@ public TaskSummary getValue(TaskSummary object) {
return object;
}
};
actionsColumn.setDataStoreName(COL_ID_ACTIONS);
return actionsColumn;

}
Expand Down Expand Up @@ -629,4 +642,8 @@ private void closePlace(String place) {
placeManager.closePlace(place);
}
}

public void setListGrid(ExtendedPagedTable newListGrid){
this.listGrid =newListGrid;
}
}
@@ -0,0 +1,62 @@
/*
* Copyright 2015 JBoss by Red Hat.
*
* 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.jbpm.console.ng.ht.client.editors.taskslist.grid;

import java.util.List;

import com.google.gwtmockito.GwtMockitoTestRunner;
import org.jbpm.console.ng.gc.client.experimental.grid.base.ExtendedPagedTable;
import org.jbpm.console.ng.ht.model.TaskSummary;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.uberfire.ext.widgets.common.client.tables.ColumnMeta;

import static org.junit.Assert.*;
import static org.mockito.Mockito.*;

@RunWith( GwtMockitoTestRunner.class )
public class TaskListGridViewTest {

@Mock
protected ExtendedPagedTable<TaskSummary> currentListGrid;

@InjectMocks
private TasksListGridViewImpl view;

@Test
public void testDataStoreNameIsSet() {
doAnswer( new Answer() {
@Override
public Void answer( InvocationOnMock invocationOnMock ) throws Throwable {
final List<ColumnMeta> columns = (List<ColumnMeta>) invocationOnMock.getArguments()[ 0 ];
for ( ColumnMeta columnMeta : columns ) {
assertNotNull( columnMeta.getColumn().getDataStoreName() );
}
return null;
}
} ).when( currentListGrid ).addColumns( anyList() );

view.setListGrid(currentListGrid);
view.initColumns( );

verify( currentListGrid ).addColumns( anyList() );
}

}

0 comments on commit f8833c9

Please sign in to comment.