@Test public void testSetContentGAV() throws Exception { preferences.put("kie_version", "1.3.0"); OrganizationalUnit organizationalUnit = mock(OrganizationalUnit.class); when(organizationalUnit.getDefaultGroupId()).thenReturn("mygroup"); when(moduleContext.getActiveOrganizationalUnit()).thenReturn(Optional.of(organizationalUnit)); POM pom = new POM(); pom.setName("another module"); pom.getGav().setArtifactId("another.artifact"); pom.getGav().setGroupId("another.group"); pom.getGav().setVersion("1.2.3"); wizard.initialise(pom); ArgumentCaptor<POM> pomArgumentCaptor = ArgumentCaptor.forClass(POM.class); verify(pomWizardPage).setPom(pomArgumentCaptor.capture()); POM result = pomArgumentCaptor.getValue(); assertEquals("1.2.3", result.getGav().getVersion()); assertEquals("another.artifact", result.getGav().getArtifactId()); assertEquals("another.group", result.getGav().getGroupId()); assertEquals("another module", result.getName()); assertEquals(1, result.getBuild().getPlugins().size()); assertEquals("1.3.0", result.getBuild().getPlugins().get(0).getVersion()); }
@Override public void initialise() { pomWizardPage.setPom(new POMBuilder() .setGroupId(context.getActiveOrganizationalUnit() .map(ou -> ou.getDefaultGroupId()) .orElseThrow(() -> new IllegalStateException("Cannot get default group id when no organizational unit is active."))) .build()); }
NewWorkspaceProjectWizard extends AbstractWizard implements WorkspaceProjectWizard { @Override public void initialise() { pomWizardPage.setPom(new POMBuilder() .setGroupId(context.getActiveOrganizationalUnit() .map(ou -> ou.getDefaultGroupId()) .orElseThrow(() -> new IllegalStateException("Cannot get default group id when no organizational unit is active."))) .build()); } }
NewWorkspaceProjectWizard extends AbstractWizard implements WorkspaceProjectWizard { @Override public void initialise() { pomWizardPage.setPom(new POMBuilder() .setGroupId(context.getActiveOrganizationalUnit() .map(ou -> ou.getDefaultGroupId()) .orElseThrow(() -> new IllegalStateException("Cannot get default group id when no organizational unit is active."))) .build()); } NewWorkspaceProjectWizard(); @Inject  NewWorkspaceProjectWizard(final Caller<WorkspaceProjectService> projectService,
                                     final PlaceManager placeManager,
                                     final Event<NotificationEvent> notificationEvent,
                                     final POMWizardPage pomWizardPage,
                                     final BusyIndicatorView busyIndicatorView,
                                     final ConflictingRepositoriesPopup conflictingRepositoriesPopup,
                                     final WorkspaceProjectContext context,
                                     final KiePOMDefaultOptions pomDefaultOptions); }
NewWorkspaceProjectWizard extends AbstractWizard implements WorkspaceProjectWizard { @Override public void initialise() { pomWizardPage.setPom(new POMBuilder() .setGroupId(context.getActiveOrganizationalUnit() .map(ou -> ou.getDefaultGroupId()) .orElseThrow(() -> new IllegalStateException("Cannot get default group id when no organizational unit is active."))) .build()); } NewWorkspaceProjectWizard(); @Inject  NewWorkspaceProjectWizard(final Caller<WorkspaceProjectService> projectService,
                                     final PlaceManager placeManager,
                                     final Event<NotificationEvent> notificationEvent,
                                     final POMWizardPage pomWizardPage,
                                     final BusyIndicatorView busyIndicatorView,
                                     final ConflictingRepositoriesPopup conflictingRepositoriesPopup,
                                     final WorkspaceProjectContext context,
                                     final KiePOMDefaultOptions pomDefaultOptions); @PostConstruct void setupPages(); @Override String getTitle(); @Override List<WizardPage> getPages(); @Override Widget getPageWidget(int pageNumber); @Override int getPreferredHeight(); @Override int getPreferredWidth(); @Override void isComplete(final Callback<Boolean> callback); @Override void initialise(); @Override void initialise(final POM pom); @Override void complete(); @Override void close(); @Override void start(); @Override void start(final Callback<WorkspaceProject> callback,
                      final boolean openEditor); }
NewWorkspaceProjectWizard extends AbstractWizard implements WorkspaceProjectWizard { @Override public void initialise() { pomWizardPage.setPom(new POMBuilder() .setGroupId(context.getActiveOrganizationalUnit() .map(ou -> ou.getDefaultGroupId()) .orElseThrow(() -> new IllegalStateException("Cannot get default group id when no organizational unit is active."))) .build()); } NewWorkspaceProjectWizard(); @Inject  NewWorkspaceProjectWizard(final Caller<WorkspaceProjectService> projectService,
                                     final PlaceManager placeManager,
                                     final Event<NotificationEvent> notificationEvent,
                                     final POMWizardPage pomWizardPage,
                                     final BusyIndicatorView busyIndicatorView,
                                     final ConflictingRepositoriesPopup conflictingRepositoriesPopup,
                                     final WorkspaceProjectContext context,
                                     final KiePOMDefaultOptions pomDefaultOptions); @PostConstruct void setupPages(); @Override String getTitle(); @Override List<WizardPage> getPages(); @Override Widget getPageWidget(int pageNumber); @Override int getPreferredHeight(); @Override int getPreferredWidth(); @Override void isComplete(final Callback<Boolean> callback); @Override void initialise(); @Override void initialise(final POM pom); @Override void complete(); @Override void close(); @Override void start(); @Override void start(final Callback<WorkspaceProject> callback,
                      final boolean openEditor);  }