You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bridges-commits@portals.apache.org by wo...@apache.org on 2010/04/22 18:44:42 UTC

svn commit: r936949 [2/2] - in /portals/bridges/bridges-script/trunk: ./ dependencies/ dependencies/beanshell/ dependencies/groovy/ dependencies/jruby/ dependencies/jython/ dependencies/rhino/ portlet/ portlet/src/ portlet/src/main/ portlet/src/main/ja...

Added: portals/bridges/bridges-script/trunk/portlet/src/test/java/org/apache/portals/bridges/script/TestHelloRhinoScriptPortlet.java
URL: http://svn.apache.org/viewvc/portals/bridges/bridges-script/trunk/portlet/src/test/java/org/apache/portals/bridges/script/TestHelloRhinoScriptPortlet.java?rev=936949&view=auto
==============================================================================
--- portals/bridges/bridges-script/trunk/portlet/src/test/java/org/apache/portals/bridges/script/TestHelloRhinoScriptPortlet.java (added)
+++ portals/bridges/bridges-script/trunk/portlet/src/test/java/org/apache/portals/bridges/script/TestHelloRhinoScriptPortlet.java Thu Apr 22 16:44:40 2010
@@ -0,0 +1,114 @@
+/*
+ * 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.portals.bridges.script;
+
+import java.util.HashMap;
+import java.util.ListResourceBundle;
+import java.util.Map;
+import java.util.ResourceBundle;
+
+import org.apache.commons.lang.SystemUtils;
+
+/**
+ * TestHelloRhinoScriptPortlet
+ * 
+ * @author <a href="mailto:woonsan@apache.org">Woonsan Ko</a>
+ * @version $Id$
+ */
+public class TestHelloRhinoScriptPortlet extends AbstractSimpleScriptPortletTestCase
+{
+    @Override
+    public void setUp() throws Exception
+    {
+        if (SystemUtils.isJavaVersionAtLeast(160))
+        {
+            System.out.println("[WARNING] Rhino script engine embedded in the default Java 1.6+ has not fully tested yet.");
+            return;
+        }
+        
+        super.setUp();
+    }
+    
+    @Override
+    protected Map<String, String> getPortletInitParameters()
+    {
+        Map<String, String> initParams = new HashMap<String, String>();
+        initParams.put(ScriptPortlet.ENGINE, "rhino");
+        initParams.put(ScriptPortlet.SOURCE, "classpath:org/apache/portals/bridges/script/HelloRhino.js");
+        initParams.put(ScriptPortlet.VALIDATOR, "classpath:org/apache/portals/bridges/script/HelloRhinoPrefsValidator.js");
+        initParams.put(ScriptPortlet.AUTO_REFRESH, "true");
+        return initParams;
+    }
+    
+    @Override
+    protected ResourceBundle getPortletResourceBundle()
+    {
+        return new ListResourceBundle()
+        {
+            protected Object[][] getContents() 
+            {
+                return new Object[][] {
+                    {"javax.portlet.title", "Hello Rhino Portlet"},
+                    {"javax.portlet.short-title", "Hello Rhino"},
+                    {"javax.portlet.keywords", "hello,rhino,js"}
+                };
+            }
+        };
+    }
+
+    @Override
+    protected String getScriptMimeType()
+    {
+        return "application/x-javascript";
+    }
+    
+    @Override
+    public void testInit() throws Exception
+    {
+        if (SystemUtils.isJavaVersionAtLeast(160))
+        {
+            System.out.println("[WARNING] Rhino script engine embedded in the default Java 1.6+ has not fully tested yet.");
+            return;
+        }
+        
+        super.testInit();
+    }
+    
+    @Override
+    public void testRender() throws Exception
+    {
+        if (SystemUtils.isJavaVersionAtLeast(160))
+        {
+            System.out.println("[WARNING] Rhino script engine embedded in the default Java 1.6+ has not fully tested yet.");
+            return;
+        }
+        
+        super.testRender();
+    }
+    
+    @Override
+    public void testProcessAction() throws Exception
+    {
+        if (SystemUtils.isJavaVersionAtLeast(160))
+        {
+            System.out.println("[WARNING] Rhino script engine embedded in the default Java 1.6+ has not fully tested yet.");
+            return;
+        }
+        
+        super.testProcessAction();
+    }
+}

