@Test public void testOnDependencyPathSelectedEvent() { final String path = "org:kie:1.0"; final GAV gav = new GAV(path); when(m2RepoService.loadGAVFromJar(path)).thenReturn(gav); when(view.getContainerName()).thenReturn("containerName"); when(view.getContainerAlias()).thenReturn("containerAlias"); when(view.getGroupId()).thenReturn(gav.getGroupId()); when(view.getArtifactId()).thenReturn(gav.getArtifactId()); when(view.getVersion()).thenReturn(gav.getVersion()); presenter.asWidget(); presenter.onDependencyPathSelectedEvent(new DependencyPathSelectedEvent(artifactListWidgetPresenter, path)); verify(m2RepoService).loadGAVFromJar(path); verify(view).setGroupId(gav.getGroupId()); verify(view).setArtifactId(gav.getArtifactId()); verify(view).setVersion(gav.getVersion()); verify(wizardPageStatusChangeEvent).fire(any(WizardPageStatusChangeEvent.class)); final ContainerSpec containerSpec = presenter.buildContainerSpec("templateId", Collections.<Capability, ContainerConfig>emptyMap()); assertEquals(new ReleaseId(gav.getGroupId(), gav.getArtifactId(), gav.getVersion()), containerSpec.getReleasedId()); assertEquals(KieContainerStatus.STOPPED, containerSpec.getStatus()); assertEquals("containerAlias", containerSpec.getContainerName()); assertEquals("containerName", containerSpec.getId()); }
void onDependencyPathSelectedEvent(@Observes final DependencyPathSelectedEvent event) { if (event != null && event.getContext() != null && event.getPath() != null) { if (event.getContext().equals(artifactListWidgetPresenter)) { m2RepoService.call(new RemoteCallback<GAV>() { @Override public void callback(GAV gav) { setAValidContainerName(gav.toString()); view.setGroupId(gav.getGroupId()); view.setArtifactId(gav.getArtifactId()); view.setVersion(gav.getVersion()); wizardPageStatusChangeEvent.fire(new WizardPageStatusChangeEvent(NewContainerFormPresenter.this)); } }).loadGAVFromJar(event.getPath()); } } else { logger.warn("Illegal event argument."); } }
NewContainerFormPresenter implements WizardPage { void onDependencyPathSelectedEvent(@Observes final DependencyPathSelectedEvent event) { if (event != null && event.getContext() != null && event.getPath() != null) { if (event.getContext().equals(artifactListWidgetPresenter)) { m2RepoService.call(new RemoteCallback<GAV>() { @Override public void callback(GAV gav) { setAValidContainerName(gav.toString()); view.setGroupId(gav.getGroupId()); view.setArtifactId(gav.getArtifactId()); view.setVersion(gav.getVersion()); wizardPageStatusChangeEvent.fire(new WizardPageStatusChangeEvent(NewContainerFormPresenter.this)); } }).loadGAVFromJar(event.getPath()); } } else { logger.warn("Illegal event argument."); } } }
NewContainerFormPresenter implements WizardPage { void onDependencyPathSelectedEvent(@Observes final DependencyPathSelectedEvent event) { if (event != null && event.getContext() != null && event.getPath() != null) { if (event.getContext().equals(artifactListWidgetPresenter)) { m2RepoService.call(new RemoteCallback<GAV>() { @Override public void callback(GAV gav) { setAValidContainerName(gav.toString()); view.setGroupId(gav.getGroupId()); view.setArtifactId(gav.getArtifactId()); view.setVersion(gav.getVersion()); wizardPageStatusChangeEvent.fire(new WizardPageStatusChangeEvent(NewContainerFormPresenter.this)); } }).loadGAVFromJar(event.getPath()); } } else { logger.warn("Illegal event argument."); } } @Inject  NewContainerFormPresenter(final Logger logger,
                                     final View view,
                                     final ManagedInstance<ArtifactListWidgetPresenter> artifactListWidgetPresenterProvider,
                                     final Caller<M2RepoService> m2RepoService,
                                     final Caller<SpecManagementService> specManagementService,
                                     final Event<WizardPageStatusChangeEvent> wizardPageStatusChangeEvent); }
