directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1811960 - in /directory/studio/branches/studio-value: 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.in...
Date Thu, 12 Oct 2017 13:31:16 GMT
Author: elecharny
Date: Thu Oct 12 13:31:16 2017
New Revision: 1811960

URL: http://svn.apache.org/viewvc?rev=1811960&view=rev
Log:
Ported patch for DIRSTUDIO-1157 from trunk

Added:
    directory/studio/branches/studio-value/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/TextEditorDialogBot.java
Modified:
    directory/studio/branches/studio-value/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/valueeditors/TextValueEditor.java
    directory/studio/branches/studio-value/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/EntryEditorTest.java
    directory/studio/branches/studio-value/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/EntryEditorBot.java
    directory/studio/branches/studio-value/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/EntryEditorWidgetBot.java

Modified: directory/studio/branches/studio-value/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/valueeditors/TextValueEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/valueeditors/TextValueEditor.java?rev=1811960&r1=1811959&r2=1811960&view=diff
==============================================================================
--- directory/studio/branches/studio-value/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/valueeditors/TextValueEditor.java
(original)
+++ directory/studio/branches/studio-value/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/valueeditors/TextValueEditor.java
Thu Oct 12 13:31:16 2017
@@ -45,11 +45,11 @@ public class TextValueEditor extends Abs
         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;
             }

Modified: directory/studio/branches/studio-value/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/EntryEditorTest.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/EntryEditorTest.java?rev=1811960&r1=1811959&r2=1811960&view=diff
==============================================================================
--- directory/studio/branches/studio-value/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/EntryEditorTest.java
(original)
+++ directory/studio/branches/studio-value/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/EntryEditorTest.java
Thu Oct 12 13:31:16 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/branches/studio-value/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/branches/studio-value/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/EntryEditorBot.java?rev=1811960&r1=1811959&r2=1811960&view=diff
==============================================================================
--- directory/studio/branches/studio-value/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/EntryEditorBot.java
(original)
+++ directory/studio/branches/studio-value/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/EntryEditorBot.java
Thu Oct 12 13:31:16 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/branches/studio-value/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/branches/studio-value/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/EntryEditorWidgetBot.java?rev=1811960&r1=1811959&r2=1811960&view=diff
==============================================================================
--- directory/studio/branches/studio-value/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/EntryEditorWidgetBot.java
(original)
+++ directory/studio/branches/studio-value/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/EntryEditorWidgetBot.java
Thu Oct 12 13:31:16 2017
@@ -121,6 +121,15 @@ class EntryEditorWidgetBot
         treeItem.doubleClick();
     }
 
+    
+    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 )
     {
@@ -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/branches/studio-value/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/branches/studio-value/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/TextEditorDialogBot.java?rev=1811960&view=auto
==============================================================================
--- directory/studio/branches/studio-value/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/TextEditorDialogBot.java
(added)
+++ directory/studio/branches/studio-value/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/TextEditorDialogBot.java
Thu Oct 12 13:31:16 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 );
+    }
+
+}
\ No newline at end of file



Mime
View raw message