Propchange: portals/bridges/bridges-script/trunk/portlet/src/test/java/org/apache/portals/bridges/script/TestHelloRhinoScriptPortlet.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: portals/bridges/bridges-script/trunk/portlet/src/test/java/org/apache/portals/bridges/script/TestHelloRhinoScriptPortlet.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: portals/bridges/bridges-script/trunk/portlet/src/test/resources/org/apache/portals/bridges/script/HelloBeanShell.bsh
URL: http://svn.apache.org/viewvc/portals/bridges/bridges-script/trunk/portlet/src/test/resources/org/apache/portals/bridges/script/HelloBeanShell.bsh?rev=936949&view=auto
==============================================================================
--- portals/bridges/bridges-script/trunk/portlet/src/test/resources/org/apache/portals/bridges/script/HelloBeanShell.bsh (added)
+++ portals/bridges/bridges-script/trunk/portlet/src/test/resources/org/apache/portals/bridges/script/HelloBeanShell.bsh Thu Apr 22 16:44:40 2010
@@ -0,0 +1,44 @@
+/*
+ * 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.
+ */
+import javax.portlet.GenericPortlet;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+
+/**
+ * @author <a href="mailto:woonsan@apache.org">Woonsan Ko</a>
+ * @version $Id$
+ */
+class HelloBeanShell extends GenericPortlet
+{
+    public void doView(RenderRequest request, RenderResponse response)
+    {
+        String greeting = "<H1>" + getTitle(request) + "</H1>";
+        response.getWriter().println(greeting);
+    }
+    
+    public void processAction(ActionRequest request, ActionResponse response)
+    {
+        request.getPreferences().setValue("message", request.getParameter("message"));
+        request.getPreferences().store();
+    }
+}
+
+// Return portlet instance as a last evaluated object
+// because ScriptPortlet expects the evaluated result object as a portlet class or non-initialized portlet instance.
+new HelloBeanShell();

Added: portals/bridges/bridges-script/trunk/portlet/src/test/resources/org/apache/portals/bridges/script/HelloBeanShellPrefsValidator.bsh
URL: http://svn.apache.org/viewvc/portals/bridges/bridges-script/trunk/portlet/src/test/resources/org/apache/portals/bridges/script/HelloBeanShellPrefsValidator.bsh?rev=936949&view=auto
==============================================================================
--- portals/bridges/bridges-script/trunk/portlet/src/test/resources/org/apache/portals/bridges/script/HelloBeanShellPrefsValidator.bsh (added)
+++ portals/bridges/bridges-script/trunk/portlet/src/test/resources/org/apache/portals/bridges/script/HelloBeanShellPrefsValidator.bsh Thu Apr 22 16:44:40 2010
@@ -0,0 +1,42 @@
+/*
+ * 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.
+ */
+import javax.portlet.PortletPreferences;
+import javax.portlet.PreferencesValidator;
+import javax.portlet.ValidatorException;
+
+/**
+ * @author <a href="mailto:woonsan@apache.org">Woonsan Ko</a>
+ * @version $Id$
+ */
+class HelloBeanShellPrefsValidator implements PreferencesValidator
+{
+    public void validate(PortletPreferences preferences)
+    {
+        String message = preferences.getValue("message", null);
+        
+        if (message == null)
+        {
+            // no idea on how to throw exception in beanshell
+            // just cause an intended exception here...
+            invalid_message = null;
+            invalid_message.length();
+        }
+    }
+}
+
+// Return validator instance as a last evaluated object
+new HelloBeanShellPrefsValidator();

Added: portals/bridges/bridges-script/trunk/portlet/src/test/resources/org/apache/portals/bridges/script/HelloGroovy.groovy
URL: http://svn.apache.org/viewvc/portals/bridges/bridges-script/trunk/portlet/src/test/resources/org/apache/portals/bridges/script/HelloGroovy.groovy?rev=936949&view=auto
==============================================================================
--- portals/bridges/bridges-script/trunk/portlet/src/test/resources/org/apache/portals/bridges/script/HelloGroovy.groovy (added)
+++ portals/bridges/bridges-script/trunk/portlet/src/test/resources/org/apache/portals/bridges/script/HelloGroovy.groovy Thu Apr 22 16:44:40 2010
@@ -0,0 +1,46 @@
+/*
+ * 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.portals.bridges.script;
+
+import javax.portlet.GenericPortlet;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+
+/**
+ * @author <a href="mailto:woonsan@apache.org">Woonsan Ko</a>
+ * @version $Id$
+ */
+public class HelloGroovy extends GenericPortlet
+{
+    public void doView(RenderRequest request, RenderResponse response)
+    {
+        String greeting = "<H1>" + getTitle(request) + "</H1>";
+        response.getWriter().println(greeting);
+    }
+    
+    public void processAction(ActionRequest request, ActionResponse response)
+    {
+        request.getPreferences().setValue("message", request.getParameter("message"));
+        request.getPreferences().store();
+    }
+}
+
+// Return portlet instance as a last evaluated object
+// because ScriptPortlet expects the evaluated result object as a portlet class or non-initialized portlet instance.
+new HelloGroovy();

