use of org.uberfire.backend.vfs.Path in project drools-wb by kiegroup.
the class NewGuidedDecisionTableHandlerTest method testCreate_WithoutWizard.
@Test
public void testCreate_WithoutWizard() {
final String fileName = "fileName";
final Package pkg = mock(Package.class);
final Path resourcesPath = PathFactory.newPath("resources", "default://project/src/main/resources");
when(pkg.getPackageMainResourcesPath()).thenReturn(resourcesPath);
when(options.isUsingWizard()).thenReturn(false);
handler.create(pkg, fileName, newResourcePresenter);
verify(busyIndicatorView, times(1)).hideBusyIndicator();
verify(newResourcePresenter, times(1)).complete();
verify(mockNotificationEvent, times(1)).fire(any(NotificationEvent.class));
verify(newResourceSuccessEventMock, times(1)).fire(any(NewResourceSuccessEvent.class));
verify(placeManager, times(1)).goTo(pathCaptor.capture());
assertEquals("default://project/src/main/resources/fileName.gdst", pathCaptor.getValue().toURI());
verify(service, times(1)).create(eq(resourcesPath), eq(fileName + "." + resourceType.getSuffix()), any(GuidedDecisionTable52.class), any(String.class));
}
use of org.uberfire.backend.vfs.Path in project drools-wb by kiegroup.
the class NewGuidedDecisionTableHandlerTest method setup.
@Before
public void setup() {
serviceCaller = new CallerMock<>(service);
helper = new NewGuidedDecisionTableWizardHelper(serviceCaller, oracleFactory, beanManager);
final NewGuidedDecisionTableHandler wrapped = new NewGuidedDecisionTableHandler(placeManager, serviceCaller, resourceType, options, busyIndicatorView, helper) {
{
this.notificationEvent = mockNotificationEvent;
this.newResourceSuccessEvent = newResourceSuccessEventMock;
}
};
handler = spy(wrapped);
when(beanManager.lookupBean(eq(NewGuidedDecisionTableWizard.class))).thenReturn(wizardBeanDef);
when(wizardBeanDef.getInstance()).thenReturn(wizardBean);
when(service.create(any(Path.class), any(String.class), any(GuidedDecisionTable52.class), any(String.class))).<Path>thenAnswer((invocation) -> {
final Path path = ((Path) invocation.getArguments()[0]);
final String fileName = ((String) invocation.getArguments()[1]);
final Path newPath = PathFactory.newPath(fileName, path.toURI() + "/" + fileName);
return newPath;
});
}
use of org.uberfire.backend.vfs.Path in project drools-wb by kiegroup.
the class NewGuidedDecisionTableHandlerTest method testCreate_WithWizard.
@Test
public void testCreate_WithWizard() {
final String fileName = "fileName";
final Package pkg = mock(Package.class);
final Path resourcesPath = PathFactory.newPath("resources", "default://project/src/main/resources");
when(pkg.getPackageMainResourcesPath()).thenReturn(resourcesPath);
when(options.isUsingWizard()).thenReturn(true);
when(options.getTableFormat()).thenReturn(TableFormat.EXTENDED_ENTRY);
when(options.getHitPolicy()).thenReturn(GuidedDecisionTable52.HitPolicy.FIRST_HIT);
handler.create(pkg, fileName, newResourcePresenter);
verify(wizardBean, times(1)).setContent(pathCaptor.capture(), fileNameCaptor.capture(), eq(TableFormat.EXTENDED_ENTRY), eq(GuidedDecisionTable52.HitPolicy.FIRST_HIT), any(AsyncPackageDataModelOracle.class), any(NewGuidedDecisionTableWizard.GuidedDecisionTableWizardHandler.class));
}
use of org.uberfire.backend.vfs.Path in project drools-wb by kiegroup.
the class NewGuidedDecisionTableGraphHandlerTest method setup.
@Before
public void setup() {
serviceCaller = new CallerMock<>(service);
final NewGuidedDecisionTableGraphHandler wrapped = new NewGuidedDecisionTableGraphHandler(placeManager, serviceCaller, resourceType, busyIndicatorView) {
{
this.notificationEvent = mockNotificationEvent;
this.newResourceSuccessEvent = newResourceSuccessEventMock;
}
};
handler = spy(wrapped);
when(service.create(any(Path.class), any(String.class), any(GuidedDecisionTableEditorGraphModel.class), any(String.class))).<Path>thenAnswer((invocation) -> {
final Path path = ((Path) invocation.getArguments()[0]);
final String fileName = ((String) invocation.getArguments()[1]);
final Path newPath = PathFactory.newPath(fileName, path.toURI() + "/" + fileName);
return newPath;
});
}
use of org.uberfire.backend.vfs.Path in project drools-wb by kiegroup.
the class NewGuidedDecisionTableGraphHandlerTest method testCreate.
@Test
public void testCreate() {
final String fileName = "fileName";
final Package pkg = mock(Package.class);
final Path resourcesPath = PathFactory.newPath("resources", "default://project/src/main/resources");
when(pkg.getPackageMainResourcesPath()).thenReturn(resourcesPath);
handler.create(pkg, fileName, newResourcePresenter);
verify(busyIndicatorView, times(1)).hideBusyIndicator();
verify(newResourcePresenter, times(1)).complete();
verify(mockNotificationEvent, times(1)).fire(any(NotificationEvent.class));
verify(newResourceSuccessEventMock, times(1)).fire(any(NewResourceSuccessEvent.class));
verify(placeManager, times(1)).goTo(pathCaptor.capture());
assertEquals("default://project/src/main/resources/fileName." + resourceType.getSuffix(), pathCaptor.getValue().toURI());
verify(service, times(1)).create(eq(resourcesPath), eq(fileName + "." + resourceType.getSuffix()), any(GuidedDecisionTableEditorGraphModel.class), any(String.class));
}
Aggregations