source: extensions/jiwigo-ws-api/src/test/java/fr/mael/jiwigo/service/TagServiceTest.java @ 10089

Last change on this file since 10089 was 10089, checked in by anthony43, 13 years ago

restoring the previous tests

File size: 1.7 KB
Line 
1package fr.mael.jiwigo.service;
2
3import java.io.IOException;
4import java.util.Date;
5
6import junit.framework.Assert;
7
8import org.junit.Before;
9import org.junit.Ignore;
10import org.junit.Test;
11
12import fr.mael.jiwigo.dao.impl.TagDaoImpl;
13import fr.mael.jiwigo.service.impl.TagServiceImpl;
14import fr.mael.jiwigo.transverse.exception.ProxyAuthenticationException;
15import fr.mael.jiwigo.transverse.session.SessionManager;
16import fr.mael.jiwigo.transverse.session.impl.SessionManagerImpl;
17
18public class TagServiceTest {
19
20        private SessionManager sessionManager;
21
22        @Before
23        public void setUp() {
24                sessionManager = new SessionManagerImpl("mael", "motdepasse", "http://mael.piwigo.com", "Unit Test");
25                sessionManager.processLogin();
26        }
27
28        /**
29         * Test of the listing method
30         *
31         * @throws ProxyAuthenticationException
32         */
33        @Test
34        @Ignore
35        public void listTest() throws ProxyAuthenticationException {
36                try {
37                        TagDaoImpl tagDao = new TagDaoImpl();
38                        tagDao.setSessionManager(sessionManager);
39                        // TODO something weird happens here,
40                        // java.lang.ClassCastException: com.sun.org.apache.xerces.internal.dom.DeepNodeListImpl cannot be cast to
41                        // org.w3c.dom.Element
42                        // at fr.mael.jiwigo.dao.impl.TagDaoImpl.list(TagDaoImpl.java:58)
43                        tagDao.list();
44                } catch (IOException e) {
45                        e.printStackTrace();
46                }
47        }
48
49        /**
50         * Test of the creation method
51         *
52         * @throws ProxyAuthenticationException
53         * @throws IOException
54         */
55        @Test
56        public void createTest() throws ProxyAuthenticationException, IOException {
57                Date date = new Date();
58                TagServiceImpl tagService = new TagServiceImpl();
59                TagDaoImpl tagDao = new TagDaoImpl();
60                tagDao.setSessionManager(sessionManager);
61                tagService.setDao(tagDao);
62                Assert.assertSame(true, tagService.create("Tag" + date.getTime()));
63        }
64
65}
Note: See TracBrowser for help on using the repository browser.