Added: portals/bridges/bridges-script/trunk/portlet/src/test/resources/org/apache/portals/bridges/script/HelloGroovyPrefsValidator.groovy
URL: http://svn.apache.org/viewvc/portals/bridges/bridges-script/trunk/portlet/src/test/resources/org/apache/portals/bridges/script/HelloGroovyPrefsValidator.groovy?rev=936949&view=auto
==============================================================================
--- portals/bridges/bridges-script/trunk/portlet/src/test/resources/org/apache/portals/bridges/script/HelloGroovyPrefsValidator.groovy (added)
+++ portals/bridges/bridges-script/trunk/portlet/src/test/resources/org/apache/portals/bridges/script/HelloGroovyPrefsValidator.groovy Thu Apr 22 16:44:40 2010
@@ -0,0 +1,41 @@
+/*
+ * 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.portals.bridges.script;
+
+import javax.portlet.PortletPreferences;
+import javax.portlet.PreferencesValidator;
+import javax.portlet.ValidatorException;
+
+/**
+ * @author <a href="mailto:woonsan@apache.org">Woonsan Ko</a>
+ * @version $Id$
+ */
+public class HelloGroovyPrefsValidator implements PreferencesValidator
+{
+    public void validate(PortletPreferences preferences)
+    {
+        String message = preferences.getValue("message", null);
+        
+        if (message == null)
+        {
+            throw new ValidatorException("Invalid message", null);
+        }
+    }
+}
+
+// Return validator instance as a last evaluated object
+new HelloGroovyPrefsValidator();

Added: portals/bridges/bridges-script/trunk/portlet/src/test/resources/org/apache/portals/bridges/script/HelloJRuby.rb
URL: http://svn.apache.org/viewvc/portals/bridges/bridges-script/trunk/portlet/src/test/resources/org/apache/portals/bridges/script/HelloJRuby.rb?rev=936949&view=auto
==============================================================================
--- portals/bridges/bridges-script/trunk/portlet/src/test/resources/org/apache/portals/bridges/script/HelloJRuby.rb (added)
+++ portals/bridges/bridges-script/trunk/portlet/src/test/resources/org/apache/portals/bridges/script/HelloJRuby.rb Thu Apr 22 16:44:40 2010
@@ -0,0 +1,40 @@
+#
+# 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.
+#
+
+require 'java'
+
+#
+# @author <a href="mailto:woonsan@apache.org">Woonsan Ko</a>
+# @version $Id$
+#
+class HelloJRuby < javax.portlet.GenericPortlet
+    
+    def doView(request, response)
+        greeting = "<H1>" + getTitle(request) + "</H1>"
+        response.writer.println(greeting)
+    end
+    
+    def processAction(request, response)
+        request.preferences.setValue("message", request.getParameter("message"))
+        request.preferences.store()
+    end
+    
+end
+
+# Return portlet instance as a last evaluated object
+# because ScriptPortlet expects the evaluated result object as a portlet class or non-initialized portlet instance.
+HelloJRuby.new

Propchange: portals/bridges/bridges-script/trunk/portlet/src/test/resources/org/apache/portals/bridges/script/HelloJRuby.rb
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: portals/bridges/bridges-script/trunk/portlet/src/test/resources/org/apache/portals/bridges/script/HelloJRuby.rb
------------------------------------------------------------------------------
    svn:keywords = Id

