Skip to content

Commit

Permalink
BZ:1291732 - Process Definitions perspective - process Name column no…
Browse files Browse the repository at this point in the history
…t enabled by default
  • Loading branch information
nmirasch authored and etirelli committed Dec 21, 2015
1 parent f8833c9 commit 93f11ff
Show file tree
Hide file tree
Showing 20 changed files with 565 additions and 52 deletions.
Expand Up @@ -82,6 +82,19 @@
<scope>provided</scope>
</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 @@ -77,13 +77,13 @@ public void init(final DeploymentUnitsListPresenter presenter) {

List<String> bannedColumns = new ArrayList<String>();

bannedColumns.add(constants.Deployment());
bannedColumns.add(constants.Actions());
bannedColumns.add("Deployment");
bannedColumns.add("Actions");
List<String> initColumns = new ArrayList<String>();
initColumns.add(constants.Deployment());
initColumns.add(constants.Strategy());
initColumns.add(constants.Status());
initColumns.add(constants.Actions());
initColumns.add("Deployment");
initColumns.add("Strategy");
initColumns.add("Status");
initColumns.add("Actions");

super.init(presenter, new GridGlobalPreferences("DeploymentUnitsGrid", initColumns, bannedColumns));

Expand Down Expand Up @@ -158,6 +158,7 @@ public void initColumns() {
Column<KModuleDeploymentUnitSummary, ?> strategyColumn = strategyColumn();
Column<KModuleDeploymentUnitSummary, ?> statusColumn = statusColumn();
actionsColumn = actionsColumn();
actionsColumn.setDataStoreName("Actions");

List<ColumnMeta<KModuleDeploymentUnitSummary>> columnMetas = new ArrayList<ColumnMeta<KModuleDeploymentUnitSummary>>();
columnMetas.add(new ColumnMeta<KModuleDeploymentUnitSummary>(unitIdColumn, constants.Deployment()));
Expand Down
@@ -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.bd.client.editors.deployment.list;

import java.util.List;

import com.google.gwtmockito.GwtMockitoTestRunner;
import org.jbpm.console.ng.bd.model.KModuleDeploymentUnitSummary;
import org.jbpm.console.ng.gc.client.experimental.grid.base.ExtendedPagedTable;
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 DeploymentUnitsListViewTest {

@Mock
protected ExtendedPagedTable<KModuleDeploymentUnitSummary> currentListGrid;

@InjectMocks
private DeploymentUnitsListViewImpl 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() );
}

}
14 changes: 14 additions & 0 deletions jbpm-console-ng-documents/jbpm-console-ng-documents-client/pom.xml
Expand Up @@ -78,6 +78,20 @@
<groupId>org.jbpm</groupId>
<artifactId>jbpm-console-ng-documents-api</artifactId>
</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 @@ -116,13 +116,13 @@ interface Binder extends UiBinder<Widget, DocumentListViewImpl> {
public void init(final DocumentListPresenter presenter) {

List<String> bannedColumns = new ArrayList<String>();
bannedColumns.add(constants.DocumentID());
bannedColumns.add(constants.DocumentName());
bannedColumns.add(constants.Actions());
bannedColumns.add("Id");
bannedColumns.add("ProcessName");
bannedColumns.add("Actions");
List<String> initColumns = new ArrayList<String>();
initColumns.add(constants.DocumentID());
initColumns.add(constants.DocumentName());
initColumns.add(constants.Actions());
initColumns.add("Id");
initColumns.add("ProcessName");
initColumns.add("Actions");

super.init(presenter, new GridGlobalPreferences("DocumentListGrid", initColumns, bannedColumns));

Expand Down Expand Up @@ -200,6 +200,10 @@ public void initColumns() {
Column<CMSContentSummary, ?> processNameColumn = initNameColumn();
actionsColumn = initActionsColumn();

idColumn.setDataStoreName("Id");
processNameColumn.setDataStoreName("ProcessName");
actionsColumn.setDataStoreName("Actions");

List<ColumnMeta<CMSContentSummary>> columnMetas = new ArrayList<ColumnMeta<CMSContentSummary>>();
columnMetas.add(new ColumnMeta<CMSContentSummary>(idColumn, constants.DocumentID()));
columnMetas.add(new ColumnMeta<CMSContentSummary>(processNameColumn, constants.DocumentName()));
Expand Down
@@ -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.dm.client.document.list;

import java.util.List;

import com.google.gwtmockito.GwtMockitoTestRunner;
import org.jbpm.console.ng.dm.model.CMSContentSummary;
import org.jbpm.console.ng.gc.client.experimental.grid.base.ExtendedPagedTable;
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 DocumentListViewTest {

@Mock
protected ExtendedPagedTable<CMSContentSummary> currentListGrid;

@InjectMocks
private DocumentListViewImpl 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() );
}

}
Expand Up @@ -76,6 +76,20 @@
<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 @@ -96,12 +96,12 @@ public class RequestListViewImpl extends AbstractListView<RequestSummary,Request
@Override
public void init(final RequestListPresenter presenter ) {
List<String> bannedColumns = new ArrayList<String>();
bannedColumns.add(constants.Id());
bannedColumns.add(constants.Type());
bannedColumns.add("r.id");
bannedColumns.add("r.commandName");
List<String> initColumns = new ArrayList<String>();
initColumns.add(constants.Id());
initColumns.add(constants.Type());
initColumns.add(constants.Actions());
initColumns.add("r.id");
initColumns.add("r.commandName");
initColumns.add("Actions");

super.init(presenter, new GridGlobalPreferences("RequestListGrid", initColumns, bannedColumns));

Expand Down Expand Up @@ -129,6 +129,7 @@ public void initColumns() {
initStatusColumn();
initDueDateColumn();
actionsColumn = initActionsColumn();
actionsColumn.setDataStoreName("Actions");
listGrid.addColumn(actionsColumn, constants.Actions());
}
private void initFiltersBar(){
Expand Down Expand Up @@ -312,7 +313,7 @@ public void onSelectionChange(SelectionChangeEvent event) {
}
});
}

