00001
00025 package org.openmobileis.test.bundle.profil;
00026
00027 import java.io.File;
00028 import java.io.FileReader;
00029 import java.io.InputStreamReader;
00030 import java.io.Reader;
00031
00032 import org.openmobileis.common.context.SessionContext;
00033 import org.openmobileis.common.context.SessionContextManager;
00034 import org.openmobileis.common.user.UserManager;
00035 import org.openmobileis.common.user.profile.Profile;
00036 import org.openmobileis.common.user.profile.ProfileDataManager;
00037 import org.openmobileis.common.user.profile.ProfileProperty;
00038 import org.openmobileis.common.user.profile.ProfileRubric;
00039 import org.openmobileis.common.user.profile.impl.TerminalXmlFileProfilDataFactory;
00040 import org.openmobileis.common.util.PropertiesManager;
00041 import org.openmobileis.common.util.collection.Array;
00042 import org.openmobileis.common.util.file.FileUtilities;
00043 import org.openmobileis.common.util.log.LogManager;
00044 import org.openmobileis.module.core.DependProfileModule;
00045 import org.openmobileis.module.core.ProfileModule;
00046 import org.openmobileis.module.core.ProfileModuleRubric;
00047 import org.openmobileis.module.core.XmlModuleParser;
00048 import org.openmobileis.module.profiles.server.ProfilManagerSyncTarget;
00049 import org.openmobileis.module.profiles.terminal.OpenMSPProfileSyncListener;
00050 import org.openmobileis.module.profiles.terminal.ProfileRubricSynchroListener;
00051 import org.openmobileis.module.server.ModuleJarSynchroTarget;
00052 import org.openmobileis.module.server.ModuleServerManager;
00053 import org.openmobileis.module.terminal.ModuleJarSyncListener;
00054 import org.openmobileis.module.terminal.ModuleManager;
00055 import org.openmobileis.synchro.client.SynchroDescriptor;
00056 import org.openmobileis.synchro.client.SynchroManager;
00057 import org.openmobileis.synchro.openmsp.client.OpenMSPSynchroManager;
00058 import org.openmobileis.synchro.openmsp.client.conduit.HttpOpenMSPSynchroConduit;
00059 import org.openmobileis.synchro.openmsp.client.conduit.LocalOpenMSPSynchroConduit;
00060 import org.openmobileis.synchro.openmsp.server.synctarget.SynchroTargerManager;
00061 import org.openmobileis.synchro.openmsp.server.synctarget.proxy.GenericProxySynchroTarget;
00062 import org.openmobileis.synchro.security.auth.Credential;
00063 import org.openmobileis.test.mock.common.MockUserManagerFactory;
00064 import org.openmobileis.test.mock.synchro.SimpleMockSynchroManager;
00065
00066 import junit.framework.Assert;
00067 import junit.framework.TestCase;
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077 public class TestBaseProfil extends TestCase {
00078
00082 public TestBaseProfil(String name) {
00083 super(name);
00084 }
00085
00086
00087
00088
00089 protected void setUp() throws Exception {
00090 super.setUp();
00091 LogManager.registerLogManager(null);
00092 }
00093
00094
00095
00096
00097 protected void tearDown() throws Exception {
00098 super.tearDown();
00099 }
00100
00104 public void testXmlModuleParser() {
00105 try {
00106 Reader reader = new InputStreamReader(PropertiesManager.getManager().getRessourceAsStream("/org/openmobileis/test/bundle/profil/testmodule.xml"));
00107 XmlModuleParser parser = new XmlModuleParser(reader);
00108 parser.parse();
00109
00110 ProfileModule module = parser.getModuletoload();
00111 Assert.assertEquals("TEST", module.getName());
00112 Assert.assertEquals("1.0.0", module.getVersion());
00113 Assert.assertEquals("testsnchro.jar", module.getServerjar());
00114 Assert.assertEquals("testterminal.jar", module.getTerminaljar());
00115 Array deplist = module.getDependModuleList();
00116 Assert.assertTrue(deplist.contains(new DependProfileModule("openMobileIS", "1.0.0")));
00117
00118 Array rubriclist = module.getModuleRubrics();
00119
00120
00121 ProfileModuleRubric rub1 = (ProfileModuleRubric) rubriclist.get(0);
00122 Assert.assertEquals("testrub1", rub1.getName());
00123 Assert.assertEquals("testloader1", rub1.getLoaderClass());
00124 Assert.assertTrue(rub1.getDependsList().length == 0);
00125 Array synclist = rub1.getSynchroListenerList();
00126 ProfileRubricSynchroListener sync = (ProfileRubricSynchroListener) synclist.get(0);
00127 Assert.assertEquals("listerner1", sync.name);
00128 Assert.assertNull(sync.dependsList);
00129 sync = (ProfileRubricSynchroListener) synclist.get(1);
00130 Assert.assertEquals("listerner3", sync.name);
00131 Assert.assertNull(sync.dependsList);
00132 sync = (ProfileRubricSynchroListener) synclist.get(2);
00133 Assert.assertEquals("listerner2", sync.name);
00134 Assert.assertNotNull(sync.dependsList);
00135 Assert.assertEquals("listerner1", sync.dependsList[0]);
00136 Assert.assertEquals("listerner3", sync.dependsList[1]);
00137 Assert.assertNotNull(rub1.getProperty("description"));
00138 Assert.assertEquals("Test rubric loader", rub1.getProperty("description"));
00139
00140
00141 rub1 = (ProfileModuleRubric) rubriclist.get(1);
00142 Assert.assertEquals("testrub2", rub1.getName());
00143 String[] deprublist = rub1.getDependsList();
00144 Assert.assertEquals("testrub1", deprublist[0]);
00145 Assert.assertEquals("testloader21", rub1.getLoaderClass());
00146 synclist = rub1.getSynchroListenerList();
00147 sync = (ProfileRubricSynchroListener) synclist.get(0);
00148 Assert.assertEquals("listerner1", sync.name);
00149 Assert.assertNull(sync.dependsList);
00150
00151
00152 rub1 = (ProfileModuleRubric) rubriclist.get(2);
00153 Assert.assertEquals("testrub3", rub1.getName());
00154 deprublist = rub1.getDependsList();
00155 Assert.assertEquals("testrub1", deprublist[0]);
00156 Assert.assertEquals("testrub2", deprublist[1]);
00157 Assert.assertEquals("testloader3", rub1.getLoaderClass());
00158 synclist = rub1.getSynchroListenerList();
00159 sync = (ProfileRubricSynchroListener) synclist.get(0);
00160 Assert.assertEquals("listerner31", sync.name);
00161 Assert.assertNull(sync.dependsList);
00162
00163 } catch (Exception ex) {
00164 Assert.fail("Exception occurs during testXmlModuleParser :" + ex.getMessage());
00165 }
00166 }
00167
00171 public void testTerminalProfilParser() {
00172 try {
00173 Reader reader = new InputStreamReader(PropertiesManager.getManager().getRessourceAsStream("/org/openmobileis/test/bundle/profil/testprofils.xml"));
00174 TerminalXmlFileProfilDataFactory parser = new TerminalXmlFileProfilDataFactory(reader);
00175 Profile profil = parser.getParsedProfil();
00176 Assert.assertEquals("defname", profil.profilName);
00177
00178 Assert.assertEquals(profil.profilRubric.length, 4);
00179
00180 Assert.assertEquals("openMobileIS", profil.profilRubric[0].moduleName);
00181 Assert.assertEquals("Core OpenMobileIS", profil.profilRubric[0].rubricName);
00182 Assert.assertEquals("1.0.0", profil.profilRubric[0].version);
00183 Assert.assertNull(profil.profilRubric[0].description);
00184
00185 Assert.assertEquals("TEST", profil.profilRubric[1].moduleName);
00186 Assert.assertEquals("testrub1", profil.profilRubric[1].rubricName);
00187 Assert.assertEquals("1.0.0", profil.profilRubric[1].version);
00188 Assert.assertEquals("test desc", profil.profilRubric[1].description);
00189
00190 Assert.assertEquals("TEST", profil.profilRubric[2].moduleName);
00191 Assert.assertEquals("testrub2", profil.profilRubric[2].rubricName);
00192 Assert.assertEquals("test desc2", profil.profilRubric[2].description);
00193 Assert.assertNull(profil.profilRubric[2].version);
00194
00195 Assert.assertEquals("TEST", profil.profilRubric[3].moduleName);
00196 Assert.assertEquals("testrub3", profil.profilRubric[3].rubricName);
00197 Assert.assertNull(profil.profilRubric[3].version);
00198 Assert.assertNull(profil.profilRubric[3].description);
00199
00200
00201 Assert.assertEquals(profil.profilProperties.length, 2);
00202 Assert.assertEquals("testkey1", profil.profilProperties[0].key);
00203 Assert.assertEquals("value1", profil.profilProperties[0].value);
00204 Assert.assertNull(profil.profilProperties[0].moduleName);
00205
00206 Assert.assertEquals("testkey2", profil.profilProperties[1].key);
00207 Assert.assertEquals("value2", profil.profilProperties[1].value);
00208 Assert.assertEquals("TEST", profil.profilProperties[1].moduleName);
00209
00210 } catch (Exception ex) {
00211 Assert.fail("Exception occurs during testXmlModuleParser :" + ex.getMessage());
00212 }
00213
00214 }
00215
00219 public void testProfilEquals() {
00220 try {
00221 Reader reader = new InputStreamReader(PropertiesManager.getManager().getRessourceAsStream("/org/openmobileis/test/bundle/profil/testprofils.xml"));
00222 TerminalXmlFileProfilDataFactory parser = new TerminalXmlFileProfilDataFactory(reader);
00223 Profile profil1 = parser.getParsedProfil();
00224
00225 reader = new InputStreamReader(PropertiesManager.getManager().getRessourceAsStream("/org/openmobileis/test/bundle/profil/testprofils.xml"));
00226 parser = new TerminalXmlFileProfilDataFactory(reader);
00227 Profile profil2 = parser.getParsedProfil();
00228
00229 Assert.assertEquals(profil1, profil2);
00230
00231
00232 profil2.profilName = "toto";
00233 Assert.assertNotSame(profil1, profil2);
00234 profil2.profilName = profil1.profilName;
00235 Assert.assertEquals(profil1, profil2);
00236
00237 profil2.profilRubric = new ProfileRubric[] { profil1.profilRubric[0], profil1.profilRubric[1], profil1.profilRubric[2] };
00238 Assert.assertNotSame(profil1, profil2);
00239 profil2.profilRubric = profil1.profilRubric;
00240 Assert.assertEquals(profil1, profil2);
00241 profil2.profilRubric[0].moduleName = "toto";
00242 Assert.assertNotSame(profil1, profil2);
00243 profil2.profilRubric = profil1.profilRubric;
00244 Assert.assertEquals(profil1, profil2);
00245 profil2.profilRubric[0].rubricName = "toto";
00246 Assert.assertNotSame(profil1, profil2);
00247 profil2.profilRubric = profil1.profilRubric;
00248 Assert.assertEquals(profil1, profil2);
00249 profil2.profilRubric[0].version = "toto";
00250 Assert.assertNotSame(profil1, profil2);
00251 profil2.profilRubric = profil1.profilRubric;
00252 Assert.assertEquals(profil1, profil2);
00253 profil2.profilRubric[0].description = "toto";
00254 Assert.assertNotSame(profil1, profil2);
00255 profil2.profilRubric = profil1.profilRubric;
00256 Assert.assertEquals(profil1, profil2);
00257 profil2.profilRubric[1].description = "toto";
00258 Assert.assertNotSame(profil1, profil2);
00259 profil2.profilRubric = profil1.profilRubric;
00260 Assert.assertEquals(profil1, profil2);
00261 profil2.profilRubric[3].version = "toto";
00262 Assert.assertNotSame(profil1, profil2);
00263 profil2.profilRubric = profil1.profilRubric;
00264 Assert.assertEquals(profil1, profil2);
00265 profil2.profilRubric[1].version = null;
00266 Assert.assertNotSame(profil1, profil2);
00267 profil2.profilRubric = profil1.profilRubric;
00268 Assert.assertEquals(profil1, profil2);
00269 profil2.profilRubric[1].description = null;
00270 Assert.assertNotSame(profil1, profil2);
00271 profil2.profilRubric = profil1.profilRubric;
00272 Assert.assertEquals(profil1, profil2);
00273
00274 profil2.profilProperties = new ProfileProperty[] { profil1.profilProperties[0] };
00275 Assert.assertNotSame(profil1, profil2);
00276 profil2.profilProperties = profil1.profilProperties;
00277 Assert.assertEquals(profil1, profil2);
00278 profil2.profilProperties[0].key = "toto";
00279 Assert.assertNotSame(profil1, profil2);
00280 profil2.profilProperties = profil1.profilProperties;
00281 Assert.assertEquals(profil1, profil2);
00282 profil2.profilProperties[0].value = "toto";
00283 Assert.assertNotSame(profil1, profil2);
00284 profil2.profilProperties = profil1.profilProperties;
00285 Assert.assertEquals(profil1, profil2);
00286 profil2.profilProperties[0].moduleName = "toto";
00287 Assert.assertNotSame(profil1, profil2);
00288 profil2.profilProperties = profil1.profilProperties;
00289 Assert.assertEquals(profil1, profil2);
00290 profil2.profilProperties[1].moduleName = "toto";
00291 Assert.assertNotSame(profil1, profil2);
00292 profil2.profilProperties = profil1.profilProperties;
00293 Assert.assertEquals(profil1, profil2);
00294 profil2.profilProperties[1].moduleName = null;
00295 Assert.assertNotSame(profil1, profil2);
00296 profil2.profilProperties = profil1.profilProperties;
00297 Assert.assertEquals(profil1, profil2);
00298
00299 } catch (Exception ex) {
00300 Assert.fail("Exception occurs during testXmlModuleParser :" + ex.getMessage());
00301 }
00302
00303 }
00304
00308 public void testProfilSynchro() {
00309 try {
00310
00311 String synchronizedProfilFile = System.getProperty("user.dir") + "/WEB-INF/conf/userprofil.xml";
00312 PropertiesManager.getManager().addProperty("org.openmobileis.profil.file", synchronizedProfilFile);
00313
00314
00315 File file = new File(synchronizedProfilFile);
00316 if (file.exists())
00317 file.delete();
00318
00319
00320 PropertiesManager.getManager().addProperty("fastobjectdb.database.path", System.getProperty("user.dir") + "/database");
00321 PropertiesManager.getManager().addProperty("fastobjectdb.database.name", "testdb");
00322
00323 Credential cred = new Credential("test", "test");
00324 UserManager.getManager().registerUserManagerFactoryForGroup("defgroup", new MockUserManagerFactory("defgroup", "defname", cred));
00325
00326 Reader reader = new InputStreamReader(PropertiesManager.getManager().getRessourceAsStream("/org/openmobileis/test/bundle/profil/testprofils.xml"));
00327 TerminalXmlFileProfilDataFactory serverprofilmanager = new TerminalXmlFileProfilDataFactory(reader);
00328 ProfileDataManager.getManager().registerProfilDataFactoryForGroup("defgroup", serverprofilmanager);
00329
00330
00331 SessionContext context = SessionContextManager.getManager().createSessionContext("testsession");
00332 SessionContextManager.getManager().joinSessionContext("testsession");
00333 context.setUserGroup("defgroup");
00334 context.setUserId("defname");
00335
00336 String synchroInstallPath = System.getProperty("user.dir") + "/synchro";
00337 SimpleMockSynchroManager synchromock = new SimpleMockSynchroManager(synchroInstallPath);
00338 OpenMSPProfileSyncListener listener = new OpenMSPProfileSyncListener();
00339 ProfilManagerSyncTarget target = new ProfilManagerSyncTarget();
00340 synchromock.registerTerminalSynchroListener(listener);
00341 synchromock.registerServerSynchroTarget(target);
00342 synchromock.synchronize("defgroup", cred, new SynchroDescriptor());
00343
00344
00345 Profile serverprofil = serverprofilmanager.getParsedProfil();
00346 Reader termreader = new FileReader(synchronizedProfilFile);
00347 TerminalXmlFileProfilDataFactory parser = new TerminalXmlFileProfilDataFactory(termreader);
00348 Profile tremprofil = parser.getParsedProfil();
00349 Assert.assertEquals(serverprofil, tremprofil);
00350
00351 } catch (Exception ex) {
00352 LogManager.traceError(0, ex);
00353 Assert.fail("Exception occurs during testXmlModuleParser :" + ex.getMessage());
00354 }
00355
00356 }
00357
00358 public void testJarSynchro() {
00359 try {
00360
00361 String basepath = System.getProperty("user.dir") + "/testfiles/testprofile/testjarsynchro/";
00362 String destPath = System.getProperty("user.dir") + "/repository/";
00363 FileUtilities.copyFile(basepath+"openmobileis.xml", destPath+"openmobileis.xml");
00364 FileUtilities.copyFile(basepath+"openmisclient.jar", destPath+"openmisclient.jar");
00365 FileUtilities.copyFile(basepath+"openmobileis.xml", System.getProperty("user.dir")+"/WEB-INF/conf/xml/openMobileIS.xml");
00366
00367
00368 String xmlservermodulefile = System.getProperty("user.dir") + "/repository/openmobileis.xml";
00369 PropertiesManager.getManager().addProperty("org.openmobileis.bundle.module.repositorypath", System.getProperty("user.dir") + "/repository");
00370
00371
00372 PropertiesManager.getManager().addProperty("org.openmobileis.module.repository.jar", System.getProperty("user.dir") + "/WEB-INF/lib");
00373 PropertiesManager.getManager().addProperty("org.openmobileis.module.repository.xml", System.getProperty("user.dir") + "/WEB-INF/conf/xml");
00374
00375
00376 File jarfile = new File(PropertiesManager.getManager().getProperty("org.openmobileis.module.repository.jar") + "/openmisclient.jar");
00377 if (jarfile.exists())
00378 jarfile.delete();
00379 File xmlffile = new File(PropertiesManager.getManager().getProperty("org.openmobileis.module.repository.xml") + "/openMobileIS.xml");
00380
00381
00382
00383
00384 Credential cred = new Credential("test", "test");
00385 UserManager.getManager().registerUserManagerFactoryForGroup("defgroup", new MockUserManagerFactory("defgroup", "defname", cred));
00386
00387 Reader reader = new InputStreamReader(PropertiesManager.getManager().getRessourceAsStream("/org/openmobileis/test/bundle/profil/testprofils.xml"));
00388 TerminalXmlFileProfilDataFactory serverprofilmanager = new TerminalXmlFileProfilDataFactory(reader);
00389 ProfileDataManager.getManager().registerProfilDataFactoryForGroup("defgroup", serverprofilmanager);
00390
00391
00392 SessionContext context = SessionContextManager.getManager().createSessionContext("testsession");
00393 SessionContextManager.getManager().joinSessionContext("testsession");
00394 context.setUserGroup("defgroup");
00395 context.setUserId("defname");
00396
00397 ProfileModule module = ModuleManager.getManager().readModuleXmlFiles("openMobileIS");
00398 ModuleJarSyncListener listener = new ModuleJarSyncListener();
00399 listener.setModule(module);
00400 ModuleJarSynchroTarget target = new ModuleJarSynchroTarget(new File(xmlservermodulefile));
00401
00402
00403 String synchroInstallPath = System.getProperty("user.dir") + "/synchro";
00404 PropertiesManager.getManager().addProperty("org.openmobileis.synchro.direct.installpath", synchroInstallPath);
00405 SynchroDescriptor descriptor = new SynchroDescriptor();
00406 descriptor.setSynchroConduit(new HttpOpenMSPSynchroConduit(synchroInstallPath, ""));
00407 SimpleMockSynchroManager synchromock = new SimpleMockSynchroManager(synchroInstallPath);
00408
00409 synchromock.registerTerminalSynchroListener(listener);
00410 synchromock.registerServerSynchroTarget(target);
00411 synchromock.synchronize("defgroup", cred, descriptor);
00412
00413
00414 Assert.assertTrue(jarfile.exists());
00415 Assert.assertTrue(xmlffile.exists());
00416
00417
00418 jarfile.delete();
00419 xmlffile.delete();
00420 synchromock.synchronize("defgroup", cred, descriptor);
00421 Assert.assertTrue(!jarfile.exists());
00422 Assert.assertTrue(!xmlffile.exists());
00423
00424
00425 jarfile.delete();
00426 xmlffile.delete();
00427
00428 File sxmlfile = new File(xmlservermodulefile);
00429 sxmlfile.setLastModified(new java.util.Date().getTime());
00430
00431
00432 Thread.currentThread().sleep(1000);
00433
00434 synchromock.synchronize("defgroup", cred, descriptor);
00435 Assert.assertTrue(jarfile.exists());
00436 Assert.assertTrue(xmlffile.exists());
00437
00438
00439 jarfile.delete();
00440 xmlffile.delete();
00441 File sjarfile = new File(PropertiesManager.getManager().getProperty("org.openmobileis.bundle.module.repositorypath") + "/"
00442 + target.getProfilModule().getTerminaljar());
00443 sjarfile.setLastModified(new java.util.Date().getTime());
00444
00445
00446 Thread.currentThread().sleep(1000);
00447 synchromock.synchronize("defgroup", cred, descriptor);
00448 Assert.assertTrue(jarfile.exists());
00449 Assert.assertTrue(xmlffile.exists());
00450
00451
00452 jarfile.delete();
00453 xmlffile.delete();
00454 synchromock.synchronize("defgroup", cred, descriptor);
00455 Assert.assertTrue(!jarfile.exists());
00456 Assert.assertTrue(!xmlffile.exists());
00457
00458 } catch (Exception ex) {
00459 LogManager.traceError(0, ex);
00460 Assert.fail("Exception occurs during testXmlModuleParser :" + ex.getMessage());
00461 }
00462
00463 }
00464
00465 public void testCompleteProfilJarSynchro() {
00466 try {
00467
00468 String basepath = System.getProperty("user.dir") + "/testfiles/testprofile/testCompleteProfilJarSynchro/";
00469 String destPath = System.getProperty("user.dir");
00470 FileUtilities.copyFile(basepath+"openmobileis.xml", destPath+"/repository/openmobileis.xml");
00471 FileUtilities.copyFile(basepath+"openmisclient.jar", destPath+"/repository/openmisclient.jar");
00472 FileUtilities.copyFile(basepath+"mycrm.xml", destPath+"/repository/mycrm.xml");
00473 FileUtilities.copyFile(basepath+"mycrm.jar", destPath+"/repository/mycrm.jar");
00474 FileUtilities.copyFile(basepath+"initprofil.xml", destPath+"/WEB-INF/conf/userprofil.xml");
00475 FileUtilities.copyFile(basepath+"baseprofil.xml", destPath+"/server_conf/baseprofil.xml");
00476
00477 FileUtilities.copyFile(basepath+"openmobileis.xml", destPath+"/WEB-INF/module/xml/openMobileIS.xml");
00478
00479
00480
00481
00482 String synchronizedProfilFile = System.getProperty("user.dir") + "/WEB-INF/conf/userprofil.xml";
00483 PropertiesManager.getManager().addProperty("org.openmobileis.profil.file", synchronizedProfilFile);
00484
00485 PropertiesManager.getManager().addProperty("fastobjectdb.database.path", System.getProperty("user.dir") + "/database");
00486 PropertiesManager.getManager().addProperty("fastobjectdb.database.name", "testdb");
00487
00488
00489 PropertiesManager.getManager().addProperty("org.openmobileis.bundle.module.repositorypath", System.getProperty("user.dir") + "/repository");
00490
00491
00492
00493
00494
00495
00496
00497
00498
00499 Credential cred = new Credential("test", "test");
00500 UserManager.getManager().registerUserManagerFactoryForGroup("defgroup", new MockUserManagerFactory("defgroup", "defname", cred));
00501
00502 Reader reader = new FileReader(System.getProperty("user.dir") + "/server_conf/baseprofil.xml");
00503 TerminalXmlFileProfilDataFactory serverprofilmanager = new TerminalXmlFileProfilDataFactory(reader);
00504 ProfileDataManager.getManager().registerProfilDataFactoryForGroup("defgroup", serverprofilmanager);
00505
00506
00507 SessionContext context = SessionContextManager.getManager().createSessionContext("testsession");
00508 SessionContextManager.getManager().joinSessionContext("testsession");
00509 context.setUserGroup("defgroup");
00510 context.setUserId("defname");
00511
00512
00513 TestModuleManagerListener moduleManagerListenernew = new TestModuleManagerListener();
00514
00515 PropertiesManager.getManager().addProperty("org.openmobileis.module.repository.jar", moduleManagerListenernew.getJarInstallPath());
00516 PropertiesManager.getManager().addProperty("org.openmobileis.module.repository.xml", moduleManagerListenernew.getXMLInstallPath());
00517 File todeletefile = new File(PropertiesManager.getManager().getProperty("org.openmobileis.module.repository.jar")+"/openmisclient.jar");
00518 todeletefile.delete();
00519 todeletefile = new File(PropertiesManager.getManager().getProperty("org.openmobileis.module.repository.xml")+"/openMobileIS.xml");
00520 todeletefile.delete();
00521 todeletefile = new File(PropertiesManager.getManager().getProperty("org.openmobileis.module.repository.jar")+"/mycrm.jar");
00522 todeletefile.delete();
00523 todeletefile = new File(PropertiesManager.getManager().getProperty("org.openmobileis.module.repository.xml")+"/MyCRM.xml");
00524 todeletefile.delete();
00525 ModuleManager.getManager().registerModuleManagerListener(moduleManagerListenernew);
00526 ModuleManager.getManager().initModule();
00527 Assert.assertNotNull(moduleManagerListenernew.loadedModuleNames[0]);
00528 Assert.assertEquals("openMobileIS", moduleManagerListenernew.loadedModuleNames[0].getName());
00529
00530
00531 String synchroInstallPath = System.getProperty("user.dir") + "/synchro";
00532 PropertiesManager.getManager().addProperty("org.openmobileis.synchro.direct.installpath", synchroInstallPath);
00533 SynchroDescriptor descriptor = new SynchroDescriptor();
00534 descriptor.setSynchroGroup("defgroup");
00535 String useragent = OpenMSPSynchroManager.getManager().getSynchroUserAgent(descriptor);
00536 descriptor.setSynchroConduit(new LocalOpenMSPSynchroConduit(synchroInstallPath, useragent));
00537
00538
00539 PropertiesManager.getManager().addProperty("org.openmobileis.bundle.module.repositorypath", System.getProperty("user.dir") + "/repository");
00540 ModuleServerManager.getManager();
00541 ProfilManagerSyncTarget target = new ProfilManagerSyncTarget();
00542 SynchroTargerManager.getManager().addSynchroTargetListener(target, null, null);
00543 SynchroTargerManager.getManager().registerProxyTargetForTerminal(new GenericProxySynchroTarget(), null);
00544
00545 SynchroManager.getManager().registerSynchroProcessor(OpenMSPSynchroManager.getManager());
00546 SynchroManager.getManager().doSynchro(cred, descriptor);
00547
00548
00549 File jarfile = new File(PropertiesManager.getManager().getProperty("org.openmobileis.module.repository.jar")+"/openmisclient.jar");
00550 Assert.assertTrue(jarfile.exists());
00551 jarfile = new File(PropertiesManager.getManager().getProperty("org.openmobileis.module.repository.jar")+"/mycrm.jar");
00552 Assert.assertTrue(jarfile.exists());
00553
00554 File xmlfile = new File(PropertiesManager.getManager().getProperty("org.openmobileis.module.repository.xml")+"/openMobileIS.xml");
00555 Assert.assertTrue(xmlfile.exists());
00556 xmlfile = new File(PropertiesManager.getManager().getProperty("org.openmobileis.module.repository.xml")+"/MyCRM.xml");
00557 Assert.assertTrue(xmlfile.exists());
00558
00559
00560
00561 } catch (Exception ex) {
00562 LogManager.traceError(0, ex);
00563 Assert.fail("Exception occurs during testXmlModuleParser :" + ex.getMessage());
00564 }
00565
00566 }
00567
00568 }