Added: portals/bridges/bridges-script/trunk/portlet/src/test/resources/org/apache/portals/bridges/script/HelloJRubyPrefsValidator.rb
URL: http://svn.apache.org/viewvc/portals/bridges/bridges-script/trunk/portlet/src/test/resources/org/apache/portals/bridges/script/HelloJRubyPrefsValidator.rb?rev=936949&view=auto
==============================================================================
--- portals/bridges/bridges-script/trunk/portlet/src/test/resources/org/apache/portals/bridges/script/HelloJRubyPrefsValidator.rb (added)
+++ portals/bridges/bridges-script/trunk/portlet/src/test/resources/org/apache/portals/bridges/script/HelloJRubyPrefsValidator.rb Thu Apr 22 16:44:40 2010
@@ -0,0 +1,38 @@
+#
+# 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.
+#
+
+require 'java'
+
+#
+# @author <a href="mailto:woonsan@apache.org">Woonsan Ko</a>
+# @version $Id$
+#
+class HelloJRubyPrefsValidator
+    include javax.portlet.PreferencesValidator
+    
+    def validate(preferences)
+        message = preferences.getValue("message", "")
+        
+        if !message
+            throw new ValidatorException("Invalid message", null)
+        end
+    end
+    
+end
+
+# Return validator instance as a last evaluated object
+HelloJRubyPrefsValidator.new

Propchange: portals/bridges/bridges-script/trunk/portlet/src/test/resources/org/apache/portals/bridges/script/HelloJRubyPrefsValidator.rb
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: portals/bridges/bridges-script/trunk/portlet/src/test/resources/org/apache/portals/bridges/script/HelloJRubyPrefsValidator.rb
------------------------------------------------------------------------------
    svn:keywords = Id

Added: portals/bridges/bridges-script/trunk/portlet/src/test/resources/org/apache/portals/bridges/script/HelloJython.py
URL: http://svn.apache.org/viewvc/portals/bridges/bridges-script/trunk/portlet/src/test/resources/org/apache/portals/bridges/script/HelloJython.py?rev=936949&view=auto
==============================================================================
--- portals/bridges/bridges-script/trunk/portlet/src/test/resources/org/apache/portals/bridges/script/HelloJython.py (added)
+++ portals/bridges/bridges-script/trunk/portlet/src/test/resources/org/apache/portals/bridges/script/HelloJython.py Thu Apr 22 16:44:40 2010
@@ -0,0 +1,37 @@
+#
+# 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.
+#
+
+from javax.portlet import GenericPortlet
+
+#
+# @author <a href="mailto:woonsan@apache.org">Woonsan Ko</a>
+# @version $Id$
+#
+class HelloJython(GenericPortlet):
+    def doView(self, request, response):
+        greeting = "<H1>" + self.getTitle(request) + "</H1>"
+        response.writer.println(greeting)
+        
+    def processAction(self, request, response):
+        request.preferences.setValue("message", request.getParameter("message"))
+        request.preferences.store();
+        
+    
+
+# Return portlet instance as a last evaluated object
+# because ScriptPortlet expects the evaluated result object as a portlet class or non-initialized portlet instance.
+value = HelloJython()

Propchange: portals/bridges/bridges-script/trunk/portlet/src/test/resources/org/apache/portals/bridges/script/HelloJython.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: portals/bridges/bridges-script/trunk/portlet/src/test/resources/org/apache/portals/bridges/script/HelloJython.py
------------------------------------------------------------------------------
    svn:keywords = Id

Added: portals/bridges/bridges-script/trunk/portlet/src/test/resources/org/apache/portals/bridges/script/HelloJythonPrefsValidator.py
URL: http://svn.apache.org/viewvc/portals/bridges/bridges-script/trunk/portlet/src/test/resources/org/apache/portals/bridges/script/HelloJythonPrefsValidator.py?rev=936949&view=auto
==============================================================================
--- portals/bridges/bridges-script/trunk/portlet/src/test/resources/org/apache/portals/bridges/script/HelloJythonPrefsValidator.py (added)
+++ portals/bridges/bridges-script/trunk/portlet/src/test/resources/org/apache/portals/bridges/script/HelloJythonPrefsValidator.py Thu Apr 22 16:44:40 2010
@@ -0,0 +1,34 @@
+#
+# 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.
+#
+
+from javax.portlet import PreferencesValidator
+
+#
+# @author <a href="mailto:woonsan@apache.org">Woonsan Ko</a>
+# @version $Id$
+#
+class HelloJythonPrefsValidator(PreferencesValidator):
+    def validate(self, preferences):
+        message = preferences.getValue("message", "")
+        
+        if not message:
+            raise ValidatorException("Invalid message", null)
+        
+    
+
+# Return validator instance as a last evaluated object
+value = HelloJythonPrefsValidator()

