You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by se...@apache.org on 2017/10/10 22:17:02 UTC
svn commit: r1811776 - in /directory/studio/trunk:
plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/valueeditors/
tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/
tests/test.integration.ui/src...
Author: seelmann
Date: Tue Oct 10 22:17:02 2017
New Revision: 1811776
URL: http://svn.apache.org/viewvc?rev=1811776&view=rev
Log:
Fix DIRSTUDIO-1157 (Values cannot be modified by text editor)
Added:
directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/TextEditorDialogBot.java (with props)
Modified:
directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/valueeditors/TextValueEditor.java
directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/EntryEditorTest.java
directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/EntryEditorBot.java
directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/EntryEditorWidgetBot.java
Modified: directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/valueeditors/TextValueEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/valueeditors/TextValueEditor.java?rev=1811776&r1=1811775&r2=1811776&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/valueeditors/TextValueEditor.java (original)
+++ directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/valueeditors/TextValueEditor.java Tue Oct 10 22:17:02 2017
@@ -41,20 +41,20 @@ public class TextValueEditor extends Abs
public boolean openDialog( Shell shell )
{
Object value = getValue();
-
+
if ( value instanceof String )
{
TextDialog dialog = new TextDialog( shell, ( String ) value );
- String text = dialog.getText();
-
- if ( ( dialog.open() == TextDialog.OK ) && ( text != null ) && ( text.length() != 0 ) )
+
+ if ( ( dialog.open() == TextDialog.OK ) && ( dialog.getText() != null )
+ && ( dialog.getText().length() != 0 ) )
{
- setValue( text );
-
+ setValue( dialog.getText() );
+
return true;
}
}
-
+
return false;
}
}
Modified: directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/EntryEditorTest.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/EntryEditorTest.java?rev=1811776&r1=1811775&r2=1811776&view=diff
==============================================================================
--- directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/EntryEditorTest.java (original)
+++ directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/EntryEditorTest.java Tue Oct 10 22:17:02 2017
@@ -48,6 +48,7 @@ import org.apache.directory.studio.test.
import org.apache.directory.studio.test.integration.ui.bots.PasswordEditorDialogBot;
import org.apache.directory.studio.test.integration.ui.bots.SelectDnDialogBot;
import org.apache.directory.studio.test.integration.ui.bots.StudioBot;
+import org.apache.directory.studio.test.integration.ui.bots.TextEditorDialogBot;
import org.apache.directory.studio.test.integration.ui.bots.utils.FrameworkRunnerWithScreenshotCaptureListener;
import org.apache.directory.studio.test.integration.ui.bots.utils.JobWatcher;
import org.eclipse.swtbot.swt.finder.utils.SWTUtils;
@@ -350,4 +351,43 @@ public class EntryEditorTest extends Abs
}
}
+
+ /**
+ * DIRSTUDIO-1157: Values cannot be modified by text editor
+ */
+ @Test
+ public void testTestValueEditor() throws Exception
+ {
+ browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=Barbara Jensen" );
+
+ EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( "cn=Barbara Jensen,ou=users,ou=system" );
+ entryEditorBot.activate();
+ String dn = entryEditorBot.getDnText();
+ assertEquals( "DN: cn=Barbara Jensen,ou=users,ou=system", dn );
+ assertEquals( 8, entryEditorBot.getAttributeValues().size() );
+ assertEquals( "", modificationLogsViewBot.getModificationLogsText() );
+
+ // add description attribute
+ entryEditorBot.activate();
+ NewAttributeWizardBot wizardBot = entryEditorBot.openNewAttributeWizard();
+ assertTrue( wizardBot.isVisible() );
+ wizardBot.typeAttributeType( "description" );
+ wizardBot.clickFinishButton();
+ entryEditorBot.typeValueAndFinish( "testTestValueEditor 1" );
+ assertEquals( 9, entryEditorBot.getAttributeValues().size() );
+ assertTrue( entryEditorBot.getAttributeValues().contains( "description: testTestValueEditor 1" ) );
+ modificationLogsViewBot.waitForText( "add: description\ndescription: testTestValueEditor 1" );
+
+ // edit value with the text editor
+ TextEditorDialogBot textEditorBot = entryEditorBot.editValueWithTextEditor( "description",
+ "testTestValueEditor 1" );
+ assertTrue( textEditorBot.isVisible() );
+ textEditorBot.setText( "testTestValueEditor 2" );
+ textEditorBot.clickOkButton();
+ assertEquals( 9, entryEditorBot.getAttributeValues().size() );
+ assertFalse( entryEditorBot.getAttributeValues().contains( "description: testTestValueEditor 1" ) );
+ assertTrue( entryEditorBot.getAttributeValues().contains( "description: testTestValueEditor 2" ) );
+ modificationLogsViewBot.waitForText( "replace: description\ndescription: testTestValueEditor 2" );
+ }
+
}
Modified: directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/EntryEditorBot.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/EntryEditorBot.java?rev=1811776&r1=1811775&r2=1811776&view=diff
==============================================================================
--- directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/EntryEditorBot.java (original)
+++ directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/EntryEditorBot.java Tue Oct 10 22:17:02 2017
@@ -107,6 +107,12 @@ public class EntryEditorBot
}
+ public TextEditorDialogBot editValueWithTextEditor( String attributeType, String value )
+ {
+ return editorBot.editValueWithTextEditor( attributeType, value );
+ }
+
+
public void deleteValue( String attributeType, String value )
{
editorBot.deleteValue( attributeType, value );
Modified: directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/EntryEditorWidgetBot.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/EntryEditorWidgetBot.java?rev=1811776&r1=1811775&r2=1811776&view=diff
==============================================================================
--- directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/EntryEditorWidgetBot.java (original)
+++ directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/EntryEditorWidgetBot.java Tue Oct 10 22:17:02 2017
@@ -122,6 +122,15 @@ class EntryEditorWidgetBot
}
+ void editValueWith( String attributeType, String value, String valueEditorLabel )
+ {
+ cancelEditValue();
+ SWTBotTreeItem treeItem = getTreeItem( attributeType, value );
+ treeItem.select();
+ ContextMenuHelper.clickContextMenu( bot.tree(), "Edit Value With", valueEditorLabel );
+ }
+
+
DnEditorDialogBot editValueExpectingDnEditor( String attributeType, String value )
{
editValue( attributeType, value );
@@ -136,6 +145,13 @@ class EntryEditorWidgetBot
}
+ TextEditorDialogBot editValueWithTextEditor( String attributeType, String value )
+ {
+ editValueWith( attributeType, value, "^Text Editor$" );
+ return new TextEditorDialogBot();
+ }
+
+
private SWTBotTreeItem getTreeItem( String attributeType, String value )
{
SWTBotTree tree = bot.tree();
Added: directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/TextEditorDialogBot.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/TextEditorDialogBot.java?rev=1811776&view=auto
==============================================================================
--- directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/TextEditorDialogBot.java (added)
+++ directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/TextEditorDialogBot.java Tue Oct 10 22:17:02 2017
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.studio.test.integration.ui.bots;
+
+
+public class TextEditorDialogBot extends DialogBot
+{
+
+ public TextEditorDialogBot()
+ {
+ super( "Text Editor" );
+ }
+
+
+ public void clickOkButton()
+ {
+ super.clickButton( "OK" );
+ }
+
+
+ public void clickCancelButton()
+ {
+ super.clickButton( "Cancel" );
+ }
+
+
+ public void setText( String text )
+ {
+ bot.text( 0 ).setText( text );
+ }
+
+}
Propchange: directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/TextEditorDialogBot.java
------------------------------------------------------------------------------
svn:eol-style = native