1 package org.exoplatform.container.groovy.test; 2 3 import java.net.URL ; 4 import org.exoplatform.container.RootContainer; 5 import org.exoplatform.container.groovy.* ; 6 import org.exoplatform.test.BasicTestCase; 7 12 public class TestGroovyContainerManager extends BasicTestCase { 13 14 public void testGroovyContainerManager() throws Exception { 15 RootContainer container = RootContainer.getInstance() ; 16 GroovyManagerContainer gcontainer = 17 (GroovyManagerContainer)container.getComponentInstanceOfType(GroovyManagerContainer.class) ; 18 URL classpath = new URL ("file:" + container.getServerEnvironment().getServerHome() + 19 "/web/portal/src/webapp/WEB-INF/groovy/") ; 20 GroovyManager manager = gcontainer.getGroovyManager(classpath) ; 21 Object gobject = 22 manager.getGroovyObject("org/exoplatform/container/groovy/test/TestGroovyObject.groovy") ; 23 assertTrue("gobject instance is not null " , gobject != null) ; 24 System.out.println(manager.getGroovyObjectAsText("org/exoplatform/container/groovy/test/TestGroovyObject.groovy")) ; 25 String cpath = System.getProperty("java.class.path") ; 26 System.out.println(cpath) ; 27 } 28 } | Popular Tags |