NewContainerFormPresenter implements WizardPage { void onDependencyPathSelectedEvent(@Observes final DependencyPathSelectedEvent event) { if (event != null && event.getContext() != null && event.getPath() != null) { if (event.getContext().equals(artifactListWidgetPresenter)) { m2RepoService.call(new RemoteCallback<GAV>() { @Override public void callback(GAV gav) { setAValidContainerName(gav.toString()); view.setGroupId(gav.getGroupId()); view.setArtifactId(gav.getArtifactId()); view.setVersion(gav.getVersion()); wizardPageStatusChangeEvent.fire(new WizardPageStatusChangeEvent(NewContainerFormPresenter.this)); } }).loadGAVFromJar(event.getPath()); } } else { logger.warn("Illegal event argument."); } } @Inject  NewContainerFormPresenter(final Logger logger,
                                     final View view,
                                     final ManagedInstance<ArtifactListWidgetPresenter> artifactListWidgetPresenterProvider,
                                     final Caller<M2RepoService> m2RepoService,
                                     final Caller<SpecManagementService> specManagementService,
                                     final Event<WizardPageStatusChangeEvent> wizardPageStatusChangeEvent); @PostConstruct void init(); void addContentChangeHandler(final ContentChangeHandler contentChangeHandler); @Override String getTitle(); @Override void isComplete(final Callback<Boolean> callback); @Override void initialise(); @Override void prepareView(); Mode getMode(); @Override Widget asWidget(); void clear(); boolean isContainerNameValid(); boolean isGroupIdValid(); boolean isArtifactIdValid(); boolean isVersionValid(); boolean isArtifactSupportedByServer(); boolean isValid(); boolean isEmpty(); ServerTemplate getServerTemplate(); void setServerTemplate(final ServerTemplate serverTemplate); ContainerSpec buildContainerSpec(final String serverTemplateId,
                                            final Map<Capability, ContainerConfig> configs); View getView(); void showBusyIndicator(String deploymentId); void hideBusyIndicator(); GAV getCurrentGAV(); }
NewContainerFormPresenter implements WizardPage { void onDependencyPathSelectedEvent(@Observes final DependencyPathSelectedEvent event) { if (event != null && event.getContext() != null && event.getPath() != null) { if (event.getContext().equals(artifactListWidgetPresenter)) { m2RepoService.call(new RemoteCallback<GAV>() { @Override public void callback(GAV gav) { setAValidContainerName(gav.toString()); view.setGroupId(gav.getGroupId()); view.setArtifactId(gav.getArtifactId()); view.setVersion(gav.getVersion()); wizardPageStatusChangeEvent.fire(new WizardPageStatusChangeEvent(NewContainerFormPresenter.this)); } }).loadGAVFromJar(event.getPath()); } } else { logger.warn("Illegal event argument."); } } @Inject  NewContainerFormPresenter(final Logger logger,
                                     final View view,
                                     final ManagedInstance<ArtifactListWidgetPresenter> artifactListWidgetPresenterProvider,
                                     final Caller<M2RepoService> m2RepoService,
                                     final Caller<SpecManagementService> specManagementService,
                                     final Event<WizardPageStatusChangeEvent> wizardPageStatusChangeEvent); @PostConstruct void init(); void addContentChangeHandler(final ContentChangeHandler contentChangeHandler); @Override String getTitle(); @Override void isComplete(final Callback<Boolean> callback); @Override void initialise(); @Override void prepareView(); Mode getMode(); @Override Widget asWidget(); void clear(); boolean isContainerNameValid(); boolean isGroupIdValid(); boolean isArtifactIdValid(); boolean isVersionValid(); boolean isArtifactSupportedByServer(); boolean isValid(); boolean isEmpty(); ServerTemplate getServerTemplate(); void setServerTemplate(final ServerTemplate serverTemplate); ContainerSpec buildContainerSpec(final String serverTemplateId,
                                            final Map<Capability, ContainerConfig> configs); View getView(); void showBusyIndicator(String deploymentId); void hideBusyIndicator(); GAV getCurrentGAV(); static final String SNAPSHOT; }