1 5 package org.exoplatform.services.exporter.test; 6 7 import java.util.ArrayList ; 8 import org.exoplatform.container.PortalContainer; 9 import org.exoplatform.services.backup.BackupService; 10 import org.exoplatform.services.database.HibernateService; 11 import org.exoplatform.services.organization.Group; 12 import org.exoplatform.services.organization.OrganizationService; 13 import org.exoplatform.services.organization.User; 14 import org.exoplatform.services.portal.PortalConfigService; 15 import org.exoplatform.test.BasicTestCase; 16 17 18 25 public class TestExportService extends BasicTestCase { 26 private static BackupService service_ ; 27 private static OrganizationService orgService_ ; 28 29 public TestExportService(String name) { 30 super(name); 31 } 32 33 public void setUp() throws Exception { 34 if (service_ == null) { 35 PortalContainer manager = PortalContainer.getInstance(); 36 manager.getComponentInstanceOfType(PortalConfigService.class) ; 37 service_ = (BackupService) manager.getComponentInstanceOfType(BackupService.class) ; 38 orgService_ = (OrganizationService) manager.getComponentInstanceOfType(OrganizationService.class); 39 } 40 } 41 42 public void tearDown() throws Exception { 43 PortalContainer manager = PortalContainer.getInstance(); 44 HibernateService hservice = 45 (HibernateService) manager.getComponentInstanceOfType(HibernateService.class) ; 46 hservice.closeSession(); 47 } 48 49 public void testExportUserData() throws Exception { 50 service_.exportUserData() ; 51 System.err.println(service_.getExportLogger().getTextSummary()) ; 52 } 53 54 public void testImportUserData() throws Exception { 55 orgService_.removeUser("exo") ; 56 service_.importUserData("exo") ; 57 User user = orgService_.findUserByName("exo") ; 58 assertTrue("user is not null" , user != null) ; 59 System.err.println(service_.getImportLogger().getTextSummary()) ; 60 61 service_.importUserData("exo") ; 62 user = orgService_.findUserByName("exo") ; 63 assertTrue("user is not null" , user != null) ; 64 System.err.println(service_.getImportLogger().getTextSummary()) ; 65 } 66 67 public void testExportServiceData() throws Exception { 68 service_.exportServiceData() ; 69 System.err.println(service_.getExportLogger().getTextSummary()) ; 70 } 71 72 public void testImportServiceData() throws Exception { 73 service_.importServiceData() ; 74 System.err.println(service_.getImportLogger().getTextSummary()) ; 75 } 76 77 protected String getDescription() { 78 return "Test Export Service" ; 79 } 80 } 81 | Popular Tags |