protected void setContent( final DriverDefEditorContent editorContent ) { this.editorContent = editorContent; this.editorHelper.setDriverDef( editorContent.getDef( ) ); editorHelper.setValid( true ); } }
private DriverDefEditorContent createContent() { DriverDefEditorContent content = new DriverDefEditorContent(); content.setDef( new DriverDef() ); content.getDef().setUuid( DRIVER_UUID ); content.getDef().setName( NAME ); content.getDef().setGroupId( GROUP_ID ); content.getDef().setArtifactId( ARTIFACT_ID ); content.getDef().setVersion( VERSION ); content.getDef().setDriverClass( DRIVER_CLASS ); return content; } }
@Test public void testLoadFileSuccessFul() { prepareLoadFileSuccessful(); //verifies the content was properly loaded and properly set on the UI verify( view, times( 1 ) ).showLoading(); verify( view, times( 1 ) ).hideBusyIndicator(); assertEquals( content, editor.getContent() ); verify( mainPanelView, times( 1 ) ).setName( content.getDef().getName() ); verify( mainPanelView, times( 1 ) ).setGroupId( content.getDef().getGroupId() ); verify( mainPanelView, times( 1 ) ).setArtifactId( content.getDef().getArtifactId() ); verify( mainPanelView, times( 1 ) ).setVersion( content.getDef().getVersion() ); verify( mainPanelView, times( 1 ) ).setDriverClass( content.getDef().getDriverClass() ); }
/** * Checks if current driver has dependant data sources prior to execute an update operation. */ protected void executeSafeUpdateCommand( String onDependantsMessageKey, Command defaultCommand, Command yesCommand, Command noCommand ) { dataSourceManagerClient.call( new RemoteCallback< DriverDeploymentInfo >( ) { @Override public void callback( DriverDeploymentInfo deploymentInfo ) { if ( deploymentInfo != null && deploymentInfo.hasDependants( ) ) { popupsUtil.showYesNoPopup( CommonConstants.INSTANCE.Warning( ), editorHelper.getMessage( onDependantsMessageKey ), yesCommand, CommonConstants.INSTANCE.YES( ), ButtonType.WARNING, noCommand, CommonConstants.INSTANCE.NO( ), ButtonType.DEFAULT ); } else { defaultCommand.execute( ); } } } ).getDriverDeploymentInfo( getContent( ).getDef( ).getUuid( ) ); }
DriverDef driverDef = driverDefEditorContent.getDef(); URI uri;
@Test public void testEditorChanges() { //open the editor with a valid content. prepareLoadFileSuccessful(); //emulates some valid changes in the editor. when( mainPanelView.getName() ).thenReturn( NAME_2 ); when( mainPanelView.getDriverClass() ).thenReturn( DRIVER_CLASS_2 ); when( mainPanelView.getGroupId() ).thenReturn( GROUP_ID_2 ); when( mainPanelView.getArtifactId() ).thenReturn( ARTIFACT_ID_2 ); when( mainPanelView.getVersion() ).thenReturn( VERSION_2 ); mainPanel.onNameChange(); mainPanel.onDriverClassChange(); mainPanel.onGroupIdChange(); mainPanel.onArtifactIdChange(); mainPanel.onVersionChange(); //the content of the editor should have been properly modified. assertEquals( NAME_2, editor.getContent().getDef().getName() ); assertEquals( GROUP_ID_2, editor.getContent().getDef().getGroupId() ); assertEquals( ARTIFACT_ID_2, editor.getContent().getDef().getArtifactId() ); assertEquals( VERSION_2, editor.getContent().getDef().getVersion() ); assertEquals( DRIVER_CLASS_2, editor.getContent().getDef().getDriverClass() ); }