From: <pka...@us...> - 2009-07-23 21:22:59
|
Revision: 360 http://cse-ip.svn.sourceforge.net/cse-ip/?rev=360&view=rev Author: pkasprzak Date: 2009-07-23 21:22:52 +0000 (Thu, 23 Jul 2009) Log Message: ----------- * Allow testing of ejb3 components via remote interfaces Modified Paths: -------------- trunk/sandbox/lsf-adapter-demo/CSECore-test/src/java/de/campussource/cse/core/test/Main.java Modified: trunk/sandbox/lsf-adapter-demo/CSECore-test/src/java/de/campussource/cse/core/test/Main.java =================================================================== --- trunk/sandbox/lsf-adapter-demo/CSECore-test/src/java/de/campussource/cse/core/test/Main.java 2009-07-23 21:19:58 UTC (rev 359) +++ trunk/sandbox/lsf-adapter-demo/CSECore-test/src/java/de/campussource/cse/core/test/Main.java 2009-07-23 21:22:52 UTC (rev 360) @@ -5,17 +5,87 @@ package de.campussource.cse.core.test; +import de.campussource.cse.core.DependencyManager; +import de.campussource.cse.core.EntityManager; +import de.campussource.cse.core.IdentityManager; +import de.campussource.cse.core.RelationManager; +import de.campussource.cse.core.cdm.AttributeType; +import de.campussource.cse.core.cdm.CourseType; +import de.campussource.cse.core.cdm.EntityType; +import java.util.logging.Logger; +import javax.naming.Context; +import javax.naming.InitialContext; +import javax.naming.NamingException; + /** * * @author pete */ public class Main { + private static EntityManager entityManager; + + private static RelationManager relationManager; + + private static IdentityManager identityManager; + + private static DependencyManager dependencyManager; + + private static Logger logger = Logger.getLogger("de.campussource.cse.core.test.Main"); + /** + * Print string + * + * @param string + */ + private static void print(String string) { + System.out.println(string); + } + + /** + * Print underlined string :) + * * @param args the command line arguments */ - public static void main(String[] args) { - // TODO code application logic here + private static void printUnderlined(String string) { + int c = string.length(); + StringBuffer buffer = new StringBuffer(); + for (int i = 1; i < c; i++) { + buffer.append("-"); + } + print(string); + print(buffer.toString()); } + private static void addAttribute(String attributeName, String attributeValue, EntityType entity) { + AttributeType attribute = new AttributeType(); + attribute.setName(attributeName); + attribute.setValue(attributeValue); + entity.getAttribute().add(attribute); + } + + public static void test_entityManager() { + CourseType course = new CourseType(); + addAttribute("clientId", "5", course); + addAttribute("attribute1", "value1", course); + addAttribute("attribute2", "value2", course); + int courseId = entityManager.createCourse(course); + print("*** Generated course with id = " + courseId); + } + + /** + * @param args the command line arguments + */ + public static void main(String[] args) throws NamingException { + + Context ctx = new InitialContext(); + + entityManager = (EntityManager) ctx.lookup("cse/EntityManager"); + relationManager = (RelationManager) ctx.lookup("cse/RelationManager"); + identityManager = (IdentityManager) ctx.lookup("cse/IdentityManager"); + dependencyManager = (DependencyManager) ctx.lookup("cse/DependencyManager"); + + test_entityManager(); + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |