|
From: <fg...@us...> - 2012-05-06 16:59:00
|
Revision: 4002
http://openutils.svn.sourceforge.net/openutils/?rev=4002&view=rev
Author: fgiust
Date: 2012-05-06 16:58:51 +0000 (Sun, 06 May 2012)
Log Message:
-----------
Merged revisions 3962,3964-3965,3972-3975,3989-3991,3996 via svnmerge from
https://openutils.svn.sourceforge.net/svnroot/openutils/magnoliamodules/branches/magnolia44
........
r3962 | fgiust | 2012-05-06 15:15:55 +0200 (Sun, 06 May 2012) | 1 line
avoid NPEs
........
r3964 | fgiust | 2012-05-06 15:39:32 +0200 (Sun, 06 May 2012) | 1 line
TASKS-13 Conditional bootstrap of -dev folders for multiple modules
........
r3965 | fgiust | 2012-05-06 15:54:05 +0200 (Sun, 06 May 2012) | 1 line
TASKS-14 Alternative DevelopmentUtilsPage for exporting to multiple folders
........
r3972 | fgiust | 2012-05-06 16:21:17 +0200 (Sun, 06 May 2012) | 1 line
MEDIA-285 remove usage of com.sun.image.codec.jpeg.JPEGCodec
........
r3973 | fgiust | 2012-05-06 16:35:22 +0200 (Sun, 06 May 2012) | 1 line
MEDIA-285 remove usage of com.sun.image.codec.jpeg.JPEGCodec
........
r3974 | fgiust | 2012-05-06 16:42:42 +0200 (Sun, 06 May 2012) | 1 line
MGNLUTILS-33 new contentByUUID() EL function
........
r3975 | fgiust | 2012-05-06 17:11:04 +0200 (Sun, 06 May 2012) | 1 line
MGNLUTILS-34 Add methods from info.magnolia.cms.taglibs.CmsFunctions
........
r3989 | fgiust | 2012-05-06 18:02:06 +0200 (Sun, 06 May 2012) | 1 line
GROOVY-7 brand new console - menu config
........
r3990 | fgiust | 2012-05-06 18:05:47 +0200 (Sun, 06 May 2012) | 1 line
update groovy version
........
r3991 | fgiust | 2012-05-06 18:12:41 +0200 (Sun, 06 May 2012) | 1 line
GROOVY-7 new icon
........
r3996 | fgiust | 2012-05-06 18:20:26 +0200 (Sun, 06 May 2012) | 1 line
compilation fix
........
Revision Links:
--------------
http://openutils.svn.sourceforge.net/openutils/?rev=3962&view=rev
http://openutils.svn.sourceforge.net/openutils/?rev=3964&view=rev
http://openutils.svn.sourceforge.net/openutils/?rev=3965&view=rev
http://openutils.svn.sourceforge.net/openutils/?rev=3972&view=rev
http://openutils.svn.sourceforge.net/openutils/?rev=3973&view=rev
http://openutils.svn.sourceforge.net/openutils/?rev=3974&view=rev
http://openutils.svn.sourceforge.net/openutils/?rev=3975&view=rev
http://openutils.svn.sourceforge.net/openutils/?rev=3989&view=rev
http://openutils.svn.sourceforge.net/openutils/?rev=3990&view=rev
http://openutils.svn.sourceforge.net/openutils/?rev=3991&view=rev
http://openutils.svn.sourceforge.net/openutils/?rev=3996&view=rev
Modified Paths:
--------------
magnoliamodules/trunk/openutils-mgnlcriteria/pom.xml
magnoliamodules/trunk/openutils-mgnlgroovy/pom.xml
magnoliamodules/trunk/openutils-mgnlgroovy/src/main/java/net/sourceforge/openutils/mgnlgroovy/lifecycle/GroovyShellModule.java
magnoliamodules/trunk/openutils-mgnlgroovy/src/main/java/net/sourceforge/openutils/mgnlgroovy/pages/GroovyShellScript.java
magnoliamodules/trunk/openutils-mgnlgroovy/src/main/java/net/sourceforge/openutils/mgnlgroovy/setup/GroovyShellModuleVersionHandler.java
magnoliamodules/trunk/openutils-mgnlgroovy/src/main/resources/mgnl-resources/groovyshell/icons/groovy-small.png
magnoliamodules/trunk/openutils-mgnlgroovy/src/main/resources/net/sourceforge/openutils/mgnlgroovy/pages/GroovyShellScript.html
magnoliamodules/trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/uri/MediaURI2RepositoryMapping.java
magnoliamodules/trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/utils/JpegUtils.java
magnoliamodules/trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/RepositoryMessagesImpl.java
magnoliamodules/trunk/openutils-mgnltasks/src/main/java/it/openutils/mgnltasks/SimpleModuleVersionHandler.java
magnoliamodules/trunk/openutils-mgnlutils/pom.xml
magnoliamodules/trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnlutils/el/MgnlUtilsElFunctions.java
magnoliamodules/trunk/openutils-mgnlutils/src/main/resources/META-INF/tld/mgnlutils.tld
Added Paths:
-----------
magnoliamodules/trunk/openutils-mgnlcriteria/src/test/java/it/
magnoliamodules/trunk/openutils-mgnlcriteria/src/test/java/it/openutils/
magnoliamodules/trunk/openutils-mgnlcriteria/src/test/java/it/openutils/mgnlutils/
magnoliamodules/trunk/openutils-mgnlcriteria/src/test/java/it/openutils/mgnlutils/test/
magnoliamodules/trunk/openutils-mgnlcriteria/src/test/java/it/openutils/mgnlutils/test/AbstractRepositoryTestcase.java
magnoliamodules/trunk/openutils-mgnlcriteria/src/test/java/it/openutils/mgnlutils/test/ModuleConfiguration.java
magnoliamodules/trunk/openutils-mgnlcriteria/src/test/java/it/openutils/mgnlutils/test/RepositoryTestConfiguration.java
magnoliamodules/trunk/openutils-mgnlcriteria/src/test/java/it/openutils/mgnlutils/test/TestNgRepositoryTestcase.java
magnoliamodules/trunk/openutils-mgnlgroovy/src/main/resources/mgnl-bootstrap/groovyshell/config.modules.adminInterface.config.menu.tools.groovyShellScript.xml
magnoliamodules/trunk/openutils-mgnlgroovy/src/main/resources/mgnl-resources/groovyshell/js/jquery/
magnoliamodules/trunk/openutils-mgnltasks/src/main/java/it/openutils/mgnltasks/dev/
magnoliamodules/trunk/openutils-mgnltasks/src/main/resources/it/
magnoliamodules/trunk/openutils-mgnltasks/src/main/resources/mgnl-resources/
Removed Paths:
-------------
magnoliamodules/trunk/openutils-mgnlgroovy/src/main/java/net/sourceforge/openutils/mgnlgroovy/pages/GroovyShellPage.java.bk
magnoliamodules/trunk/openutils-mgnlgroovy/src/main/resources/mgnl-bootstrap/groovyshell/config.modules.adminInterface.config.menu.tools.groovyShell.xml
magnoliamodules/trunk/openutils-mgnlgroovy/src/main/resources/mgnl-bootstrap/groovyshell/config.modules.groovyshell.pages.groovyShell.xml
magnoliamodules/trunk/openutils-mgnlgroovy/src/main/resources/net/sourceforge/openutils/mgnlgroovy/pages/GroovyShellPage.html.bk
Property Changed:
----------------
magnoliamodules/trunk/
magnoliamodules/trunk/openutils-mgnlmedia/
Property changes on: magnoliamodules/trunk
___________________________________________________________________
Modified: svnmerge-integrated
- /magnoliamodules/branches/magnolia44:1-3807,3809-3812,3815-3892,3894,3899,3902,3904,3908,3912,3914-3960
+ /magnoliamodules/branches/magnolia44:1-3807,3809-3812,3815-3892,3894,3899,3902,3904,3908,3912,3914-3962,3964-3965,3968,3972-3975,3977,3981,3986,3989-3991,3993,3996,3998,4001
Modified: svn:mergeinfo
- /magnoliamodules/branches/magnolia44:3809-3812,3815-3892,3952-3958
+ /magnoliamodules/branches/magnolia44:3809-3812,3815-3892,3952-3958,3962,3964-3965,3972-3975,3989-3991,3996
Modified: magnoliamodules/trunk/openutils-mgnlcriteria/pom.xml
===================================================================
--- magnoliamodules/trunk/openutils-mgnlcriteria/pom.xml 2012-05-06 16:35:53 UTC (rev 4001)
+++ magnoliamodules/trunk/openutils-mgnlcriteria/pom.xml 2012-05-06 16:58:51 UTC (rev 4002)
@@ -129,6 +129,8 @@
<artifactId>commons-lang</artifactId>
<version>2.4</version>
</dependency>
+ <!--
+ no cycles
<dependency>
<groupId>net.sourceforge.openutils</groupId>
<artifactId>openutils-mgnlutils</artifactId>
@@ -141,6 +143,7 @@
</exclusion>
</exclusions>
</dependency>
+ -->
<dependency>
<groupId>javax.jcr</groupId>
<artifactId>jcr</artifactId>
Added: magnoliamodules/trunk/openutils-mgnlcriteria/src/test/java/it/openutils/mgnlutils/test/AbstractRepositoryTestcase.java
===================================================================
--- magnoliamodules/trunk/openutils-mgnlcriteria/src/test/java/it/openutils/mgnlutils/test/AbstractRepositoryTestcase.java (rev 0)
+++ magnoliamodules/trunk/openutils-mgnlcriteria/src/test/java/it/openutils/mgnlutils/test/AbstractRepositoryTestcase.java 2012-05-06 16:58:51 UTC (rev 4002)
@@ -0,0 +1,429 @@
+/**
+ *
+ * Criteria API for Magnolia CMS (http://www.openmindlab.com/lab/products/mgnlcriteria.html)
+ * Copyright(C) 2009-2011, Openmind S.r.l. http://www.openmindonline.it
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+// TEMPORARY COPIED HERE TO AVOID CIRCULAR DEPENDENCY - MuST SPLIT mgnlutils to FIX
+
+package it.openutils.mgnlutils.test;
+
+import info.magnolia.cms.beans.config.ContentRepository;
+import info.magnolia.cms.core.Content;
+import info.magnolia.cms.core.Path;
+import info.magnolia.cms.core.SystemProperty;
+import info.magnolia.cms.util.ClasspathResourcesUtil;
+import info.magnolia.cms.util.ContentUtil;
+import info.magnolia.content2bean.Content2BeanException;
+import info.magnolia.content2bean.Content2BeanProcessor;
+import info.magnolia.content2bean.Content2BeanUtil;
+import info.magnolia.content2bean.TypeMapping;
+import info.magnolia.content2bean.impl.Content2BeanProcessorImpl;
+import info.magnolia.content2bean.impl.TypeMappingImpl;
+import info.magnolia.context.MgnlContext;
+import info.magnolia.context.SystemContext;
+import info.magnolia.context.SystemRepositoryStrategy;
+import info.magnolia.importexport.BootstrapUtil;
+import info.magnolia.init.MagnoliaConfigurationProperties;
+import info.magnolia.init.properties.ClasspathPropertySource;
+import info.magnolia.init.properties.InitPathsPropertySource;
+import info.magnolia.init.properties.ModulePropertiesSource;
+import info.magnolia.module.ModuleLifecycle;
+import info.magnolia.module.ModuleManagementException;
+import info.magnolia.module.ModuleManager;
+import info.magnolia.module.ModuleManagerImpl;
+import info.magnolia.module.ModuleRegistry;
+import info.magnolia.module.ModuleRegistryImpl;
+import info.magnolia.module.model.ModuleDefinition;
+import info.magnolia.module.model.reader.BetwixtModuleDefinitionReader;
+import info.magnolia.module.model.reader.DependencyCheckerImpl;
+import info.magnolia.objectfactory.Components;
+import info.magnolia.objectfactory.configuration.ComponentConfiguration;
+import info.magnolia.objectfactory.configuration.ComponentProviderConfiguration;
+import info.magnolia.objectfactory.configuration.ComponentProviderConfigurationBuilder;
+import info.magnolia.objectfactory.configuration.ConfiguredComponentConfiguration;
+import info.magnolia.objectfactory.configuration.ImplementationConfiguration;
+import info.magnolia.objectfactory.configuration.InstanceConfiguration;
+import info.magnolia.objectfactory.configuration.ProviderConfiguration;
+import info.magnolia.repository.DefaultRepositoryManager;
+import info.magnolia.repository.RepositoryManager;
+import info.magnolia.test.ComponentsTestUtil;
+import info.magnolia.test.FixedModuleDefinitionReader;
+import info.magnolia.test.TestMagnoliaConfigurationProperties;
+import info.magnolia.test.TestMagnoliaInitPaths;
+import info.magnolia.test.mock.MockContext;
+import info.magnolia.test.mock.MockUtil;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import javax.jcr.ImportUUIDBehavior;
+import javax.jcr.RepositoryException;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang.StringUtils;
+import org.apache.jackrabbit.core.jndi.BindableRepositoryFactory;
+import org.apache.log4j.Level;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * Generic version of Magnolia RepositoryTestcase, as found in magnolia-core test jar.
+ * @author fgiust
+ * @version $Id$
+ */
+@RepositoryTestConfiguration
+public abstract class AbstractRepositoryTestcase
+{
+
+ /**
+ * Logger.
+ */
+ protected Logger log = LoggerFactory.getLogger(getClass());
+
+ /**
+ * Setup and start the repository
+ * @throws Exception any exception thrown during the test setup
+ */
+ public void setUp() throws Exception
+ {
+ // ignore mapping warnings
+ org.apache.log4j.Logger.getLogger(ContentRepository.class).setLevel(Level.ERROR);
+
+ if (!this.getClass().isAnnotationPresent(RepositoryTestConfiguration.class))
+ {
+ throw new IllegalArgumentException("You should annotate your test with @RepositoryTestConfiguration");
+ }
+
+ // retrieve configuration from annotation
+ RepositoryTestConfiguration repositoryTestConfiguration = this.getClass().getAnnotation(
+ RepositoryTestConfiguration.class);
+
+ String repositoryConfigFileName = repositoryTestConfiguration.repositoryConfig();
+
+ String jackrabbitRepositoryConfigFileName = repositoryTestConfiguration.jackrabbitRepositoryConfig();
+ String magnoliaProperties = repositoryTestConfiguration.magnoliaProperties();
+
+ boolean autoStart = repositoryTestConfiguration.autostart();
+ boolean quiet = repositoryTestConfiguration.quiet();
+
+ initDefaultImplementations();
+ SystemProperty.getProperties().load(this.getClass().getResourceAsStream(magnoliaProperties));
+ MockUtil.initMockContext();
+ workaroundJCR1778();
+
+ if (autoStart)
+ {
+ cleanUp();
+ startRepository(repositoryConfigFileName, jackrabbitRepositoryConfigFileName, quiet);
+ }
+
+ if (repositoryTestConfiguration != null)
+ {
+ // bootstrap files list
+ bootstrapFile(repositoryTestConfiguration.bootstrapFiles());
+
+ // bootstrap files from directory
+ if (StringUtils.isNotBlank(repositoryTestConfiguration.bootstrapDirectory()))
+ {
+ bootstrapDirectory(repositoryTestConfiguration.bootstrapDirectory());
+ }
+
+ for (ModuleConfiguration module : repositoryTestConfiguration.startModules())
+ {
+ startModule(module.name(), module.moduleclass());
+ }
+
+ }
+
+ }
+
+ /**
+ * Shutdown the repository, optionally deleting the containing folder.
+ * @throws Exception any exception thrown during the shutdown.
+ */
+ public void tearDown() throws Exception
+ {
+ RepositoryTestConfiguration repositoryTestConfiguration = this.getClass().getAnnotation(
+ RepositoryTestConfiguration.class);
+
+ // if module is set it is stopped on tearDown
+ for (ModuleConfiguration module : repositoryTestConfiguration.startModules())
+ {
+ ((ModuleLifecycle) ModuleRegistry.Factory.getInstance().getModuleInstance(module.name())).stop(null);
+ }
+
+ if (repositoryTestConfiguration.autostart())
+ {
+
+ final org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger("info.magnolia");
+ final Level originalLogLevel = logger.getLevel();
+ if (repositoryTestConfiguration.quiet())
+ {
+ logger.setLevel(Level.WARN);
+ }
+ MgnlContext.release();
+ MgnlContext.getSystemContext().release();
+ ContentRepository.shutdown();
+ if (true)
+ {
+ cleanUp();
+ }
+ logger.setLevel(originalLogLevel);
+ }
+ SystemProperty.getProperties().clear();
+
+ // ComponentsTestUtil.clear();
+ SystemProperty.getProperties().clear();
+ MgnlContext.setInstance(null);
+ }
+
+ // info.magnolia.test.MgnlTestCase.initDefaultImplementations()
+ private void initDefaultImplementations() throws IOException, ModuleManagementException
+ {
+ final List<ModuleDefinition> modules = getModuleDefinitionsForTests();
+ final ModuleRegistry mr = new ModuleRegistryImpl();
+ ModuleManagerImpl mm = new ModuleManagerImpl(
+ null,
+ new FixedModuleDefinitionReader(modules),
+ mr,
+ new DependencyCheckerImpl());
+ mm.loadDefinitions();
+
+ final TestMagnoliaConfigurationProperties configurationProperties = new TestMagnoliaConfigurationProperties(
+ new ModulePropertiesSource(mr),
+ new ClasspathPropertySource("/test-magnolia.properties"),
+ new InitPathsPropertySource(new TestMagnoliaInitPaths()));
+ SystemProperty.setMagnoliaConfigurationProperties(configurationProperties);
+
+ ComponentsTestUtil.setInstance(ModuleManager.class, mm);
+ ComponentsTestUtil.setInstance(ModuleRegistry.class, mr);
+ ComponentsTestUtil.setInstance(MagnoliaConfigurationProperties.class, configurationProperties);
+
+ ComponentsTestUtil.setImplementation(RepositoryManager.class, DefaultRepositoryManager.class);
+
+ ComponentProviderConfigurationBuilder configurationBuilder = new ComponentProviderConfigurationBuilder();
+ ComponentProviderConfiguration configuration = configurationBuilder.getComponentsFromModules(
+ "system",
+ mr.getModuleDefinitions());
+ configuration.combine(configurationBuilder.getComponentsFromModules("main", mr.getModuleDefinitions()));
+
+ // Content2BeanProcessorImpl uses dependency injection and since we don't have that with MockComponentProvider
+ // we
+ // need to manually create this object and replace the component configuration read from core.xml
+ final TypeMappingImpl typeMapping = new TypeMappingImpl();
+ configuration.registerInstance(TypeMapping.class, typeMapping);
+ configuration.registerInstance(Content2BeanProcessor.class, new Content2BeanProcessorImpl(typeMapping));
+
+ for (Map.Entry<Class, ComponentConfiguration> entry : configuration.getComponents().entrySet())
+ {
+ ComponentConfiguration value = entry.getValue();
+ if (value instanceof ImplementationConfiguration)
+ {
+ ImplementationConfiguration config = (ImplementationConfiguration) value;
+ ComponentsTestUtil.setImplementation(config.getType(), config.getImplementation());
+ }
+ else if (value instanceof InstanceConfiguration)
+ {
+ InstanceConfiguration config = (InstanceConfiguration) value;
+ ComponentsTestUtil.setInstance(config.getType(), config.getInstance());
+ }
+ else if (value instanceof ProviderConfiguration)
+ {
+ ProviderConfiguration config = (ProviderConfiguration) value;
+ ComponentsTestUtil.setImplementation(config.getType(), config.getProviderClass());
+ }
+ else if (value instanceof ConfiguredComponentConfiguration)
+ {
+ ConfiguredComponentConfiguration config = (ConfiguredComponentConfiguration) value;
+ ComponentsTestUtil.setConfigured(
+ config.getType(),
+ config.getWorkspace(),
+ config.getPath(),
+ config.isObserved());
+ }
+ }
+
+ for (Map.Entry<Class< ? >, Class< ? >> entry : configuration.getTypeMapping().entrySet())
+ {
+ ComponentsTestUtil.setImplementation((Class) entry.getKey(), (Class) entry.getValue());
+ }
+ }
+
+ // info.magnolia.test.MgnlTestCase.getModuleDefinitionsForTests()
+ /**
+ * Override this method to provide the appropriate list of modules your tests need.
+ */
+ protected List<ModuleDefinition> getModuleDefinitionsForTests() throws ModuleManagementException
+ {
+ final ModuleDefinition core = new BetwixtModuleDefinitionReader()
+ .readFromResource("/META-INF/magnolia/core.xml");
+ return Collections.singletonList(core);
+ }
+
+ /**
+ * Workaround for JCR-1778.
+ */
+ @SuppressWarnings("unchecked")
+ static void workaroundJCR1778()
+ {
+ try
+ {
+ Field cacheField = BindableRepositoryFactory.class.getDeclaredField("cache");
+ cacheField.setAccessible(true);
+ final Map<String, String> cache = (Map<String, String>) cacheField.get(null);
+ cache.clear();
+ }
+ catch (SecurityException e)
+ {
+ // ignore
+ }
+ catch (NoSuchFieldException e)
+ {
+ // ignore
+ }
+ catch (IllegalArgumentException e)
+ {
+ // ignore
+ }
+ catch (IllegalAccessException e)
+ {
+ // ignore
+ }
+ }
+
+ protected void modifyContextesToUseRealRepository()
+ {
+ SystemContext systemContext = MgnlContext.getSystemContext();
+ RepositoryManager repositoryManager = Components.getComponent(RepositoryManager.class);
+ SystemRepositoryStrategy repositoryStrategy = new SystemRepositoryStrategy(repositoryManager);
+
+ ((MockContext) systemContext).setRepositoryStrategy(repositoryStrategy);
+ ((MockContext) MgnlContext.getInstance()).setRepositoryStrategy(repositoryStrategy);
+ }
+
+ protected void startRepository(String repositoryConfigFileName, String jackrabbitRepositoryConfigFileName,
+ boolean quiet) throws Exception
+ {
+ final org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger("info.magnolia");
+ final Level originalLogLevel = logger.getLevel();
+ if (quiet)
+ {
+ logger.setLevel(Level.WARN);
+ }
+
+ ContentRepository.REPOSITORY_USER = SystemProperty.getProperty("magnolia.connection.jcr.userId");
+ ContentRepository.REPOSITORY_PSWD = SystemProperty.getProperty("magnolia.connection.jcr.password");
+
+ InputStream repositoryConfigFileStream = ClasspathResourcesUtil
+ .getResource(repositoryConfigFileName)
+ .openStream();
+
+ extractConfigFile("magnolia.repositories.config", repositoryConfigFileStream, "target/repositories.xml");
+
+ IOUtils.closeQuietly(repositoryConfigFileStream);
+
+ InputStream jackrabbitRepositoryConfigFileStream = ClasspathResourcesUtil.getResource(
+ jackrabbitRepositoryConfigFileName).openStream();
+
+ extractConfigFile(
+ "magnolia.repositories.jackrabbit.config",
+ jackrabbitRepositoryConfigFileStream,
+ "target/repo-conf/extracted.xml");
+
+ IOUtils.closeQuietly(jackrabbitRepositoryConfigFileStream);
+
+ ContentRepository.init();
+
+ modifyContextesToUseRealRepository();
+
+ logger.setLevel(originalLogLevel);
+ }
+
+ private void extractConfigFile(String propertyName, InputStream configFileStream, String extractToPath)
+ throws Exception
+ {
+ String targetFilename = Path.getAbsoluteFileSystemPath(extractToPath);
+ File targetFile = new File(targetFilename);
+ // extract resource to the filesystem (jackrabbit can't use a stream)
+ new File(targetFile.getParent()).mkdirs();
+ IOUtils.copy(configFileStream, new FileOutputStream(targetFile));
+ SystemProperty.setProperty(propertyName, extractToPath);
+ }
+
+ private void cleanUp() throws IOException
+ {
+ FileUtils.deleteDirectory(new File(SystemProperty.getProperty("magnolia.repositories.home")));
+ }
+
+ /**
+ * Bootstrap one or more xml files.
+ * @param resources one or more xml files (classpath path)
+ * @throws RepositoryException thrown during import
+ * @throws IOException if there are errors while loading the files
+ */
+ protected void bootstrapFile(String... resources) throws IOException, RepositoryException
+ {
+ BootstrapUtil.bootstrap(resources, ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW);
+ }
+
+ /**
+ * Loads all the bootstrap files in a specified path under the classpath
+ * @param path classpath path
+ * @throws RepositoryException thrown during import
+ * @throws IOException if there are errors while loading the files
+ */
+ protected void bootstrapDirectory(String path) throws IOException, RepositoryException
+ {
+ List<String> resourcesToBootstrap = new ArrayList<String>();
+
+ for (File file : new File(path).listFiles())
+ {
+ resourcesToBootstrap.add(file.getAbsolutePath());
+ }
+
+ BootstrapUtil.bootstrap(
+ resourcesToBootstrap.toArray(new String[resourcesToBootstrap.size()]),
+ ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW);
+ }
+
+ /**
+ * Register and starts a module
+ * @param modulename modulename
+ * @param moduleClass ModuleClass
+ * @throws Content2BeanException if the module configuration can't be successfully parsed.
+ * @return module instance
+ */
+ protected ModuleLifecycle startModule(String modulename, Class< ? extends ModuleLifecycle> moduleClass)
+ throws Content2BeanException
+ {
+ // register and start module
+ Content content = ContentUtil.getContent("config", "/modules/" + modulename + "/config");
+ ModuleLifecycle module = (ModuleLifecycle) Content2BeanUtil.toBean(content, true, moduleClass);
+ module.start(null);
+ ModuleRegistry.Factory.getInstance().registerModuleInstance(modulename, module);
+
+ return module;
+ }
+}
Property changes on: magnoliamodules/trunk/openutils-mgnlcriteria/src/test/java/it/openutils/mgnlutils/test/AbstractRepositoryTestcase.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: magnoliamodules/trunk/openutils-mgnlcriteria/src/test/java/it/openutils/mgnlutils/test/ModuleConfiguration.java
===================================================================
--- magnoliamodules/trunk/openutils-mgnlcriteria/src/test/java/it/openutils/mgnlutils/test/ModuleConfiguration.java (rev 0)
+++ magnoliamodules/trunk/openutils-mgnlcriteria/src/test/java/it/openutils/mgnlutils/test/ModuleConfiguration.java 2012-05-06 16:58:51 UTC (rev 4002)
@@ -0,0 +1,52 @@
+/**
+ *
+ * Criteria API for Magnolia CMS (http://www.openmindlab.com/lab/products/mgnlcriteria.html)
+ * Copyright(C) 2009-2011, Openmind S.r.l. http://www.openmindonline.it
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+// TEMPORARY COPIED HERE TO AVOID CIRCULAR DEPENDENCY - MuST SPLIT mgnlutils to FIX
+
+package it.openutils.mgnlutils.test;
+
+import info.magnolia.module.ModuleLifecycle;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+
+/**
+ * @author fgiust
+ * @version $Id$
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+@Inherited
+@Documented
+public @interface ModuleConfiguration {
+
+ /**
+ * Module name.
+ */
+ String name() default "";
+
+ /**
+ * Module name.
+ */
+ Class< ? extends ModuleLifecycle> moduleclass();
+}
Property changes on: magnoliamodules/trunk/openutils-mgnlcriteria/src/test/java/it/openutils/mgnlutils/test/ModuleConfiguration.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: magnoliamodules/trunk/openutils-mgnlcriteria/src/test/java/it/openutils/mgnlutils/test/RepositoryTestConfiguration.java
===================================================================
--- magnoliamodules/trunk/openutils-mgnlcriteria/src/test/java/it/openutils/mgnlutils/test/RepositoryTestConfiguration.java (rev 0)
+++ magnoliamodules/trunk/openutils-mgnlcriteria/src/test/java/it/openutils/mgnlutils/test/RepositoryTestConfiguration.java 2012-05-06 16:58:51 UTC (rev 4002)
@@ -0,0 +1,82 @@
+/**
+ *
+ * Criteria API for Magnolia CMS (http://www.openmindlab.com/lab/products/mgnlcriteria.html)
+ * Copyright(C) 2009-2011, Openmind S.r.l. http://www.openmindonline.it
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+// TEMPORARY COPIED HERE TO AVOID CIRCULAR DEPENDENCY - MuST SPLIT mgnlutils to FIX
+
+package it.openutils.mgnlutils.test;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+
+/**
+ * Annotation for configuring a Repository test case.
+ * @author carlo
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+@Inherited
+@Documented
+public @interface RepositoryTestConfiguration {
+
+ /**
+ * Path for magnolia repository config file. Defaults to "/test-repositories.xml".
+ */
+ String repositoryConfig() default "/test-repositories.xml";
+
+ /**
+ * Path for jackrabbit configuration file. Defaults to "/repo-conf/jackrabbit-memory-search.xml"
+ */
+ String jackrabbitRepositoryConfig() default "/repo-conf/jackrabbit-memory-search.xml";
+
+ /**
+ * A list of files to bootstrap.
+ */
+ String[] bootstrapFiles() default {};
+
+ /**
+ * A list of directory (classpath paths) to bootstrap.
+ */
+ String bootstrapDirectory() default "";
+
+ /**
+ * magnolia.properties location. Defaults to "/test-magnolia.properties".
+ */
+ String magnoliaProperties() default "/test-magnolia.properties";
+
+ /**
+ * Autostart repositories. Defaults to true.
+ */
+ boolean autostart() default true;
+
+ /**
+ * Quiet (shut up logging during startup). Defaults to true.
+ */
+ boolean quiet() default true;
+
+ /**
+ * Name of modules that should be registered and started. Configuration should exist in the repository for these
+ * modules.
+ */
+ ModuleConfiguration[] startModules() default {};
+
+}
Property changes on: magnoliamodules/trunk/openutils-mgnlcriteria/src/test/java/it/openutils/mgnlutils/test/RepositoryTestConfiguration.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: magnoliamodules/trunk/openutils-mgnlcriteria/src/test/java/it/openutils/mgnlutils/test/TestNgRepositoryTestcase.java
===================================================================
--- magnoliamodules/trunk/openutils-mgnlcriteria/src/test/java/it/openutils/mgnlutils/test/TestNgRepositoryTestcase.java (rev 0)
+++ magnoliamodules/trunk/openutils-mgnlcriteria/src/test/java/it/openutils/mgnlutils/test/TestNgRepositoryTestcase.java 2012-05-06 16:58:51 UTC (rev 4002)
@@ -0,0 +1,49 @@
+/**
+ *
+ * Criteria API for Magnolia CMS (http://www.openmindlab.com/lab/products/mgnlcriteria.html)
+ * Copyright(C) 2009-2011, Openmind S.r.l. http://www.openmindonline.it
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+// TEMPORARY COPIED HERE TO AVOID CIRCULAR DEPENDENCY - MuST SPLIT mgnlutils to FIX
+package it.openutils.mgnlutils.test;
+
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+
+
+/**
+ * TestNG version of Magnolia RepositoryTestcase. Extend this class and configure it by adding a @RepositoryTestConfiguration
+ * annotation.
+ * @author fgiust
+ * @version $Id$
+ */
+public abstract class TestNgRepositoryTestcase extends AbstractRepositoryTestcase
+{
+
+ @Override
+ @BeforeClass
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ }
+
+ @Override
+ @AfterClass
+ public void tearDown() throws Exception
+ {
+ super.tearDown();
+ }
+
+}
Property changes on: magnoliamodules/trunk/openutils-mgnlcriteria/src/test/java/it/openutils/mgnlutils/test/TestNgRepositoryTestcase.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Modified: magnoliamodules/trunk/openutils-mgnlgroovy/pom.xml
===================================================================
--- magnoliamodules/trunk/openutils-mgnlgroovy/pom.xml 2012-05-06 16:35:53 UTC (rev 4001)
+++ magnoliamodules/trunk/openutils-mgnlgroovy/pom.xml 2012-05-06 16:58:51 UTC (rev 4002)
@@ -70,7 +70,7 @@
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
- <version>1.7.5</version>
+ <version>1.8.6</version>
<exclusions>
<exclusion>
<groupId>junit</groupId>
Modified: magnoliamodules/trunk/openutils-mgnlgroovy/src/main/java/net/sourceforge/openutils/mgnlgroovy/lifecycle/GroovyShellModule.java
===================================================================
--- magnoliamodules/trunk/openutils-mgnlgroovy/src/main/java/net/sourceforge/openutils/mgnlgroovy/lifecycle/GroovyShellModule.java 2012-05-06 16:35:53 UTC (rev 4001)
+++ magnoliamodules/trunk/openutils-mgnlgroovy/src/main/java/net/sourceforge/openutils/mgnlgroovy/lifecycle/GroovyShellModule.java 2012-05-06 16:58:51 UTC (rev 4002)
@@ -19,10 +19,10 @@
package net.sourceforge.openutils.mgnlgroovy.lifecycle;
+import groovy.lang.GroovySystem;
import info.magnolia.module.ModuleLifecycle;
import info.magnolia.module.ModuleLifecycleContext;
-import org.codehaus.groovy.runtime.InvokerHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -38,7 +38,7 @@
public void start(ModuleLifecycleContext moduleLifecycleContext)
{
- log.info("starting GroovyShellModule. Groovy version is " + InvokerHelper.getVersion());
+ log.info("starting GroovyShellModule. Groovy version is " + GroovySystem.getVersion());
}
Deleted: magnoliamodules/trunk/openutils-mgnlgroovy/src/main/java/net/sourceforge/openutils/mgnlgroovy/pages/GroovyShellPage.java.bk
===================================================================
--- magnoliamodules/trunk/openutils-mgnlgroovy/src/main/java/net/sourceforge/openutils/mgnlgroovy/pages/GroovyShellPage.java.bk 2012-05-06 16:35:53 UTC (rev 4001)
+++ magnoliamodules/trunk/openutils-mgnlgroovy/src/main/java/net/sourceforge/openutils/mgnlgroovy/pages/GroovyShellPage.java.bk 2012-05-06 16:58:51 UTC (rev 4002)
@@ -1,193 +0,0 @@
-/**
- *
- * Groovy Shell for Magnolia CMS (http://www.openmindlab.com/lab/products/groovy.html)
- * Copyright(C) 2008-2011, Openmind S.r.l. http://www.openmindonline.it
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-package net.sourceforge.openutils.mgnlgroovy.pages;
-
-import groovy.lang.GroovyShell;
-import groovy.lang.Script;
-import info.magnolia.cms.beans.runtime.Document;
-import info.magnolia.cms.util.AlertUtil;
-import info.magnolia.module.admininterface.TemplatedMVCHandler;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.lang.StringUtils;
-import org.apache.commons.lang.exception.ExceptionUtils;
-import org.codehaus.groovy.control.CompilationFailedException;
-import org.codehaus.groovy.runtime.InvokerHelper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-/**
- * A basic Groovy shell to be embedded in Magnolia.
- * @author fgrilli
- * @version $Id: GroovyShellPage.java 5074 2008-10-21 13:16:36Z federico.grilli $
- */
-public class GroovyShellPage extends TemplatedMVCHandler
-{
-
- private static final String LINE_SEP = System.getProperty("line.separator");
-
- private static final String GROOVY_VERSION = InvokerHelper.getVersion();
-
- private static final long serialVersionUID = 222L;
-
- private static Logger log = LoggerFactory.getLogger(GroovyShellPage.class);
-
- private String groovyScript;
-
- private Document groovyScriptFile;
-
- public GroovyShellPage(String name, HttpServletRequest request, HttpServletResponse response)
- {
- super(name, request, response);
-
- }
-
- public String executeGroovyScript()
- {
- if (StringUtils.isBlank(groovyScript))
- {
- String msg = "No script to execute";
- log.warn(msg);
- AlertUtil.setMessage(msg);
- return this.show();
- }
-
- log.debug("executing script {}", groovyScript);
-
- Object retVal;
-
- try
- {
- GroovyShell shell = new GroovyShell();
- Script script = shell.parse(getGroovyScript());
- retVal = script.run();
- AlertUtil.setMessage("Script executed successfully. Return value is " + retVal);
- }
-
- catch (CompilationFailedException e)
- {
- log.error("An error occurred while parsing the script. Error message is {}", e.getMessage());
- AlertUtil.setMessage("An error occurred while parsing the script. Error message is " + e.getMessage());
- }
- catch (Throwable e)
- {
- log.error("An error occurred while executing the script. Error message is " + e.getMessage(), e);
- AlertUtil.setMessage("An error occurred while executing the script. Error message is "
- + e.getMessage()
- + "\n"
- + ExceptionUtils.getFullStackTrace(e));
- }
-
- return this.show();
- }
-
- public String getGroovyScript()
- {
- return groovyScript;
- }
-
- public void setGroovyScript(String groovyScript)
- {
- this.groovyScript = groovyScript;
- }
-
- public String getGroovyVersion()
- {
- return GROOVY_VERSION;
- }
-
- public Document getGroovyScriptFile()
- {
- return groovyScriptFile;
- }
-
- public void setGroovyScriptFile(Document groovyScriptFile)
- {
- this.groovyScriptFile = groovyScriptFile;
- }
-
- public String loadGroovyScript()
- {
- if (groovyScriptFile == null)
- {
- String msg = "Please, select a file";
- log.warn(msg);
- AlertUtil.setMessage(msg);
- return this.show();
- }
- if (!groovyScriptFile.getExtension().equalsIgnoreCase("groovy"))
- {
- String msg = groovyScriptFile.getFileNameWithExtension() + " doesn't seem to be a valid groovy file";
- log.warn(msg);
- AlertUtil.setMessage(msg);
- return this.show();
- }
- groovyScript = readFile(groovyScriptFile.getFile());
-
- String msg = groovyScriptFile.getFileNameWithExtension() + " loaded";
- log.info(msg);
- AlertUtil.setMessage(msg);
- return this.show();
-
- }
-
- private String readFile(File file)
- {
- StringBuilder contents = new StringBuilder();
-
- try
- {
- // use buffering, reading one line at a time
- // FileReader always assumes default encoding is OK!
- BufferedReader input = new BufferedReader(new FileReader(file));
- try
- {
- String line = null; // not declared within while loop
- /*
- * readLine is a bit quirky : it returns the content of a line MINUS the newline. it returns null only
- * for the END of the stream. it returns an empty String if two newlines appear in a row.
- */
- while ((line = input.readLine()) != null)
- {
- contents.append(line);
- contents.append(LINE_SEP);
- }
- }
- finally
- {
- IOUtils.closeQuietly(input);
- }
- }
- catch (IOException ex)
- {
- log.error(ex.getMessage());
- }
- return contents.toString();
- }
-}
\ No newline at end of file
Modified: magnoliamodules/trunk/openutils-mgnlgroovy/src/main/java/net/sourceforge/openutils/mgnlgroovy/pages/GroovyShellScript.java
===================================================================
--- magnoliamodules/trunk/openutils-mgnlgroovy/src/main/java/net/sourceforge/openutils/mgnlgroovy/pages/GroovyShellScript.java 2012-05-06 16:35:53 UTC (rev 4001)
+++ magnoliamodules/trunk/openutils-mgnlgroovy/src/main/java/net/sourceforge/openutils/mgnlgroovy/pages/GroovyShellScript.java 2012-05-06 16:58:51 UTC (rev 4002)
@@ -45,8 +45,7 @@
/**
- * A basic Groovy shell to be embedded in Magnolia.
- * @author fgrilli
+ * @author Manuel Molaschi
* @version $Id$
*/
public class GroovyShellScript extends TemplatedMVCHandler
Modified: magnoliamodules/trunk/openutils-mgnlgroovy/src/main/java/net/sourceforge/openutils/mgnlgroovy/setup/GroovyShellModuleVersionHandler.java
===================================================================
--- magnoliamodules/trunk/openutils-mgnlgroovy/src/main/java/net/sourceforge/openutils/mgnlgroovy/setup/GroovyShellModuleVersionHandler.java 2012-05-06 16:35:53 UTC (rev 4001)
+++ magnoliamodules/trunk/openutils-mgnlgroovy/src/main/java/net/sourceforge/openutils/mgnlgroovy/setup/GroovyShellModuleVersionHandler.java 2012-05-06 16:58:51 UTC (rev 4002)
@@ -19,14 +19,31 @@
package net.sourceforge.openutils.mgnlgroovy.setup;
+import info.magnolia.module.InstallContext;
+import info.magnolia.module.delta.Task;
+import it.openutils.mgnltasks.DeleteNodeTask;
import it.openutils.mgnltasks.SimpleModuleVersionHandler;
+import java.util.ArrayList;
+import java.util.List;
+
/**
- * @author fgrilli
- * @version $Id: GroovyShellModuleVersionHandler.java 5308 2008-10-31 14:59:23Z federico.grilli $
+ * @author fgiust
+ * @version $Id: $
*/
public class GroovyShellModuleVersionHandler extends SimpleModuleVersionHandler
{
+ @Override
+ public List<Task> getStartupTasks(InstallContext installContext)
+ {
+
+ List<Task> tasks = new ArrayList<Task>();
+
+ tasks.add(new DeleteNodeTask("config", "/modules/adminIterface/config/menu/tools/groovyShell"));
+ tasks.add(new DeleteNodeTask("config", "/modules/groovyshell/pages/groovyShell"));
+
+ return tasks;
+ }
}
Deleted: magnoliamodules/trunk/openutils-mgnlgroovy/src/main/resources/mgnl-bootstrap/groovyshell/config.modules.adminInterface.config.menu.tools.groovyShell.xml
===================================================================
--- magnoliamodules/trunk/openutils-mgnlgroovy/src/main/resources/mgnl-bootstrap/groovyshell/config.modules.adminInterface.config.menu.tools.groovyShell.xml 2012-05-06 16:35:53 UTC (rev 4001)
+++ magnoliamodules/trunk/openutils-mgnlgroovy/src/main/resources/mgnl-bootstrap/groovyshell/config.modules.adminInterface.config.menu.tools.groovyShell.xml 2012-05-06 16:58:51 UTC (rev 4002)
@@ -1,50 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<sv:node sv:name="groovyShell" xmlns:sv="http://www.jcp.org/jcr/sv/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <sv:property sv:name="jcr:primaryType" sv:type="Name">
- <sv:value>mgnl:contentNode</sv:value>
- </sv:property>
- <sv:property sv:name="jcr:uuid" sv:type="String">
- <sv:value>15ee1ea1-90f6-4555-9473-2e02c52a4016</sv:value>
- </sv:property>
- <sv:property sv:name="icon" sv:type="String">
- <sv:value>/.resources/groovyshell/icons/groovy-small.png</sv:value>
- </sv:property>
- <sv:property sv:name="jcr:createdBy" sv:type="String">
- <sv:value>admin</sv:value>
- </sv:property>
- <sv:property sv:name="label" sv:type="String">
- <sv:value>Groovy Shell</sv:value>
- </sv:property>
- <sv:property sv:name="onclick" sv:type="String">
- <sv:value>window.open('/.magnolia/pages/groovyShell.html');</sv:value>
- </sv:property>
- <sv:node sv:name="MetaData">
- <sv:property sv:name="jcr:primaryType" sv:type="Name">
- <sv:value>mgnl:metaData</sv:value>
- </sv:property>
- <sv:property sv:name="jcr:createdBy" sv:type="String">
- <sv:value>admin</sv:value>
- </sv:property>
- <sv:property sv:name="mgnl:Data" sv:type="String">
- <sv:value>MetaData</sv:value>
- </sv:property>
- <sv:property sv:name="mgnl:activated" sv:type="Boolean">
- <sv:value>false</sv:value>
- </sv:property>
- <sv:property sv:name="mgnl:activatorid" sv:type="String">
- <sv:value>superuser</sv:value>
- </sv:property>
- <sv:property sv:name="mgnl:authorid" sv:type="String">
- <sv:value>superuser</sv:value>
- </sv:property>
- <sv:property sv:name="mgnl:creationdate" sv:type="Date">
- <sv:value>2005-05-16T20:46:43.549+02:00</sv:value>
- </sv:property>
- <sv:property sv:name="mgnl:lastaction" sv:type="Date">
- <sv:value>2006-05-04T12:02:10.817+02:00</sv:value>
- </sv:property>
- <sv:property sv:name="mgnl:lastmodified" sv:type="Date">
- <sv:value>2012-02-17T17:53:37.468+01:00</sv:value>
- </sv:property>
- </sv:node>
-</sv:node>
Copied: magnoliamodules/trunk/openutils-mgnlgroovy/src/main/resources/mgnl-bootstrap/groovyshell/config.modules.adminInterface.config.menu.tools.groovyShellScript.xml (from rev 3991, magnoliamodules/branches/magnolia44/openutils-mgnlgroovy/src/main/resources/mgnl-bootstrap/groovyshell/config.modules.adminInterface.config.menu.tools.groovyShellScript.xml)
===================================================================
--- magnoliamodules/trunk/openutils-mgnlgroovy/src/main/resources/mgnl-bootstrap/groovyshell/config.modules.adminInterface.config.menu.tools.groovyShellScript.xml (rev 0)
+++ magnoliamodules/trunk/openutils-mgnlgroovy/src/main/resources/mgnl-bootstrap/groovyshell/config.modules.adminInterface.config.menu.tools.groovyShellScript.xml 2012-05-06 16:58:51 UTC (rev 4002)
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<sv:node sv:name="groovyShellScript" xmlns:sv="http://www.jcp.org/jcr/sv/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <sv:property sv:name="jcr:primaryType" sv:type="Name">
+ <sv:value>mgnl:contentNode</sv:value>
+ </sv:property>
+ <sv:property sv:name="jcr:uuid" sv:type="String">
+ <sv:value>15ee1ea1-90f6-4555-9473-2e02c52a4017</sv:value>
+ </sv:property>
+ <sv:property sv:name="icon" sv:type="String">
+ <sv:value>/.resources/groovyshell/icons/groovy-small.png</sv:value>
+ </sv:property>
+ <sv:property sv:name="jcr:createdBy" sv:type="String">
+ <sv:value>admin</sv:value>
+ </sv:property>
+ <sv:property sv:name="label" sv:type="String">
+ <sv:value>Groovy Shell</sv:value>
+ </sv:property>
+ <sv:property sv:name="onclick" sv:type="String">
+ <sv:value>window.open(contextPath + '/.magnolia/pages/groovyShellScript.html');</sv:value>
+ </sv:property>
+ <sv:node sv:name="MetaData">
+ <sv:property sv:name="jcr:primaryType" sv:type="Name">
+ <sv:value>mgnl:metaData</sv:value>
+ </sv:property>
+ <sv:property sv:name="jcr:createdBy" sv:type="String">
+ <sv:value>admin</sv:value>
+ </sv:property>
+ <sv:property sv:name="mgnl:Data" sv:type="String">
+ <sv:value>MetaData</sv:value>
+ </sv:property>
+ <sv:property sv:name="mgnl:activated" sv:type="Boolean">
+ <sv:value>false</sv:value>
+ </sv:property>
+ <sv:property sv:name="mgnl:activatorid" sv:type="String">
+ <sv:value>superuser</sv:value>
+ </sv:property>
+ <sv:property sv:name="mgnl:authorid" sv:type="String">
+ <sv:value>superuser</sv:value>
+ </sv:property>
+ <sv:property sv:name="mgnl:creationdate" sv:type="Date">
+ <sv:value>2005-05-16T20:46:43.549+02:00</sv:value>
+ </sv:property>
+ <sv:property sv:name="mgnl:lastaction" sv:type="Date">
+ <sv:value>2006-05-04T12:02:10.817+02:00</sv:value>
+ </sv:property>
+ <sv:property sv:name="mgnl:lastmodified" sv:type="Date">
+ <sv:value>2012-02-17T17:53:37.468+01:00</sv:value>
+ </sv:property>
+ </sv:node>
+</sv:node>
\ No newline at end of file
Deleted: magnoliamodules/trunk/openutils-mgnlgroovy/src/main/resources/mgnl-bootstrap/groovyshell/config.modules.groovyshell.pages.groovyShell.xml
===================================================================
--- magnoliamodules/trunk/openutils-mgnlgroovy/src/main/resources/mgnl-bootstrap/groovyshell/config.modules.groovyshell.pages.groovyShell.xml 2012-05-06 16:35:53 UTC (rev 4001)
+++ magnoliamodules/trunk/openutils-mgnlgroovy/src/main/resources/mgnl-bootstrap/groovyshell/config.modules.groovyshell.pages.groovyShell.xml 2012-05-06 16:58:51 UTC (rev 4002)
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<sv:node sv:name="groovyShell" xmlns:sv="http://www.jcp.org/jcr/sv/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <sv:property sv:name="jcr:primaryType" sv:type="Name">
- <sv:value>mgnl:contentNode</sv:value>
- </sv:property>
- <sv:property sv:name="jcr:uuid" sv:type="String">
- <sv:value>3eb70ebe-824c-4eeb-9595-494d39d20bdc</sv:value>
- </sv:property>
- <sv:property sv:name="class" sv:type="String">
- <sv:value>net.sourceforge.openutils.mgnlgroovy.pages.GroovyShellPage</sv:value>
- </sv:property>
- <sv:node sv:name="MetaData">
- <sv:property sv:name="jcr:primaryType" sv:type="Name">
- <sv:value>mgnl:metaData</sv:value>
- </sv:property>
- <sv:property sv:name="mgnl:activated" sv:type="Boolean">
- <sv:value>false</sv:value>
- </sv:property>
- <sv:property sv:name="mgnl:activatorid" sv:type="String">
- <sv:value>superuser</sv:value>
- </sv:property>
- <sv:property sv:name="mgnl:authorid" sv:type="String">
- <sv:value>admin</sv:value>
- </sv:property>
- <sv:property sv:name="mgnl:creationdate" sv:type="Date">
- <sv:value>2006-06-10T17:40:37.578+02:00</sv:value>
- </sv:property>
- <sv:property sv:name="mgnl:lastaction" sv:type="Date">
- <sv:value>2006-07-11T21:37:16.259+02:00</sv:value>
- </sv:property>
- <sv:property sv:name="mgnl:lastmodified" sv:type="Date">
- <sv:value>2008-10-30T14:22:28.193+01:00</sv:value>
- </sv:property>
- </sv:node>
-</sv:node>
Modified: magnoliamodules/trunk/openutils-mgnlgroovy/src/main/resources/mgnl-resources/groovyshell/icons/groovy-small.png
===================================================================
(Binary files differ)
Deleted: magnoliamodules/trunk/openutils-mgnlgroovy/src/main/resources/net/sourceforge/openutils/mgnlgroovy/pages/GroovyShellPage.html.bk
===================================================================
--- magnoliamodules/trunk/openutils-mgnlgroovy/src/main/resources/net/sourceforge/openutils/mgnlgroovy/pages/GroovyShellPage.html.bk 2012-05-06 16:35:53 UTC (rev 4001)
+++ magnoliamodules/trunk/openutils-mgnlgroovy/src/main/resources/net/sourceforge/openutils/mgnlgroovy/pages/GroovyShellPage.html.bk 2012-05-06 16:58:51 UTC (rev 4002)
@@ -1,90 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html>
- <head>
- <title>Groovy Shell Page</title>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <link href="${this.request.contextPath}/.resources/groovyshell/css/mgnladmin.css" type="text/css" rel="stylesheet" />
- <link href="${this.request.contextPath}/.resources/groovyshell/css/styles.css" type="text/css" rel="stylesheet" />
- <script src="${this.request.contextPath}/.resources/groovyshell/js/codemirror/codemirror.js" type="text/javascript"></script>
- <script type="text/javascript">
- // <![[
- function uploadFile(){
- document.getElementById('command').value='loadGroovyScript'
- document.forms[0].submit()
- }
- function warnBeforeSubmit(){
- if(confirm('Are you sure you want to run this script?')){
- document.getElementById('groovyScript').value = editor.getCode()
- document.getElementById('runBtn').disabled=true
- document.forms[0].submit()
- }
- else
- return false
- }
-
-
- // ]]>
- </script>
- </head>
- <body class="ma">
- <div class="ma-frame">
- <form method="post" action="" enctype="multipart/form-data">
- <h2>
- Groovy Shell
- <a target="_blank" href="http://www.openmindonline.it" style="position:absolute;right:45px;">
- <img class="omlogo" alt="openmind" src="${this.request.contextPath}/.resources/groovyshell/img/openmind-logo.png" />
- </a>
- </h2>
- <div class="ma-framecenter">
- <div class="ma-warning">
- <strong>Warning</strong>
- : the Groovy Shell potentially makes at your disposal the entire Magnolia API. If not used properly and
- judiciously, this means that
- <strong>you could make permanent damages to your repository</strong>
- , such as delete all your data.
- <strong>Use it at your own risk.</strong>
- </div>
- <div class="ma-formel-container">
- <div class="ma-formel-left">
- <label for="groovyScriptFile">Upload groovy script</label>
- </div>
- <div class="ma-formel-right">
- <input type="file" name="groovyScriptFile" />
- <input type="submit" value="Upload" onclick="uploadFile()" class="mgnlControlButton" />
- </div>
- </div>
- <div class="ma-formel-container">
- <div class="ma-formel-right" id="textarecontainer">
- <textarea id="groovyScriptTxtArea" name="groovyScriptTxtArea" rows="30" cols="120" style="width:100%"
- class="codepress groovy readonly-off">${this.groovyScript!''}</textarea>
- <input type="hidden" name="groovyScript" id="groovyScript" value="" />
- </div>
- </div>
- <input type="hidden" id="command" name="command" value="executeGroovyScript" />
- [#if message?exists]
- <pre class="ma-info">${message}</pre>
- [/#if]
- </div>
- <div class="ma-framefooter">
- <div class="ma-framefooterinner">
- <div class="ma-buttons">
- <input type="submit" id="runBtn" value="Run" onclick="warnBeforeSubmit(); return false" class="mgnlControlButton" />
- </div>
- </div>
- </div>
- </form>
- </div>
- <script type="text/javascript">
- // <![CDATA[
- var editor = CodeMirror.fromTextArea('groovyScriptTxtArea', {
- height: "dynamic",
- minHeight: 405,
- basefiles: ["${this.request.contextPath}/.resources/groovyshell/js/codemirror/codemirror_groovy.js"],
- stylesheet: "${this.request.contextPath}/.resources/groovyshell/js/codemirror/groovycolors.css",
- textWrapping: false,
- lineNumbers: true
- });
- // ]]>
-</script>
- </body>
-</html>
\ No newline at end of file
Modified: magnoliamodules/trunk/openutils-mgnlgroovy/src/main/resources/net/sourceforge/openutils/mgnlgroovy/pages/GroovyShellScript.html
===================================================================
--- magnoliamodules/trunk/openutils-mgnlgroovy/src/main/resources/net/sourceforge/openutils/mgnlgroovy/pages/GroovyShellScript.html 2012-05-06 16:35:53 UTC (rev 4001)
+++ magnoliamodules/trunk/openutils-mgnlgroovy/src/main/resources/net/sourceforge/openutils/mgnlgroovy/pages/GroovyShellScript.html 2012-05-06 16:58:51 UTC (rev 4002)
@@ -41,9 +41,9 @@
Cannot execute action, the script is empty.
</p>
</div>
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"><!-- --></script>
- <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js" type="text/javascript"><!-- --></script>
- <script src="http://layout.jquery-dev.net/lib/js/jquery.layout-latest.js" type="text/javascript"><!-- --></script>
+ <script src="${this.request.contextPath}/.resources/groovyshell/js/jquery/jquery.min.js" type="text/javascript"><!-- --></script>
+ <script src="${this.request.contextPath}/.resources/groovyshell/js/jquery/jquery-ui.min.js" type="text/javascript"><!-- --></script>
+ <script src="${this.request.contextPath}/.resources/groovyshell/js/jquery/jquery.layout-latest.js" type="text/javascript"><!-- --></script>
<script src="${this.request.contextPath}/.resources/groovyshell/js/ace/ace.js" type="text/javascript"><!-- --></script>
<script src="${this.request.contextPath}/.resources/groovyshell/js/ace/mode-groovy.js" type="text/javascript" charset="utf-8"><!-- --></script>
<script src="${this.request.contextPath}/.resources/groovyshell/js/ace/theme-eclipse.js" type="text/javascript" charset="utf-8"><!-- --></script>
Property changes on: magnoliamodules/trunk/openutils-mgnlmedia
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/openutils-mgnlmedia-3.6.x:1004
/magnoliamodules/branches/magnolia44/openutils-mgnlmedia:3809-3812,3815-3892,3952-3958
+ /branches/openutils-mgnlmedia-3.6.x:1004
/magnoliamodules/branches/magnolia44/openutils-mgnlmedia:3809-3812,3815-3892,3952-3958,3972-3975,3996
Modified: magnoliamodules/trunk/openutils-mgn...
[truncated message content] |