Changeset 9921 for extensions/jiwigo/trunk/src/test
- Timestamp:
- Mar 29, 2011, 8:24:34 PM (14 years ago)
- Location:
- extensions/jiwigo/trunk/src/test/java/fr/mael/jiwigo
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/jiwigo/trunk/src/test/java/fr/mael/jiwigo/TestBase.java
r9431 r9921 6 6 7 7 import fr.mael.jiwigo.transverse.session.SessionManager; 8 import fr.mael.jiwigo.transverse.util.spring.SpringUtils; 8 9 9 10 public class TestBase { 10 11 public TestBase() { 11 Main.sessionManager = new SessionManager("mael", "motdepasse", "http://mael.piwigo.com"); 12 if (Main.sessionManager.processLogin() != 0) { 12 SessionManager sessionManager = SpringUtils.getSessionManager(); 13 sessionManager.setLogin("mael"); 14 sessionManager.setPassword("motdepasse"); 15 sessionManager.setUrl("http://mael.piwigo.com/ws.php"); 16 if (sessionManager.processLogin() != 0) { 13 17 try { 14 18 throw new Exception("Connection failed"); -
extensions/jiwigo/trunk/src/test/java/fr/mael/jiwigo/service/CategoryServiceTest.java
r9431 r9921 8 8 import org.junit.Test; 9 9 10 import fr.mael.jiwigo.Main;11 10 import fr.mael.jiwigo.TestBase; 12 import fr.mael.jiwigo.dao.CategoryDao;13 11 import fr.mael.jiwigo.transverse.exception.ProxyAuthenticationException; 12 import fr.mael.jiwigo.transverse.util.spring.SpringUtils; 14 13 15 14 public class CategoryServiceTest extends TestBase { … … 25 24 public void ListerTest() throws ProxyAuthenticationException { 26 25 try { 27 CategoryDao.getInstance(Main.sessionManager).list(true);28 CategoryDao.getInstance(Main.sessionManager).list(false);26 SpringUtils.getCategoryService().list(true); 27 SpringUtils.getCategoryService().list(false); 29 28 } catch (IOException e) { 30 29 e.printStackTrace(); … … 39 38 public void creerTest() throws ProxyAuthenticationException { 40 39 Date date = new Date(); 41 Assert.assertSame(true, CategoryService.getInstance(Main.sessionManager).create("Category" + date.getTime()));40 Assert.assertSame(true, SpringUtils.getCategoryService().create("Category" + date.getTime())); 42 41 } 43 42 -
extensions/jiwigo/trunk/src/test/java/fr/mael/jiwigo/service/ServicesTest.java
r9878 r9921 5 5 import org.junit.Test; 6 6 7 import fr.mael.jiwigo.Main;8 7 import fr.mael.jiwigo.TestBase; 9 8 import fr.mael.jiwigo.om.Category; 10 9 import fr.mael.jiwigo.om.Comment; 11 10 import fr.mael.jiwigo.om.Image; 11 import fr.mael.jiwigo.transverse.util.spring.SpringUtils; 12 12 13 13 public class ServicesTest extends TestBase { … … 20 20 public void testCreer() throws Exception { 21 21 Category cat = null; 22 for (Category category : CategoryService.getInstance(Main.sessionManager).list(true)) {22 for (Category category : SpringUtils.getCategoryService().list(true)) { 23 23 if (category.getIdentifier().equals(3)) { 24 24 cat = category; … … 27 27 } 28 28 29 Image image = ImageService.getInstance(Main.sessionManager).listByCategory(cat.getIdentifier(), true).get(0);30 List<Comment> comments = CommentService.getInstance(Main.sessionManager).list(image.getIdentifier());29 Image image = SpringUtils.getImageService().listByCategory(cat.getIdentifier(), true).get(0); 30 List<Comment> comments = SpringUtils.getCommentService().list(image.getIdentifier()); 31 31 // int firstCount = comments.size(); 32 CommentService.getInstance(Main.sessionManager).create("comment test", image.getIdentifier(), "none");32 SpringUtils.getCommentService().create("comment test", image.getIdentifier(), "none"); 33 33 // int secondCount = CommentService.getInstance(Main.sessionManager).list(image.getIdentifier()).size(); 34 34 // Assert.assertSame(firstCount + 1, secondCount); -
extensions/jiwigo/trunk/src/test/java/fr/mael/jiwigo/service/TagServiceTest.java
r9431 r9921 8 8 import org.junit.Test; 9 9 10 import fr.mael.jiwigo.Main;11 10 import fr.mael.jiwigo.TestBase; 12 import fr.mael.jiwigo.dao.TagDao;13 11 import fr.mael.jiwigo.transverse.exception.ProxyAuthenticationException; 12 import fr.mael.jiwigo.transverse.util.spring.SpringUtils; 14 13 15 14 public class TagServiceTest extends TestBase { … … 26 25 public void ListerTest() throws ProxyAuthenticationException { 27 26 try { 28 TagDao.getInstance(Main.sessionManager).list();27 SpringUtils.getTagService().list(); 29 28 } catch (IOException e) { 30 29 e.printStackTrace(); … … 40 39 Date date = new Date(); 41 40 try { 42 Assert.assertSame(true, TagService.getInstance(Main.sessionManager).create("Tag" + date.getTime()));41 Assert.assertSame(true, SpringUtils.getTagService().create("Tag" + date.getTime())); 43 42 } catch (IOException e) { 44 43 // TODO Auto-generated catch block
Note: See TracChangeset
for help on using the changeset viewer.