Package org.apache.agila.services

Source Code of org.apache.agila.services.NotificationServiceTestCase

/*
* Copyright 2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*     http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.agila.services;

import junit.framework.TestCase;
import org.apache.agila.impl.NotificationImpl;
import org.apache.agila.impl.memory.NotificationServiceImpl;
import org.apache.agila.services.user.UserID;
import org.apache.agila.services.notification.NotificationID;
import org.apache.agila.services.notification.Notification;

import java.util.List;

/**
*
* @author <a href="mailto:geir@gluecode.com">Geir Magnusson Jr.</a>
* @version $Id: NotificationServiceTestCase.java 38 2005-06-01 19:39:54Z chirino $
*/
public class NotificationServiceTestCase extends TestCase {



    public void testSimple() throws Exception {

        NotificationServiceImpl nsi = new NotificationServiceImpl();

        NotificationID id = nsi.notify(new UserID(1), "test message");

        assertTrue(id != null);
        assertTrue(id.getID() == 1);

        Notification impl =  nsi.getNotification(id);

        assertTrue(impl != null);
        assertTrue(impl instanceof NotificationImpl);
        assertTrue(impl.getMessage().equals("test message"));
        assertTrue(impl.getUserID().equals(new UserID(1)));
        assertTrue(impl.getStatus() == Notification.STATUS_ACTIVE);

        List l = nsi.getNotificationsForUser(new UserID(1));

        assertTrue(l != null);
        assertTrue(l.size() == 1);

    }
}
TOP

Related Classes of org.apache.agila.services.NotificationServiceTestCase

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.