Changeset 10505


Ignore:
Timestamp:
Apr 20, 2011, 5:17:02 AM (13 years ago)
Author:
anthony43
Message:

huge refactoring to introduce JiwigoException : a generic exception encapsulating low level exceptions (IOException, ProxyAuthentication, etc...)
The aim is to have, on the consumer side, just one exception to catch them all.
this refactoring may need a code review to check the changes.

Location:
extensions/jiwigo-ws-api/src
Files:
1 added
21 edited

Legend:

Unmodified
Added
Removed
  • extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/dao/CategoryDao.java

    r9919 r10505  
    55
    66import fr.mael.jiwigo.om.Category;
     7import fr.mael.jiwigo.transverse.exception.JiwigoException;
    78import fr.mael.jiwigo.transverse.exception.ProxyAuthenticationException;
    89
     
    1516     * @throws IOException
    1617     * @throws ProxyAuthenticationException
     18     * @throws JiwigoException
    1719     */
    18     public List<Category> list(boolean recursive) throws IOException, ProxyAuthenticationException;
     20    public List<Category> list(boolean recursive) throws JiwigoException;
    1921
    2022    /**
     
    2325     * @return true if the category is successfully created
    2426     * @throws ProxyAuthenticationException
     27     * @throws JiwigoException
    2528     */
    26     public boolean create(Category category) throws ProxyAuthenticationException;
     29    public boolean create(Category category) throws JiwigoException;
    2730}
  • extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/dao/CommentDao.java

    r9919 r10505  
    55
    66import fr.mael.jiwigo.om.Comment;
     7import fr.mael.jiwigo.transverse.exception.JiwigoException;
    78import fr.mael.jiwigo.transverse.exception.ProxyAuthenticationException;
    89
     
    1516     * @throws ProxyAuthenticationException
    1617     */
    17     public List<Comment> list(Integer idImage) throws IOException, ProxyAuthenticationException;
     18    public List<Comment> list(Integer idImage) throws JiwigoException;
    1819
    1920    /**
     
    2425     * @throws ProxyAuthenticationException
    2526     */
    26     public String getKey(Integer idImage) throws IOException, ProxyAuthenticationException;
     27    public String getKey(Integer idImage) throws JiwigoException;
    2728
    2829    /**
     
    3334     * @throws ProxyAuthenticationException
    3435     */
    35     public boolean create(Comment commentaire) throws IOException, ProxyAuthenticationException;
     36    public boolean create(Comment commentaire) throws JiwigoException;
    3637}
  • extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/dao/ImageDao.java

    r10494 r10505  
    88import fr.mael.jiwigo.om.Image;
    99import fr.mael.jiwigo.transverse.exception.FileAlreadyExistsException;
     10import fr.mael.jiwigo.transverse.exception.JiwigoException;
    1011import fr.mael.jiwigo.transverse.exception.ProxyAuthenticationException;
    1112import fr.mael.jiwigo.transverse.exception.WrongChunkSizeException;
     
    1819     * @throws ProxyAuthenticationException
    1920     */
    20     public List<Image> list(boolean refresh) throws IOException, ProxyAuthenticationException;
     21    public List<Image> list(boolean refresh) throws JiwigoException;
    2122
    2223    /**
     
    2728     * @throws ProxyAuthenticationException
    2829     */
    29     public List<Image> listByCategory(Integer categoryId, boolean refresh) throws IOException,
    30             ProxyAuthenticationException;
     30    public List<Image> listByCategory(Integer categoryId, boolean refresh) throws JiwigoException;
    3131
    3232    /**
     
    4545     * @throws NoSuchAlgorithmException
    4646     * @throws WrongChunkSizeException
     47     * @throws JiwigoException
    4748     * @throws Exception
    4849     */
    4950    //TODO ne pas continuer si une des reponses precedentes est negative
    5051    public boolean create(Image image, Double chunkSize) throws FileAlreadyExistsException, IOException,
    51             ProxyAuthenticationException, NoSuchAlgorithmException, WrongChunkSizeException;
     52            ProxyAuthenticationException, NoSuchAlgorithmException, WrongChunkSizeException, JiwigoException;
    5253
    5354    /**
     
    5859     * @throws ProxyAuthenticationException
    5960     */
    60     public boolean addTags(Integer imageId, String tagId) throws IOException, ProxyAuthenticationException;
     61    public boolean addTags(Integer imageId, String tagId) throws JiwigoException;
    6162
    6263    /**
     
    6768     * @throws ProxyAuthenticationException
    6869     */
    69     public List<Image> search(String searchString) throws IOException, ProxyAuthenticationException;
     70    public List<Image> search(String searchString) throws JiwigoException;
    7071
    7172    /**
     
    7778     * @param title
    7879     * @throws IOException
     80     * @throws JiwigoException
    7981     */
    80     public void addSimple(File file, Integer category, String title) throws IOException;
     82    public void addSimple(File file, Integer category, String title) throws JiwigoException;
    8183
    8284}
  • extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/dao/TagDao.java

    r9919 r10505  
    11package fr.mael.jiwigo.dao;
    22
    3 import java.io.IOException;
    43import java.util.List;
    54
    65import fr.mael.jiwigo.om.Image;
    76import fr.mael.jiwigo.om.Tag;
    8 import fr.mael.jiwigo.transverse.exception.ProxyAuthenticationException;
     7import fr.mael.jiwigo.transverse.exception.JiwigoException;
    98
    109public interface TagDao {
     
    1211     * lists the tags
    1312     * @return the list of tags
    14      * @throws IOException
    15      * @throws ProxyAuthenticationException
     13     * @throws JiwigoException
    1614     */
    17     public List<Tag> list() throws IOException, ProxyAuthenticationException;
     15    public List<Tag> list() throws JiwigoException;
    1816
    1917    /**
     
    2119     * @param tag the tag to create
    2220     * @return true if the tag as been successfully created
    23      * @throws ProxyAuthenticationException
     21     * @throws JiwigoException
    2422     */
    25     public boolean create(Tag tag) throws ProxyAuthenticationException;
     23    public boolean create(Tag tag) throws JiwigoException;
    2624
    2725    /**
     
    2927     * @param image the image
    3028     * @return the tags list
    31      * @throws IOException
    32      * @throws ProxyAuthenticationException
     29     * @throws JiwigoException
    3330     */
    34     public List<Tag> tagsForImage(Image image) throws IOException, ProxyAuthenticationException;
     31    public List<Tag> tagsForImage(Image image) throws JiwigoException;
    3532}
  • extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/dao/impl/CategoryDaoImpl.java

    r9919 r10505  
    1717import fr.mael.jiwigo.transverse.enumeration.MethodsEnum;
    1818import fr.mael.jiwigo.transverse.exception.FileAlreadyExistsException;
     19import fr.mael.jiwigo.transverse.exception.JiwigoException;
    1920import fr.mael.jiwigo.transverse.exception.ProxyAuthenticationException;
    2021import fr.mael.jiwigo.transverse.session.SessionManager;
     
    5354     * @param recursive true : recursive listing of the categories
    5455     * @return the list of categories
     56     * @throws JiwigoException
    5557     * @throws IOException
    5658     * @throws ProxyAuthenticationException
    5759     */
    58     public List<Category> list(boolean recursive) throws IOException, ProxyAuthenticationException {
     60    public List<Category> list(boolean recursive) throws JiwigoException {
    5961        Document doc = sessionManager.executeReturnDocument(MethodsEnum.LISTER_CATEGORIES.getLabel(), "recursive",
    6062                String.valueOf(recursive));
     
    9294     * @return true if the category is successfully created
    9395     * @throws ProxyAuthenticationException
     96     * @throws JiwigoException
    9497     */
    95     public boolean create(Category category) throws ProxyAuthenticationException {
     98    public boolean create(Category category) throws JiwigoException {
    9699        try {
    97100            if (category.getDirectParent() != null) {
     
    102105                        "name", category.getName()));
    103106            }
    104         } catch (IOException e) {
    105             LOG.error(Tools.getStackTrace(e));
    106107        } catch (FileAlreadyExistsException e) {
    107108            LOG.error(Tools.getStackTrace(e));
     109            throw new JiwigoException(e);
    108110        }
    109         return false;
    110111    }
    111112
  • extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/dao/impl/CommentDaoImpl.java

    r9919 r10505  
    1616import fr.mael.jiwigo.transverse.enumeration.MethodsEnum;
    1717import fr.mael.jiwigo.transverse.exception.FileAlreadyExistsException;
     18import fr.mael.jiwigo.transverse.exception.JiwigoException;
    1819import fr.mael.jiwigo.transverse.exception.ProxyAuthenticationException;
    1920import fr.mael.jiwigo.transverse.session.SessionManager;
     
    5253     * @throws ProxyAuthenticationException
    5354     */
    54     public List<Comment> list(Integer idImage) throws IOException, ProxyAuthenticationException {
    55         Document doc = (sessionManager.executeReturnDocument(MethodsEnum.GET_INFO.getLabel(), "image_id", String
    56                 .valueOf(idImage), "comments_per_page", "100"));
     55    public List<Comment> list(Integer idImage) throws JiwigoException {
     56        Document doc = (sessionManager.executeReturnDocument(MethodsEnum.GET_INFO.getLabel(), "image_id",
     57                String.valueOf(idImage), "comments_per_page", "100"));
    5758        Element elementImage = (Element) doc.getDocumentElement().getElementsByTagName("image").item(0);
    5859        Element elementComments = (Element) elementImage.getElementsByTagName("comments").item(0);
     
    8182     * @throws ProxyAuthenticationException
    8283     */
    83     public String getKey(Integer idImage) throws IOException, ProxyAuthenticationException {
    84         Document doc = (sessionManager.executeReturnDocument(MethodsEnum.GET_INFO.getLabel(), "image_id", String
    85                 .valueOf(idImage)));
     84    public String getKey(Integer idImage) throws JiwigoException {
     85        Document doc = (sessionManager.executeReturnDocument(MethodsEnum.GET_INFO.getLabel(), "image_id",
     86                String.valueOf(idImage)));
    8687        //      String key = doc.getRootElement().getChild("image").getChild("comment_post").getAttributeValue("key");
    8788        Element elementImage = (Element) doc.getDocumentElement().getElementsByTagName("image").item(0);
     
    9798     * @throws ProxyAuthenticationException
    9899     */
    99     public boolean create(Comment commentaire) throws IOException, ProxyAuthenticationException {
     100    public boolean create(Comment commentaire) throws JiwigoException {
    100101        String key = getKey(commentaire.getImageId());
    101102        try {
  • extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/dao/impl/ImageDaoImpl.java

    r10494 r10505  
    55import java.io.IOException;
    66import java.io.InputStreamReader;
     7import java.io.UnsupportedEncodingException;
    78import java.net.HttpURLConnection;
    89import java.security.NoSuchAlgorithmException;
     
    1314import org.apache.http.HttpEntity;
    1415import org.apache.http.HttpResponse;
     16import org.apache.http.client.ClientProtocolException;
    1517import org.apache.http.client.methods.HttpPost;
    1618import org.apache.http.entity.BufferedHttpEntity;
     
    3032import fr.mael.jiwigo.transverse.enumeration.MethodsEnum;
    3133import fr.mael.jiwigo.transverse.exception.FileAlreadyExistsException;
     34import fr.mael.jiwigo.transverse.exception.JiwigoException;
    3235import fr.mael.jiwigo.transverse.exception.ProxyAuthenticationException;
    3336import fr.mael.jiwigo.transverse.exception.WrongChunkSizeException;
     
    8487     * @throws ProxyAuthenticationException
    8588     */
    86     public List<Image> list(boolean refresh) throws IOException, ProxyAuthenticationException {
     89    public List<Image> list(boolean refresh) throws JiwigoException {
    8790        return listByCategory(null, refresh);
    8891    }
     
    9598     * @throws ProxyAuthenticationException
    9699     */
    97     public List<Image> listByCategory(Integer categoryId, boolean refresh) throws IOException,
    98             ProxyAuthenticationException {
     100    public List<Image> listByCategory(Integer categoryId, boolean refresh) throws JiwigoException {
    99101        if (refresh || cache.get(categoryId) == null) {
    100102            Document doc = null;
     
    133135     * @throws NoSuchAlgorithmException
    134136     * @throws WrongChunkSizeException
     137     * @throws JiwigoException
    135138     * @throws Exception
    136139     */
    137140    //TODO ne pas continuer si une des reponses precedentes est negative
    138141    public boolean create(Image image, Double chunkSize) throws FileAlreadyExistsException, IOException,
    139             ProxyAuthenticationException, NoSuchAlgorithmException, WrongChunkSizeException {
     142            ProxyAuthenticationException, NoSuchAlgorithmException, WrongChunkSizeException, JiwigoException {
    140143        //thumbnail converted to base64
    141144        BASE64Encoder base64 = new BASE64Encoder();
     
    200203     * @throws ProxyAuthenticationException
    201204     */
    202     public boolean addTags(Integer imageId, String tagId) throws IOException, ProxyAuthenticationException {
     205    public boolean addTags(Integer imageId, String tagId) throws JiwigoException {
    203206        Document doc = sessionManager.executeReturnDocument(MethodsEnum.SET_INFO.getLabel(), "image_id",
    204207                String.valueOf(imageId), "tag_ids", tagId);
     
    253256     * @throws ProxyAuthenticationException
    254257     */
    255     public List<Image> search(String searchString) throws IOException, ProxyAuthenticationException {
     258    public List<Image> search(String searchString) throws JiwigoException {
    256259        Document doc = sessionManager.executeReturnDocument(MethodsEnum.SEARCH.getLabel(), "query", searchString);
    257260        LOG.debug(Tools.documentToString(doc));
     
    272275    }
    273276
    274     public void addSimple(File file, Integer category, String title) throws IOException {
     277    public void addSimple(File file, Integer category, String title) throws JiwigoException {
    275278        HttpPost httpMethod = new HttpPost(((SessionManagerImpl) sessionManager).getUrl());
    276279
     
    288291            //          String substring = string.substring(string.indexOf("{"),
    289292            //                          string.lastIndexOf("}") + 1);
    290             multipartEntity.addPart("method", new StringBody("pwg.images.addSimple"));
    291             multipartEntity.addPart("category", new StringBody(category.toString()));
    292             multipartEntity.addPart("name", new StringBody(title));
     293            try {
     294                multipartEntity.addPart("method", new StringBody("pwg.images.addSimple"));
     295                multipartEntity.addPart("category", new StringBody(category.toString()));
     296                multipartEntity.addPart("name", new StringBody(title));
     297            } catch (UnsupportedEncodingException e) {
     298                throw new JiwigoException(e);
     299            }
    293300
    294301            //          StringBody contentBody = new StringBody(substring,
     
    300307        }
    301308
    302         //      httpMethod.setHeader(X_GALLERY_REQUEST_METHOD, requestMethod);
    303         HttpResponse response = ((SessionManagerImpl) sessionManager).getClient().execute(httpMethod);
    304         int responseStatusCode = response.getStatusLine().getStatusCode();
    305 
    306         switch (responseStatusCode) {
    307         case HttpURLConnection.HTTP_CREATED:
    308             break;
    309         case HttpURLConnection.HTTP_OK:
    310             break;
    311         case HttpURLConnection.HTTP_BAD_REQUEST:
    312             throw new IOException("status code was : " + responseStatusCode);
    313         case HttpURLConnection.HTTP_FORBIDDEN:
    314             throw new IOException("status code was : " + responseStatusCode);
    315         case HttpURLConnection.HTTP_NOT_FOUND:
    316             throw new IOException("status code was : " + responseStatusCode);
    317         default:
    318             throw new IOException("status code was : " + responseStatusCode);
    319         }
    320 
    321         HttpEntity resultEntity = response.getEntity();
    322         BufferedHttpEntity responseEntity = new BufferedHttpEntity(resultEntity);
    323 
    324         BufferedReader reader = new BufferedReader(new InputStreamReader(responseEntity.getContent()));
    325         String line;
     309        HttpResponse response;
    326310        StringBuilder sb = new StringBuilder();
    327311        try {
    328             while ((line = reader.readLine()) != null) {
    329                 sb.append(line);
    330                 sb.append("\n");
    331             }
    332         } finally {
    333             reader.close();
     312            response = ((SessionManagerImpl) sessionManager).getClient().execute(httpMethod);
     313
     314            int responseStatusCode = response.getStatusLine().getStatusCode();
     315
     316            switch (responseStatusCode) {
     317            case HttpURLConnection.HTTP_CREATED:
     318                break;
     319            case HttpURLConnection.HTTP_OK:
     320                break;
     321            case HttpURLConnection.HTTP_BAD_REQUEST:
     322                throw new JiwigoException("status code was : " + responseStatusCode);
     323            case HttpURLConnection.HTTP_FORBIDDEN:
     324                throw new JiwigoException("status code was : " + responseStatusCode);
     325            case HttpURLConnection.HTTP_NOT_FOUND:
     326                throw new JiwigoException("status code was : " + responseStatusCode);
     327            default:
     328                throw new JiwigoException("status code was : " + responseStatusCode);
     329            }
     330
     331            HttpEntity resultEntity = response.getEntity();
     332            BufferedHttpEntity responseEntity = new BufferedHttpEntity(resultEntity);
     333
     334            BufferedReader reader = new BufferedReader(new InputStreamReader(responseEntity.getContent()));
     335            String line;
     336
     337            try {
     338                while ((line = reader.readLine()) != null) {
     339                    sb.append(line);
     340                    sb.append("\n");
     341                }
     342            } finally {
     343                reader.close();
     344            }
     345        } catch (ClientProtocolException e) {
     346            throw new JiwigoException(e);
     347        } catch (IOException e) {
     348            throw new JiwigoException(e);
    334349        }
    335350        String stringResult = sb.toString();
  • extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/dao/impl/TagDaoImpl.java

    r9919 r10505  
    1818import fr.mael.jiwigo.transverse.enumeration.TagEnum;
    1919import fr.mael.jiwigo.transverse.exception.FileAlreadyExistsException;
     20import fr.mael.jiwigo.transverse.exception.JiwigoException;
    2021import fr.mael.jiwigo.transverse.exception.ProxyAuthenticationException;
    2122import fr.mael.jiwigo.transverse.session.SessionManager;
     
    5253     * @throws ProxyAuthenticationException
    5354     */
    54     public List<Tag> list() throws IOException, ProxyAuthenticationException {
     55    public List<Tag> list() throws JiwigoException {
    5556        Document doc = sessionManager.executeReturnDocument(MethodsEnum.TAGS_ADMIN_LIST.getLabel());
    5657        //      System.out.println(Outil.documentToString(doc));
     
    9091     * @throws ProxyAuthenticationException
    9192     */
    92     public boolean create(Tag tag) throws ProxyAuthenticationException {
     93    public boolean create(Tag tag) throws JiwigoException {
    9394        try {
    94             return Tools.checkOk(sessionManager.executeReturnDocument(MethodsEnum.ADD_TAG.getLabel(), "name", tag
    95                     .getName()));
    96         } catch (IOException e) {
     95            return Tools.checkOk(sessionManager.executeReturnDocument(MethodsEnum.ADD_TAG.getLabel(), "name",
     96                    tag.getName()));
     97        } catch (FileAlreadyExistsException e) {
    9798            LOG.error(Tools.getStackTrace(e));
    98         } catch (FileAlreadyExistsException e) {
    99             e.printStackTrace();
     99            throw new JiwigoException(e);
    100100        }
    101         return false;
    102101    }
    103102
     
    107106     * @return the tags list
    108107     * @throws IOException
    109      * @throws ProxyAuthenticationException
     108     * @throws JiwigoException
    110109     */
    111     public List<Tag> tagsForImage(Image image) throws IOException, ProxyAuthenticationException {
    112         Document doc = sessionManager.executeReturnDocument(MethodsEnum.GET_INFO.getLabel(), "image_id", String
    113                 .valueOf(image.getIdentifier()));
     110    public List<Tag> tagsForImage(Image image) throws JiwigoException {
     111        Document doc = sessionManager.executeReturnDocument(MethodsEnum.GET_INFO.getLabel(), "image_id",
     112                String.valueOf(image.getIdentifier()));
    114113        Element elementImage = (Element) doc.getDocumentElement().getElementsByTagName("image").item(0);
    115114        Element elementTag = (Element) elementImage.getElementsByTagName("tags").item(0);
  • extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/service/CategoryService.java

    r9919 r10505  
    55
    66import fr.mael.jiwigo.om.Category;
     7import fr.mael.jiwigo.transverse.exception.JiwigoException;
    78import fr.mael.jiwigo.transverse.exception.ProxyAuthenticationException;
    89
     
    1516     * @throws ProxyAuthenticationException
    1617     */
    17     public List<Category> list(boolean recursive) throws IOException, ProxyAuthenticationException;
     18    public List<Category> list(boolean recursive) throws JiwigoException;
    1819
    1920    /**
     
    2324     * @throws ProxyAuthenticationException
    2425     */
    25     public List<Category> makeTree() throws IOException, ProxyAuthenticationException;
     26    public List<Category> makeTree() throws JiwigoException;
    2627
    2728    /**
     
    3233     * @throws ProxyAuthenticationException
    3334     */
    34     public boolean create(String nom, Integer parent) throws ProxyAuthenticationException;
     35    public boolean create(String nom, Integer parent) throws JiwigoException;
    3536
    3637    /**
     
    4041     * @throws ProxyAuthenticationException
    4142     */
    42     public boolean create(String nom) throws ProxyAuthenticationException;
     43    public boolean create(String nom) throws JiwigoException;
    4344}
  • extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/service/CommentService.java

    r9919 r10505  
    55
    66import fr.mael.jiwigo.om.Comment;
     7import fr.mael.jiwigo.transverse.exception.JiwigoException;
    78import fr.mael.jiwigo.transverse.exception.ProxyAuthenticationException;
    89
     
    1516     * @throws ProxyAuthenticationException
    1617     */
    17     public List<Comment> list(Integer imageId) throws IOException, ProxyAuthenticationException;
     18    public List<Comment> list(Integer imageId) throws JiwigoException;
    1819
    1920    /**
     
    2627     * @throws ProxyAuthenticationException
    2728     */
    28     public boolean create(String content, Integer imageId, String auteur) throws IOException,
    29             ProxyAuthenticationException;
     29    public boolean create(String content, Integer imageId, String auteur) throws JiwigoException;
    3030
    3131}
  • extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/service/ImageService.java

    r10494 r10505  
    88import fr.mael.jiwigo.om.Image;
    99import fr.mael.jiwigo.transverse.exception.FileAlreadyExistsException;
     10import fr.mael.jiwigo.transverse.exception.JiwigoException;
    1011import fr.mael.jiwigo.transverse.exception.ProxyAuthenticationException;
    1112import fr.mael.jiwigo.transverse.exception.WrongChunkSizeException;
     
    2021     * @throws ProxyAuthenticationException
    2122     */
    22     public List<Image> listByCategory(Integer categoryId, boolean rafraichir) throws IOException,
    23             ProxyAuthenticationException;
     23    public List<Image> listByCategory(Integer categoryId, boolean rafraichir) throws JiwigoException;
    2424
    2525    /**
     
    3535     * @throws FileAlreadyExistsException
    3636     * @throws NoSuchAlgorithmException
     37     * @throws JiwigoException
    3738     * @throws Exception
    3839     */
    3940    public boolean create(String filePath, Integer idCategory, Integer originalWidth, Integer originalHeight,
    4041            Double chunckSize, Integer privacyLevel) throws IOException, NoSuchAlgorithmException,
    41             FileAlreadyExistsException, ProxyAuthenticationException, WrongChunkSizeException;
     42            FileAlreadyExistsException, ProxyAuthenticationException, WrongChunkSizeException,
     43            JiwigoException;
    4244
    4345    /**
     
    4951     * @throws ProxyAuthenticationException
    5052     */
    51     public boolean addTags(Image image, String tagId) throws IOException, ProxyAuthenticationException;
     53    public boolean addTags(Image image, String tagId) throws JiwigoException;
    5254
    5355    /**
     
    5860     * @throws ProxyAuthenticationException
    5961     */
    60     public List<Image> search(String queryString) throws IOException, ProxyAuthenticationException;
     62    public List<Image> search(String queryString) throws JiwigoException;
    6163
    6264    /**
     
    6870     * @param title
    6971     * @throws IOException
     72     * @throws JiwigoException
    7073     */
    71     public void addSimple(File file, Integer category, String title) throws IOException;
     74    public void addSimple(File file, Integer category, String title) throws JiwigoException;
    7275
    7376}
  • extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/service/TagService.java

    r9919 r10505  
    11package fr.mael.jiwigo.service;
    22
    3 import java.io.IOException;
    43import java.util.List;
    54
    65import fr.mael.jiwigo.om.Image;
    76import fr.mael.jiwigo.om.Tag;
    8 import fr.mael.jiwigo.transverse.exception.ProxyAuthenticationException;
     7import fr.mael.jiwigo.transverse.exception.JiwigoException;
    98
    109public interface TagService {
     
    1312     * Lists all tags
    1413     * @return le list of tags
    15      * @throws IOException
    16      * @throws ProxyAuthenticationException
     14     * @throws JiwigoException
    1715     */
    18     public List<Tag> list() throws IOException, ProxyAuthenticationException;
     16    public List<Tag> list() throws JiwigoException;
    1917
    2018    /**
     
    2220     * @param nom name of the tag
    2321     * @return true if the tag is created
    24      * @throws IOException
    25      * @throws ProxyAuthenticationException
     22     * @throws JiwigoException
    2623     */
    27     public boolean create(String nom) throws IOException, ProxyAuthenticationException;
     24    public boolean create(String nom) throws JiwigoException;
    2825
    2926    /**
     
    3128     * @param image the image to check
    3229     * @return the list of tags
    33      * @throws IOException
    34      * @throws ProxyAuthenticationException
     30     * @throws JiwigoException
    3531     */
    36     public List<Tag> tagsForImage(Image image) throws IOException, ProxyAuthenticationException;
     32    public List<Tag> tagsForImage(Image image) throws JiwigoException;
    3733}
  • extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/service/impl/CategoryServiceImpl.java

    r9919 r10505  
    1010import fr.mael.jiwigo.om.Category;
    1111import fr.mael.jiwigo.service.CategoryService;
     12import fr.mael.jiwigo.transverse.exception.JiwigoException;
    1213import fr.mael.jiwigo.transverse.exception.ProxyAuthenticationException;
    1314
     
    4344     * @throws ProxyAuthenticationException
    4445     */
    45     public List<Category> list(boolean recursive) throws IOException, ProxyAuthenticationException {
     46    public List<Category> list(boolean recursive) throws JiwigoException {
    4647        return dao.list(recursive);
    4748    }
     
    5253     * @throws IOException
    5354     * @throws ProxyAuthenticationException
     55     * @throws JiwigoException
    5456     */
    55     public List<Category> makeTree() throws IOException, ProxyAuthenticationException {
     57    public List<Category> makeTree() throws JiwigoException {
    5658        List<Category> list = dao.list(true);
    5759        for (Category category : list) {
     
    7880     * @throws ProxyAuthenticationException
    7981     */
    80     public boolean create(String nom, Integer parent) throws ProxyAuthenticationException {
     82    public boolean create(String nom, Integer parent) throws JiwigoException {
    8183        Category category = new Category();
    8284        category.setDirectParent(parent);
     
    9193     * @throws ProxyAuthenticationException
    9294     */
    93     public boolean create(String nom) throws ProxyAuthenticationException {
     95    public boolean create(String nom) throws JiwigoException {
    9496        Category category = new Category();
    9597        category.setName(nom);
  • extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/service/impl/CommentServiceImpl.java

    r9919 r10505  
    1010import fr.mael.jiwigo.om.Comment;
    1111import fr.mael.jiwigo.service.CommentService;
     12import fr.mael.jiwigo.transverse.exception.JiwigoException;
    1213import fr.mael.jiwigo.transverse.exception.ProxyAuthenticationException;
    1314
     
    4344     * @throws ProxyAuthenticationException
    4445     */
    45     public List<Comment> list(Integer imageId) throws IOException, ProxyAuthenticationException {
     46    public List<Comment> list(Integer imageId) throws JiwigoException {
    4647        return dao.list(imageId);
    4748    }
     
    5657     * @throws ProxyAuthenticationException
    5758     */
    58     public boolean create(String content, Integer imageId, String auteur) throws IOException,
    59             ProxyAuthenticationException {
     59    public boolean create(String content, Integer imageId, String auteur) throws JiwigoException {
    6060        Comment comment = new Comment();
    6161        comment.setContent(content);
  • extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/service/impl/ImageServiceImpl.java

    r10494 r10505  
    1313import fr.mael.jiwigo.service.ImageService;
    1414import fr.mael.jiwigo.transverse.exception.FileAlreadyExistsException;
     15import fr.mael.jiwigo.transverse.exception.JiwigoException;
    1516import fr.mael.jiwigo.transverse.exception.ProxyAuthenticationException;
    1617import fr.mael.jiwigo.transverse.exception.WrongChunkSizeException;
     
    5152     * @throws ProxyAuthenticationException
    5253     */
    53     public List<Image> listByCategory(Integer categoryId, boolean rafraichir) throws IOException,
    54             ProxyAuthenticationException {
     54    public List<Image> listByCategory(Integer categoryId, boolean rafraichir) throws JiwigoException {
    5555        return dao.listByCategory(categoryId, rafraichir);
    5656    }
     
    6868     * @throws FileAlreadyExistsException
    6969     * @throws NoSuchAlgorithmException
     70     * @throws JiwigoException
    7071     * @throws Exception
    7172     */
    7273    public boolean create(String filePath, Integer idCategory, Integer originalWidth, Integer originalHeight,
    7374            Double chunckSize, Integer privacyLevel) throws IOException, NoSuchAlgorithmException,
    74             FileAlreadyExistsException, ProxyAuthenticationException, WrongChunkSizeException {
     75            FileAlreadyExistsException, ProxyAuthenticationException, WrongChunkSizeException,
     76            JiwigoException {
    7577        File originalFile = new File(filePath);
    7678        //get the byte array of the original file, to keep metadata
     
    117119     * @throws ProxyAuthenticationException
    118120     */
    119     public boolean addTags(Image image, String tagId) throws IOException, ProxyAuthenticationException {
     121    public boolean addTags(Image image, String tagId) throws JiwigoException {
    120122        return dao.addTags(image.getIdentifier(), tagId);
    121123    }
     
    128130     * @throws ProxyAuthenticationException
    129131     */
    130     public List<Image> search(String queryString) throws IOException, ProxyAuthenticationException {
     132    public List<Image> search(String queryString) throws JiwigoException {
    131133        return dao.search(queryString);
    132134    }
     
    144146    }
    145147
    146     public void addSimple(File file, Integer category, String title) throws IOException {
     148    public void addSimple(File file, Integer category, String title) throws JiwigoException {
    147149        dao.addSimple(file, category, title);
    148150
  • extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/service/impl/TagServiceImpl.java

    r9919 r10505  
    1111import fr.mael.jiwigo.om.Tag;
    1212import fr.mael.jiwigo.service.TagService;
     13import fr.mael.jiwigo.transverse.exception.JiwigoException;
    1314import fr.mael.jiwigo.transverse.exception.ProxyAuthenticationException;
    1415
     
    4344     * @throws IOException
    4445     * @throws ProxyAuthenticationException
     46     * @throws JiwigoException
    4547     */
    46     public List<Tag> list() throws IOException, ProxyAuthenticationException {
     48    public List<Tag> list() throws JiwigoException {
    4749        return dao.list();
    4850    }
     
    5456     * @throws IOException
    5557     * @throws ProxyAuthenticationException
     58     * @throws JiwigoException
    5659     */
    57     public boolean create(String nom) throws IOException, ProxyAuthenticationException {
     60    public boolean create(String nom) throws JiwigoException {
    5861        Tag tag = new Tag();
    5962        tag.setName(nom);
     
    6770     * @throws IOException
    6871     * @throws ProxyAuthenticationException
     72     * @throws JiwigoException
    6973     */
    70     public List<Tag> tagsForImage(Image image) throws IOException, ProxyAuthenticationException {
     74    public List<Tag> tagsForImage(Image image) throws JiwigoException {
    7175        return dao.tagsForImage(image);
    7276    }
  • extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/transverse/session/SessionManager.java

    r9919 r10505  
    44import java.io.UnsupportedEncodingException;
    55
     6import org.apache.http.client.ClientProtocolException;
    67import org.w3c.dom.Document;
    78
     9import fr.mael.jiwigo.transverse.exception.JiwigoException;
    810import fr.mael.jiwigo.transverse.exception.ProxyAuthenticationException;
    911
     
    1315     *
    1416     * @return 0 if Ok, 1 if not Ok (reason not specified), 2 if proxy error
     17     * @throws JiwigoException
    1518     *
    1619     *
    1720     */
    18     public int processLogin();
     21    public int processLogin() throws JiwigoException;
    1922
    2023    /**
     
    2528     * @throws UnsupportedEncodingException
    2629     * @throws ProxyAuthenticationException
     30     * @throws JiwigoException
     31     * @throws IOException
     32     * @throws ClientProtocolException
    2733     */
    2834    public String executeReturnString(String methode, String... parametres) throws UnsupportedEncodingException,
    29             ProxyAuthenticationException;
     35            ProxyAuthenticationException, JiwigoException, ClientProtocolException, IOException;
    3036
    3137    /**
     
    3642     * @throws IOException
    3743     * @throws ProxyAuthenticationException
     44     * @throws JiwigoException
    3845     */
    39     public Document executeReturnDocument(String methode, String... parametres) throws IOException,
    40             ProxyAuthenticationException;
     46    public Document executeReturnDocument(String methode, String... parametres) throws JiwigoException;
    4147
    4248    /**
     
    4652     * @throws ProxyAuthenticationException
    4753     */
    48     public Document executeReturnDocument(String methode) throws ProxyAuthenticationException;
     54    public Document executeReturnDocument(String methode) throws JiwigoException;
    4955
    5056    /**
  • extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/transverse/session/impl/SessionManagerImpl.java

    r10494 r10505  
    66import java.util.ArrayList;
    77import java.util.List;
     8
     9import javax.xml.parsers.ParserConfigurationException;
    810
    911import org.apache.commons.lang.StringUtils;
     
    1315import org.apache.http.auth.AuthScope;
    1416import org.apache.http.auth.UsernamePasswordCredentials;
     17import org.apache.http.client.ClientProtocolException;
    1518import org.apache.http.client.entity.UrlEncodedFormEntity;
    1619import org.apache.http.client.methods.HttpPost;
     
    2124import org.slf4j.LoggerFactory;
    2225import org.w3c.dom.Document;
     26import org.xml.sax.SAXException;
    2327
    2428import fr.mael.jiwigo.transverse.enumeration.MethodsEnum;
     29import fr.mael.jiwigo.transverse.exception.FileAlreadyExistsException;
     30import fr.mael.jiwigo.transverse.exception.JiwigoException;
    2531import fr.mael.jiwigo.transverse.exception.ProxyAuthenticationException;
    2632import fr.mael.jiwigo.transverse.session.SessionManager;
     
    132138     *
    133139     * @return 0 if Ok, 1 if not Ok (reason not specified), 2 if proxy error
     140     * @throws JiwigoException
    134141     *
    135142     *
    136143     */
    137     public int processLogin() {
     144    public int processLogin() throws JiwigoException {
    138145        Document doc;
    139146        //configures the proxy
     
    152159            }
    153160        }
    154         //      try {
     161        doc = executeReturnDocument(MethodsEnum.LOGIN.getLabel(), "username", login, "password", password);
    155162        try {
    156             doc = executeReturnDocument(MethodsEnum.LOGIN.getLabel(), "username", login, "password", password);
    157163            return (Tools.checkOk(doc) ? 0 : 1);
    158         } catch (IOException e) {
    159             LOG.debug(Tools.getStackTrace(e));
    160             return 1;
    161         } catch (ProxyAuthenticationException e) {
    162             LOG.debug(Tools.getStackTrace(e));
    163             return 2;
    164         } catch (Exception e) {
    165             LOG.debug(Tools.getStackTrace(e));
    166             return 1;
     164        } catch (FileAlreadyExistsException e) {
     165            LOG.error(Tools.getStackTrace(e));
     166            throw new JiwigoException(e);
    167167        }
    168168
     
    174174     * @param parametres the parameters of the method. Must be even : the name of the parameter followed by its value
    175175     * @return the result
    176      * @throws UnsupportedEncodingException
    177176     * @throws ProxyAuthenticationException
    178      */
    179     public String executeReturnString(String methode, String... parametres) throws UnsupportedEncodingException,
    180             ProxyAuthenticationException {
     177     * @throws JiwigoException
     178     * @throws IOException
     179     * @throws ClientProtocolException
     180     */
     181    public String executeReturnString(String methode, String... parametres) throws ProxyAuthenticationException,
     182            JiwigoException, ClientProtocolException, IOException {
    181183        if (parametres.length % 2 != 0 && !(parametres == null)) {
    182             try {
    183                 throw new Exception("Le nombre de parametres doit etre pair");
    184             } catch (Exception e) {
    185                 LOG.error(Tools.getStackTrace(e));
    186                 return null;
    187             }
     184            LOG.error("parameters number should be even");
     185            throw new IllegalArgumentException("parameters number should be even");
    188186        }
    189187        HttpPost method = new HttpPost(url);
     
    195193        method.setEntity(new UrlEncodedFormEntity(nameValuePairs));
    196194        method.setHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");
    197         try {
    198             HttpResponse response = client.execute(method);
    199             if (response.getStatusLine().getStatusCode() == 407) {
    200                 throw new ProxyAuthenticationException("Error while trying to auth on the proxy");
    201             }
    202             InputStream inputStream = response.getEntity().getContent();
    203             String toReturn = Tools.readInputStreamAsString(inputStream);
    204             return toReturn;
    205         } catch (IOException e) {
    206 
    207         }
    208         return null;
     195        HttpResponse response = client.execute(method);
     196        int statusCode = response.getStatusLine().getStatusCode();
     197        InputStream inputStream = response.getEntity().getContent();
     198        String toReturn = Tools.readInputStreamAsString(inputStream);
     199        if (statusCode == 407) {
     200            throw new ProxyAuthenticationException("Error while trying to auth on the proxy");
     201        } else if (statusCode >= 400) {
     202            throw new JiwigoException("Piwigo server returned an error code " + toReturn);
     203        }
     204
     205        return toReturn;
    209206
    210207    }
     
    217214     * @throws IOException
    218215     * @throws ProxyAuthenticationException
    219      */
    220     public Document executeReturnDocument(String methode, String... parametres) throws IOException,
    221             ProxyAuthenticationException {
     216     * @throws JiwigoException
     217     */
     218    public Document executeReturnDocument(String methode, String... parametres) throws JiwigoException {
    222219        try {
    223220            String returnedString = executeReturnString(methode, parametres);
    224221            return Tools.stringToDocument(returnedString);
    225         } catch (Exception e) {
    226             // TODO Auto-generated catch block
    227             LOG.error(Tools.getStackTrace(e));
    228         }
    229         return null;
    230 
     222        } catch (ProxyAuthenticationException e) {
     223            LOG.error(Tools.getStackTrace(e));
     224            throw new JiwigoException(e);
     225        } catch (SAXException e) {
     226            LOG.error(Tools.getStackTrace(e));
     227            throw new JiwigoException(e);
     228        } catch (ParserConfigurationException e) {
     229            LOG.error(Tools.getStackTrace(e));
     230            throw new JiwigoException(e);
     231        } catch (UnsupportedEncodingException e) {
     232            LOG.error(Tools.getStackTrace(e));
     233            throw new JiwigoException(e);
     234        } catch (IOException e) {
     235            LOG.error(Tools.getStackTrace(e));
     236            throw new JiwigoException(e);
     237        }
    231238    }
    232239
     
    235242     * @param methode the method to execute
    236243     * @return the result
    237      * @throws ProxyAuthenticationException
    238      */
    239     public Document executeReturnDocument(String methode) throws ProxyAuthenticationException {
     244     * @throws JiwigoException
     245     */
     246    public Document executeReturnDocument(String methode) throws JiwigoException {
    240247        try {
    241248            return Tools.stringToDocument(executeReturnString(methode));
    242249        } catch (Exception e) {
    243             // TODO Auto-generated catch block
    244             LOG.error(Tools.getStackTrace(e));
    245         }
    246         return null;
    247 
     250            LOG.error(Tools.getStackTrace(e));
     251            throw new JiwigoException(e);
     252        }
    248253    }
    249254
  • extensions/jiwigo-ws-api/src/test/java/fr/mael/jiwigo/service/CategoryServiceTest.java

    r10089 r10505  
    11package fr.mael.jiwigo.service;
    22
    3 import java.io.IOException;
    43import java.util.Date;
    54
     
    1110import fr.mael.jiwigo.dao.impl.CategoryDaoImpl;
    1211import fr.mael.jiwigo.service.impl.CategoryServiceImpl;
     12import fr.mael.jiwigo.transverse.exception.JiwigoException;
    1313import fr.mael.jiwigo.transverse.exception.ProxyAuthenticationException;
    1414import fr.mael.jiwigo.transverse.session.SessionManager;
     
    1616
    1717public class CategoryServiceTest {
    18         private SessionManager sessionManager;
     18    private SessionManager sessionManager;
    1919
    20         @Before
    21         public void setUp() {
    22                 sessionManager = new SessionManagerImpl("mael", "motdepasse", "http://mael.piwigo.com", "Unit Test");
    23                 sessionManager.processLogin();
    24         }
     20    @Before
     21    public void setUp() throws JiwigoException {
     22        sessionManager = new SessionManagerImpl("mael", "motdepasse", "http://mael.piwigo.com", "Unit Test");
     23        sessionManager.processLogin();
     24    }
    2525
    26         /**
    27          * Test of the list method
    28          *
    29          * @throws ProxyAuthenticationException
    30          */
    31         @Test
    32         public void ListerTest() throws ProxyAuthenticationException {
    33                 try {
    34                         CategoryDaoImpl categaryDao = new CategoryDaoImpl();
    35                         categaryDao.setSessionManager(sessionManager);
    36                         categaryDao.list(true);
    37                         categaryDao.list(false);
    38                 } catch (IOException e) {
    39                         e.printStackTrace();
    40                 }
    41         }
     26    /**
     27     * Test of the list method
     28     *
     29     * @throws ProxyAuthenticationException
     30     */
     31    @Test
     32    public void ListerTest() throws JiwigoException {
     33        CategoryDaoImpl categaryDao = new CategoryDaoImpl();
     34        categaryDao.setSessionManager(sessionManager);
     35        categaryDao.list(true);
     36        categaryDao.list(false);
     37    }
    4238
    43         /**
    44         * Test of the creation method
    45         *
    46         * @throws ProxyAuthenticationException
    47         */
    48         @Test
    49         public void creerTest() throws ProxyAuthenticationException {
    50                 Date date = new Date();
    51                 CategoryServiceImpl categoryService = new CategoryServiceImpl();
    52                 CategoryDaoImpl dao = new CategoryDaoImpl();
    53                 dao.setSessionManager(sessionManager);
    54                 categoryService.setDao(dao);
    55                 Assert.assertSame(true, categoryService.create("Category" + date.getTime()));
    56         }
     39    /**
     40    * Test of the creation method
     41    *
     42    * @throws ProxyAuthenticationException
     43    */
     44    @Test
     45    public void creerTest() throws JiwigoException {
     46        Date date = new Date();
     47        CategoryServiceImpl categoryService = new CategoryServiceImpl();
     48        CategoryDaoImpl dao = new CategoryDaoImpl();
     49        dao.setSessionManager(sessionManager);
     50        categoryService.setDao(dao);
     51        Assert.assertSame(true, categoryService.create("Category" + date.getTime()));
     52    }
    5753
    5854}
  • extensions/jiwigo-ws-api/src/test/java/fr/mael/jiwigo/service/ServicesTest.java

    r10494 r10505  
    22
    33import java.io.File;
    4 import java.io.IOException;
    54import java.util.List;
    65
     
    1615import fr.mael.jiwigo.service.impl.CategoryServiceImpl;
    1716import fr.mael.jiwigo.service.impl.ImageServiceImpl;
     17import fr.mael.jiwigo.transverse.exception.JiwigoException;
    1818import fr.mael.jiwigo.transverse.session.SessionManager;
    1919import fr.mael.jiwigo.transverse.session.impl.SessionManagerImpl;
     
    2424
    2525    @Before
    26     public void setUp() {
     26    public void setUp() throws JiwigoException {
    2727        sessionManager = new SessionManagerImpl("mael", "motdepasse", "http://mael.piwigo.com", "Unit Test");
    2828        sessionManager.processLogin();
     
    7171        try {
    7272            imageService.addSimple(imageFile, categoryTest, title);
    73         } catch (IOException e) {
     73        } catch (JiwigoException e) {
    7474            Assert.fail("An exception was thrown while trying to send the pictures" + e.getMessage());
    7575        }
  • extensions/jiwigo-ws-api/src/test/java/fr/mael/jiwigo/service/TagServiceTest.java

    r10089 r10505  
    1212import fr.mael.jiwigo.dao.impl.TagDaoImpl;
    1313import fr.mael.jiwigo.service.impl.TagServiceImpl;
     14import fr.mael.jiwigo.transverse.exception.JiwigoException;
    1415import fr.mael.jiwigo.transverse.exception.ProxyAuthenticationException;
    1516import fr.mael.jiwigo.transverse.session.SessionManager;
     
    1819public class TagServiceTest {
    1920
    20         private SessionManager sessionManager;
     21    private SessionManager sessionManager;
    2122
    22         @Before
    23         public void setUp() {
    24                 sessionManager = new SessionManagerImpl("mael", "motdepasse", "http://mael.piwigo.com", "Unit Test");
    25                 sessionManager.processLogin();
    26         }
     23    @Before
     24    public void setUp() throws JiwigoException {
     25        sessionManager = new SessionManagerImpl("mael", "motdepasse", "http://mael.piwigo.com", "Unit Test");
     26        sessionManager.processLogin();
     27    }
    2728
    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         }
     29    /**
     30     * Test of the listing method
     31     * @throws JiwigoException
     32     *
     33     * @throws ProxyAuthenticationException
     34     */
     35    @Test
     36    @Ignore
     37    public void listTest() throws JiwigoException {
     38        TagDaoImpl tagDao = new TagDaoImpl();
     39        tagDao.setSessionManager(sessionManager);
     40        // TODO something weird happens here,
     41        // java.lang.ClassCastException: com.sun.org.apache.xerces.internal.dom.DeepNodeListImpl cannot be cast to
     42        // org.w3c.dom.Element
     43        // at fr.mael.jiwigo.dao.impl.TagDaoImpl.list(TagDaoImpl.java:58)
     44        tagDao.list();
     45    }
    4846
    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         }
     47    /**
     48     * Test of the creation method
     49     * @throws JiwigoException
     50     *
     51     * @throws ProxyAuthenticationException
     52     * @throws IOException
     53     */
     54    @Test
     55    public void createTest() throws JiwigoException {
     56        Date date = new Date();
     57        TagServiceImpl tagService = new TagServiceImpl();
     58        TagDaoImpl tagDao = new TagDaoImpl();
     59        tagDao.setSessionManager(sessionManager);
     60        tagService.setDao(tagDao);
     61        Assert.assertSame(true, tagService.create("Tag" + date.getTime()));
     62    }
    6463
    6564}
Note: See TracChangeset for help on using the changeset viewer.