KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > container > groovy > test > TestGroovyContainerManager


1 package org.exoplatform.container.groovy.test;
2
3 import java.net.URL JavaDoc;
4 import org.exoplatform.container.RootContainer;
5 import org.exoplatform.container.groovy.* ;
6 import org.exoplatform.test.BasicTestCase;
7 /**
8  * Created by the Exo Development team.
9  * Author : Mestrallet Benjamin
10  * benjamin.mestrallet@exoplatform.com
11  */

12 public class TestGroovyContainerManager extends BasicTestCase {
13   
14   public void testGroovyContainerManager() throws Exception JavaDoc {
15     RootContainer container = RootContainer.getInstance() ;
16     GroovyManagerContainer gcontainer =
17       (GroovyManagerContainer)container.getComponentInstanceOfType(GroovyManagerContainer.class) ;
18     URL JavaDoc classpath = new URL JavaDoc("file:" + container.getServerEnvironment().getServerHome() +
19                              "/web/portal/src/webapp/WEB-INF/groovy/") ;
20     GroovyManager manager = gcontainer.getGroovyManager(classpath) ;
21     Object JavaDoc 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 JavaDoc cpath = System.getProperty("java.class.path") ;
26     System.out.println(cpath) ;
27     }
28 }
Popular Tags