private void initNoActionColumnManager(){
noActionColumnManager = DefaultSelectionEventManager
.createCustomManager(new DefaultSelectionEventManager.EventTranslator<RequestSummary>() {
Expand Down Expand Up @@ -380,9 +381,9 @@ public void onClick(ClickEvent event) {
actions.add(settingsNavLink);
listGrid.getLeftToolbar().add(actions);
}



private void initJobIdColumn(){
// Id
Column<RequestSummary, Number> taskIdColumn = new Column<RequestSummary, Number>( new NumberCell() ) {
Expand Down Expand Up @@ -434,7 +435,7 @@ public String getValue( RequestSummary object ) {
listGrid.addColumn(taskNameColumn, constants.Due_On());
taskNameColumn.setDataStoreName( "r.time" );
}

private Column<RequestSummary, RequestSummary> initActionsColumn(){
List<HasCell<RequestSummary, ?>> cells = new LinkedList<HasCell<RequestSummary, ?>>();
List<String> allStatuses = new ArrayList<String>();
Expand Down
@@ -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.es.client.editors.requestlist;

import java.util.List;

import com.github.gwtbootstrap.client.ui.Column;
import com.google.gwtmockito.GwtMockitoTestRunner;
import org.jbpm.console.ng.es.model.RequestSummary;
import org.jbpm.console.ng.gc.client.experimental.grid.base.ExtendedPagedTable;
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 RequestListViewTest {

@Mock
protected ExtendedPagedTable<RequestSummary> currentListGrid;

@InjectMocks
private RequestListViewImpl 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( );

}

}
Expand Up @@ -170,4 +170,8 @@ public void hideBusyIndicator() {
* DataGrid columns and how they must be initialized
*/
public abstract void initColumns();

public void setListGrid(ExtendedPagedTable newListGrid){
this.listGrid = newListGrid;
}
}
Expand Up @@ -101,11 +101,9 @@ interface Binder
public void init(final TasksListGridPresenter presenter) {
List<String> bannedColumns = new ArrayList<String>();
bannedColumns.add(COL_ID_NAME);
bannedColumns.add(COL_ID_ACTIONS);
List<String> initColumns = new ArrayList<String>();
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

0 comments on commit 93f11ff

Please sign in to comment.