Search in sources :

Example 6 with KieDocument

use of org.kie.workbench.common.widgets.metadata.client.KieDocument in project kie-wb-common by kiegroup.

the class RegisteredDocumentsMenuBuilderTest method testActivateDocument_inactive.

@Test
public void testActivateDocument_inactive() {
    final KieDocument document = makeKieDocument();
    builder.registerDocument(document);
    builder.activateDocument(mock(KieDocument.class));
    verify(documentMenuItem, times(1)).setActive(eq(false));
}
Also used : KieDocument(org.kie.workbench.common.widgets.metadata.client.KieDocument) Test(org.junit.Test)

Example 7 with KieDocument

use of org.kie.workbench.common.widgets.metadata.client.KieDocument in project kie-wb-common by kiegroup.

the class RegisteredDocumentsMenuBuilderTest method testOnRemoveDocument_WithCommand.

@Test
@SuppressWarnings("unchecked")
public void testOnRemoveDocument_WithCommand() {
    final KieDocument document = makeKieDocument();
    final ParameterizedCommand command = mock(ParameterizedCommand.class);
    builder.setRemoveDocumentCommand(command);
    builder.onRemoveDocument(document);
    verify(command, times(1)).execute(eq(document));
}
Also used : KieDocument(org.kie.workbench.common.widgets.metadata.client.KieDocument) ParameterizedCommand(org.uberfire.mvp.ParameterizedCommand) Test(org.junit.Test)

Example 8 with KieDocument

use of org.kie.workbench.common.widgets.metadata.client.KieDocument in project kie-wb-common by kiegroup.

the class RegisteredDocumentsMenuBuilderTest method testActivateDocument_active.

@Test
public void testActivateDocument_active() {
    final KieDocument document = makeKieDocument();
    builder.registerDocument(document);
    builder.activateDocument(document);
    verify(documentMenuItem, times(1)).setActive(eq(true));
}
Also used : KieDocument(org.kie.workbench.common.widgets.metadata.client.KieDocument) Test(org.junit.Test)

Example 9 with KieDocument

use of org.kie.workbench.common.widgets.metadata.client.KieDocument in project kie-wb-common by kiegroup.

the class RegisteredDocumentsMenuBuilderTest method testDereregisterDocument.

@Test
public void testDereregisterDocument() {
    final KieDocument document = makeKieDocument();
    builder.registerDocument(document);
    builder.deregisterDocument(document);
    verify(view, times(1)).deleteDocument(documentMenuItem);
    verify(documentMenuItemProvider, times(1)).destroy(documentMenuItem);
}
Also used : KieDocument(org.kie.workbench.common.widgets.metadata.client.KieDocument) Test(org.junit.Test)

Example 10 with KieDocument

use of org.kie.workbench.common.widgets.metadata.client.KieDocument in project kie-wb-common by kiegroup.

the class RegisteredDocumentsMenuBuilderTest method testRegisterDocument.

@Test
public void testRegisterDocument() {
    final KieDocument document = makeKieDocument();
    builder.registerDocument(document);
    verify(documentMenuItem, times(1)).setName("filename");
    verify(documentMenuItem, times(1)).setRemoveDocumentCommand(removeDocumentCommandCaptor.capture());
    verify(documentMenuItem, times(1)).setActivateDocumentCommand(activateDocumentCommandCaptor.capture());
    verify(view, times(1)).addDocument(eq(documentMenuItem));
    final Command removeDocumentCommand = removeDocumentCommandCaptor.getValue();
    assertNotNull(removeDocumentCommand);
    removeDocumentCommand.execute();
    verify(builder, times(1)).onRemoveDocument(document);
    final Command activateDocumentCommand = activateDocumentCommandCaptor.getValue();
    assertNotNull(activateDocumentCommand);
    activateDocumentCommand.execute();
    verify(builder, times(1)).onActivateDocument(document);
}
Also used : KieDocument(org.kie.workbench.common.widgets.metadata.client.KieDocument) ParameterizedCommand(org.uberfire.mvp.ParameterizedCommand) Command(org.uberfire.mvp.Command) Test(org.junit.Test)

Aggregations

KieDocument (org.kie.workbench.common.widgets.metadata.client.KieDocument)13 Test (org.junit.Test)12 ParameterizedCommand (org.uberfire.mvp.ParameterizedCommand)3 GuidedDecisionTablePresenter (org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTablePresenter)2 ObservablePath (org.uberfire.backend.vfs.ObservablePath)1 Command (org.uberfire.mvp.Command)1