Propchange: portals/bridges/bridges-script/trunk/portlet/src/test/resources/org/apache/portals/bridges/script/HelloJythonPrefsValidator.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: portals/bridges/bridges-script/trunk/portlet/src/test/resources/org/apache/portals/bridges/script/HelloJythonPrefsValidator.py
------------------------------------------------------------------------------
    svn:keywords = Id

Added: portals/bridges/bridges-script/trunk/portlet/src/test/resources/org/apache/portals/bridges/script/HelloRhino.js
URL: http://svn.apache.org/viewvc/portals/bridges/bridges-script/trunk/portlet/src/test/resources/org/apache/portals/bridges/script/HelloRhino.js?rev=936949&view=auto
==============================================================================
--- portals/bridges/bridges-script/trunk/portlet/src/test/resources/org/apache/portals/bridges/script/HelloRhino.js (added)
+++ portals/bridges/bridges-script/trunk/portlet/src/test/resources/org/apache/portals/bridges/script/HelloRhino.js Thu Apr 22 16:44:40 2010
@@ -0,0 +1,38 @@
+/*
+ * 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.
+ */
+ 
+importPackage(Packages.javax.portlet);
+
+/**
+ * @author <a href="mailto:woonsan@apache.org">Woonsan Ko</a>
+ * @version $Id$
+ */
+
+// Return portlet instance as a last evaluated object
+// because ScriptPortlet expects the evaluated result object as a portlet class or non-initialized portlet instance.
+new GenericPortlet(
+    {
+        doView: function(request, response) {
+            greeting = "<H1>Hello Rhino Portlet</H1>";
+            response.getWriter().println(greeting);
+        },
+        processAction: function(request, response) {
+            request.getPreferences().setValue("message", request.getParameter("message"));
+            request.getPreferences().store();
+        }
+    }
+);

Propchange: portals/bridges/bridges-script/trunk/portlet/src/test/resources/org/apache/portals/bridges/script/HelloRhino.js
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: portals/bridges/bridges-script/trunk/portlet/src/test/resources/org/apache/portals/bridges/script/HelloRhino.js
------------------------------------------------------------------------------
    svn:keywords = Id

Added: portals/bridges/bridges-script/trunk/portlet/src/test/resources/org/apache/portals/bridges/script/HelloRhinoPrefsValidator.js
URL: http://svn.apache.org/viewvc/portals/bridges/bridges-script/trunk/portlet/src/test/resources/org/apache/portals/bridges/script/HelloRhinoPrefsValidator.js?rev=936949&view=auto
==============================================================================
--- portals/bridges/bridges-script/trunk/portlet/src/test/resources/org/apache/portals/bridges/script/HelloRhinoPrefsValidator.js (added)
+++ portals/bridges/bridges-script/trunk/portlet/src/test/resources/org/apache/portals/bridges/script/HelloRhinoPrefsValidator.js Thu Apr 22 16:44:40 2010
@@ -0,0 +1,38 @@
+/*
+ * 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.
+ */
+ 
+importPackage(Packages.javax.portlet);
+
+/**
+ * @author <a href="mailto:woonsan@apache.org">Woonsan Ko</a>
+ * @version $Id$
+ */
+
+// Return portlet instance as a last evaluated object
+// because ScriptPortlet expects the evaluated result object as a portlet class or non-initialized portlet instance.
+new PreferencesValidator(
+    {
+        validate: function(preferences) {
+            message = preferences.getValue("message", "");
+            
+            if (!message)
+            {
+                throw new ValidatorException("Invalid message", null);
+            }
+        }
+    }
+);

Propchange: portals/bridges/bridges-script/trunk/portlet/src/test/resources/org/apache/portals/bridges/script/HelloRhinoPrefsValidator.js
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: portals/bridges/bridges-script/trunk/portlet/src/test/resources/org/apache/portals/bridges/script/HelloRhinoPrefsValidator.js
------------------------------------------------------------------------------
    svn:keywords = Id



---------------------------------------------------------------------
To unsubscribe, e-mail: bridges-commits-unsubscribe@portals.apache.org
For additional commands, e-mail: bridges-commits-help@portals.apache.org