⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 communicatortest.java

📁 Rapla是一个灵活的多用户资源管理系统。它提供的一些功能有:日历GUI
💻 JAVA
字号:
package org.rapla;

import java.util.Date;

import org.apache.avalon.framework.configuration.DefaultConfiguration;
import org.rapla.entities.configuration.Preferences;
import org.rapla.entities.domain.Allocatable;
import org.rapla.entities.domain.Appointment;
import org.rapla.entities.domain.Reservation;
import org.rapla.entities.dynamictype.ClassificationFilter;
import org.rapla.entities.dynamictype.DynamicType;
import org.rapla.facade.ClientFacade;
import org.rapla.framework.RaplaContext;
import org.rapla.storage.dbrm.RemoteOperator;

public class CommunicatorTest extends ServletTestBase
{
    
    public CommunicatorTest( String name )
    {
        super( name );
    }

  
    public void testLargeform() throws Exception
    {
        ClientFacade facade = (ClientFacade)getContext().lookup(ClientFacade.ROLE + "/remote-facade-3");
        facade.login("homer","duffs".toCharArray());
        Allocatable alloc = facade.newResource();
        StringBuffer buf = new StringBuffer();
        int stringsize = 100000;
        for (int i=0;i< stringsize;i++)
        {
            buf.append( "xxxxxxxxxx");
        }
        String verylongname = buf.toString();
        alloc.getClassification().setValue("name", verylongname);
        facade.store( alloc);
    }
    
    
    public void testClient() throws Exception
    {
       ClientFacade facade = (ClientFacade)getContext().lookup(ClientFacade.ROLE + "/remote-facade-3");
       boolean success = facade.login("admin","test".toCharArray());
       assertFalse( "Login should fail",success ); 
       facade.login("homer","duffs".toCharArray());
       try 
       {
           Preferences preferences = (Preferences)facade.edit( facade.getPreferences( null));
           preferences.putEntry("test-entry", "test-value");
           
           facade.store( preferences);
           preferences = (Preferences)facade.edit( facade.getPreferences( null));
           preferences.putEntry("test-entry", "test-value");
           facade.store( preferences);

           Allocatable[] allocatables = facade.getAllocatables();
           assertTrue( allocatables.length > 0);
           Reservation[] events = facade.getReservations( new Allocatable[] {allocatables[0]}, null,null);
           assertTrue( events.length > 0);
           
           Reservation r = events[0];
           Reservation editable = (Reservation)facade.edit( r);
           facade.store( editable );
           
           Reservation newEvent = facade.newReservation();
           Appointment newApp = facade.newAppointment( new Date(), new Date());
           newEvent.addAppointment( newApp );
           newEvent.getClassification().setValue("name","Test Reservation");
           newEvent.addAllocatable( allocatables[0]);
           
           facade.store( newEvent );
           facade.remove( newEvent);
       }
       finally
       {
           facade.logout();
       }
    }

    public void testUmlaute() throws Exception
    {
        ClientFacade facade = (ClientFacade)getContext().lookup(ClientFacade.ROLE + "/remote-facade-3");
        facade.login("homer","duffs".toCharArray());
        Allocatable alloc = facade.newResource();
        String typeName = alloc.getClassification().getType().getElementKey();
        String nameWithUmlaute = "苣贮漩

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -