diff --git a/openbis/resource/test-data/core-plugins/invalid-folder/.gitignore b/openbis/resource/test-data/core-plugins/invalid-folder/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/openbis/resource/test-data/core-plugins/plugin-X/15/as/initialize-master-data.py b/openbis/resource/test-data/core-plugins/plugin-X/15/as/initialize-master-data.py
index 1e8506e2c3f6e7dc8c64d5c3da6bb581cc5b91f4..b8df9511ba83eed59c131160816a9f4ab39329b1 100644
--- a/openbis/resource/test-data/core-plugins/plugin-X/15/as/initialize-master-data.py
+++ b/openbis/resource/test-data/core-plugins/plugin-X/15/as/initialize-master-data.py
@@ -1,6 +1 @@
-
-
-tr = service.transaction()
-
-expType = tr.createNewExperimentType('I-TEST-TTT')
-expType.setDescription('Experiment type description.')
+TEST-SCRIPT
\ No newline at end of file
diff --git a/openbis/resource/test-data/core-plugins/plugin-X/9/as/initialize-master-data.py b/openbis/resource/test-data/core-plugins/plugin-X/9/as/initialize-master-data.py
new file mode 100644
index 0000000000000000000000000000000000000000..9eedaf905674743360e3a58caae2fd8934c6ddcc
--- /dev/null
+++ b/openbis/resource/test-data/core-plugins/plugin-X/9/as/initialize-master-data.py
@@ -0,0 +1 @@
+OLD-TEST-SCRIPT-VERSION
\ No newline at end of file
diff --git a/openbis/resource/test-data/core-plugins/plugin-X/NaN-version/as/.gitignore b/openbis/resource/test-data/core-plugins/plugin-X/NaN-version/as/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/openbis/resource/test-data/core-plugins/plugin-Y/2/as/.gitignore b/openbis/resource/test-data/core-plugins/plugin-Y/2/as/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/openbis/resource/test-data/core-plugins/plugin-Y/3/as/.gitignore b/openbis/resource/test-data/core-plugins/plugin-Y/3/as/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/coreplugin/CorePluginScanner.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/coreplugin/CorePluginScanner.java
index bd608d2603d2e4d7cd82e63e7a5f1e46487b5153..366f0dbaed750e5210ee15fd3d994fdd4e238a54 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/coreplugin/CorePluginScanner.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/coreplugin/CorePluginScanner.java
@@ -21,12 +21,13 @@ import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 
-import org.apache.log4j.Logger;
-
 import ch.systemsx.cisd.common.exceptions.ConfigurationFailureException;
 import ch.systemsx.cisd.common.filesystem.FileUtilities;
+import ch.systemsx.cisd.common.logging.ISimpleLogger;
+import ch.systemsx.cisd.common.logging.Log4jSimpleLogger;
 import ch.systemsx.cisd.common.logging.LogCategory;
 import ch.systemsx.cisd.common.logging.LogFactory;
+import ch.systemsx.cisd.common.logging.LogLevel;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.CorePlugin;
 
 /**
@@ -57,13 +58,22 @@ public class CorePluginScanner implements ICorePluginResourceLoader
         }
     }
 
-    private Logger operationLog = LogFactory.getLogger(LogCategory.OPERATION, getClass());
+    private static final ISimpleLogger DEFAULT_LOGGER = new Log4jSimpleLogger(LogFactory.getLogger(
+            LogCategory.OPERATION, CorePluginScanner.class));
+
+    private final ISimpleLogger log;
 
     private final File pluginsFolder;
 
     private final ScannerType scannerType;
 
     public CorePluginScanner(String pluginsFolderName, ScannerType scannerType)
+    {
+        this(pluginsFolderName, scannerType, DEFAULT_LOGGER);
+    }
+
+    // testing only
+    CorePluginScanner(String pluginsFolderName, ScannerType scannerType, ISimpleLogger logger)
     {
         this.pluginsFolder = new File(pluginsFolderName);
         this.scannerType = scannerType;
@@ -72,6 +82,7 @@ public class CorePluginScanner implements ICorePluginResourceLoader
             throw ConfigurationFailureException.fromTemplate("Invalid core-plugins folder '%s'",
                     pluginsFolderName);
         }
+        this.log = logger;
     }
 
     public File tryGetFile(CorePlugin plugin, String path)
@@ -111,7 +122,7 @@ public class CorePluginScanner implements ICorePluginResourceLoader
                 allVersionsForPlugin.add(pluginVersion);
             } else
             {
-                operationLog.warn(String.format("Invalid version '%s' for plugin '%s'. "
+                log.log(LogLevel.WARN, String.format("Invalid version '%s' for plugin '%s'. "
                         + "Plugin version must be non-negative integer numbers.",
                         versionDir.getName(), pluginRootDir.getAbsolutePath()));
             }
@@ -119,8 +130,8 @@ public class CorePluginScanner implements ICorePluginResourceLoader
 
         if (allVersionsForPlugin.isEmpty())
         {
-            operationLog.warn(String.format(
-                    "No valid versions have been detected for plugin '%s': ", pluginRootDir));
+            log.log(LogLevel.WARN, String.format(
+                    "No valid versions have been detected for plugin '%s'.", pluginRootDir));
             return null;
         } else
         {
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/CorePlugin.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/CorePlugin.java
index dd44dcb8c4f40b6c2d666fa7f0d3254fd182c18d..16e93a612ee755ec25c229f3b95015c6841ae1e8 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/CorePlugin.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/CorePlugin.java
@@ -45,7 +45,12 @@ public class CorePlugin implements Comparable<CorePlugin>
 
     public int compareTo(CorePlugin other)
     {
-        return this.version - other.version;
+        int result = name.compareTo(other.name);
+        if (result == 0)
+        {
+            result = this.version - other.version;
+        }
+        return result;
     }
 
     @Override
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/coreplugin/CorePluginScannerTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/coreplugin/CorePluginScannerTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..5571a452f352742e0a0ebf2fd5537209141f3308
--- /dev/null
+++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/coreplugin/CorePluginScannerTest.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2011 ETH Zuerich, CISD
+ *
+ * Licensed 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 ch.systemsx.cisd.openbis.generic.server.coreplugin;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.commons.io.FileUtils;
+import org.testng.annotations.Test;
+
+import ch.systemsx.cisd.base.tests.AbstractFileSystemTestCase;
+import ch.systemsx.cisd.common.exceptions.ConfigurationFailureException;
+import ch.systemsx.cisd.common.filesystem.FileUtilities;
+import ch.systemsx.cisd.common.logging.AssertingLogger;
+import ch.systemsx.cisd.common.logging.LogLevel;
+import ch.systemsx.cisd.openbis.generic.server.coreplugin.CorePluginScanner.ScannerType;
+import ch.systemsx.cisd.openbis.generic.shared.basic.dto.CorePlugin;
+
+/**
+ * @author Kaloyan Enimanev
+ */
+public class CorePluginScannerTest extends AbstractFileSystemTestCase
+{
+    private final String CORE_PLUGINS_DIR = "../openbis/resource/test-data/core-plugins";
+
+    @Test
+    public void testWithRealFolder() throws IOException
+    {
+        AssertingLogger logger = new AssertingLogger();
+        File pluginsDir = preparePluginsDirectory(CORE_PLUGINS_DIR);
+        CorePluginScanner scanner =
+                new CorePluginScanner(pluginsDir.getAbsolutePath(), ScannerType.AS, logger);
+
+        List<CorePlugin> plugins = scanner.scanForPlugins();
+        Collections.sort(plugins);
+
+        assertEquals(2, plugins.size());
+
+        CorePlugin plugin = plugins.get(0);
+        assertEquals("plugin-X", plugin.getName());
+        assertEquals(15, plugin.getVersion());
+        assertEquals("TEST-SCRIPT", getMasterDataScript(plugin, scanner).trim());
+
+        plugin = plugins.get(1);
+        assertEquals("plugin-Y", plugin.getName());
+        assertEquals(3, plugin.getVersion());
+        assertEquals(null, getMasterDataScript(plugin, scanner));
+
+        List<String> logMessages =
+                Arrays.asList(
+                        "No valid versions have been detected for plugin '"
+                                + pluginsDir.getAbsolutePath() + "/invalid-folder'.",
+                        "Invalid version 'NaN-version' for plugin '"
+                                + pluginsDir.getAbsolutePath()
+                                + "/plugin-X'. Plugin version must be non-negative integer numbers.");
+        logger.assertNumberOfMessage(logMessages.size());
+        for (int i = 0; i < logMessages.size(); i++)
+        {
+            String logMessage = logMessages.get(i);
+            logger.assertEq(i, LogLevel.WARN, logMessage);
+        }
+    }
+
+    private File preparePluginsDirectory(String originalPath) throws IOException
+    {
+        File originalDir = new File(originalPath);
+        FileUtils.copyDirectory(originalDir, workingDirectory, new FileFilter()
+            {
+                public boolean accept(File pathname)
+                {
+                    return false == pathname.getName().equals(".svn");
+                }
+            });
+        return workingDirectory;
+    }
+
+    private String getMasterDataScript(CorePlugin plugin, CorePluginScanner scanner)
+    {
+        File file = scanner.tryGetFile(plugin, AsCorePluginPaths.INIT_MASTER_DATA_SCRIPT);
+        if (file != null)
+        {
+            return FileUtilities.loadToString(file);
+        }
+        return null;
+    }
+
+    @Test(expectedExceptions = ConfigurationFailureException.class)
+    public void testWithInvalidFolder()
+    {
+        new CorePluginScanner("/invalid-folder", ScannerType.AS);
+    }
+
+}