~ubuntu-branches/ubuntu/quantal/jetty/quantal

« back to all changes in this revision

Viewing changes to contrib/jetty-openspaces/sessions/src/test/java/org/mortbay/jetty/opensources/GigaIntegrationTest.java

  • Committer: Bazaar Package Importer
  • Author(s): Ludovic Claude
  • Date: 2009-09-07 00:22:20 UTC
  • mfrom: (1.1.5 upstream) (2.1.4 sid)
  • Revision ID: james.westby@ubuntu.com-20090907002220-8w7luxa3m4otve4g
Tags: 6.1.20-2
* Move documentation to /usr/share/doc/libjetty-java
* Better postinst and postrm scripts, aligned with tomcat6 scripts:
   - postinst: user jetty is created with its own group
   - postrm: better cleanup of temporary data,
     thourough remove and purge of data
* debian/changelog:
  - fix suggest for package libjetty-java-doc, add libjetty-java-doc
    to the list of Suggests for libjetty-java
  - add libjetty-extra to the list of Suggests for package jetty.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// ========================================================================
 
2
// Copyright 2008 Mort Bay Consulting Pty. Ltd.
 
3
// ------------------------------------------------------------------------
 
4
// Licensed under the Apache License, Version 2.0 (the "License");
 
5
// you may not use this file except in compliance with the License.
 
6
// You may obtain a copy of the License at 
 
7
// http://www.apache.org/licenses/LICENSE-2.0
 
8
// Unless required by applicable law or agreed to in writing, software
 
9
// distributed under the License is distributed on an "AS IS" BASIS,
 
10
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
11
// See the License for the specific language governing permissions and
 
12
// limitations under the License.
 
13
// ========================================================================
 
14
 
 
15
 
 
16
package org.mortbay.jetty.opensources;
 
17
 
 
18
 
 
19
 
 
20
import org.mortbay.jetty.openspaces.GigaSessionIdManager;
 
21
import org.mortbay.jetty.openspaces.GigaSessionManager;
 
22
import org.mortbay.jetty.servlet.AbstractSessionTest;
 
23
import org.mortbay.jetty.servlet.SessionTestServer;
 
24
import org.openspaces.core.GigaSpace;
 
25
import org.openspaces.core.GigaSpaceConfigurer;
 
26
import org.openspaces.core.space.UrlSpaceConfigurer;
 
27
 
 
28
 
 
29
 
 
30
public class GigaIntegrationTest extends AbstractSessionTest
 
31
{
 
32
 
 
33
    private GigaSpace _space;
 
34
    
 
35
    
 
36
    public class GigaSessionTestServer extends SessionTestServer
 
37
    {
 
38
        
 
39
        public GigaSessionTestServer(int port, String workerName)
 
40
        {
 
41
            super(port, workerName);
 
42
        }
 
43
        
 
44
        public void configureEnvironment ()
 
45
        {
 
46
            UrlSpaceConfigurer uscA = new UrlSpaceConfigurer("/./space"); 
 
47
            GigaSpaceConfigurer gigaSpaceConfigurer = new GigaSpaceConfigurer(uscA.space());
 
48
            _space = gigaSpaceConfigurer.gigaSpace();
 
49
        }
 
50
 
 
51
        public void configureIdManager()
 
52
        {
 
53
            GigaSessionIdManager idMgr = new GigaSessionIdManager(this);
 
54
            idMgr.setWorkerName(_workerName);
 
55
            idMgr.setSpace(_space);
 
56
            _sessionIdMgr = idMgr;
 
57
        }
 
58
 
 
59
        public void configureSessionManager1()
 
60
        {
 
61
            GigaSessionManager sessionMgr1 = new GigaSessionManager();
 
62
            sessionMgr1.setIdManager(_sessionIdMgr);
 
63
            sessionMgr1.setSpace(_space);
 
64
            _sessionMgr1 = sessionMgr1;
 
65
        }
 
66
 
 
67
        public void configureSessionManager2()
 
68
        {
 
69
            GigaSessionManager sessionMgr2 = new GigaSessionManager();
 
70
            sessionMgr2.setIdManager(_sessionIdMgr);
 
71
            sessionMgr2.setSpace(_space);
 
72
            _sessionMgr2 = sessionMgr2;
 
73
        }    
 
74
    }
 
75
    
 
76
    
 
77
 
 
78
 
 
79
    public SessionTestServer newServer1()
 
80
    {
 
81
        return new GigaSessionTestServer(Integer.parseInt(__port1), "fred");
 
82
    }
 
83
 
 
84
 
 
85
    public SessionTestServer newServer2()
 
86
    {
 
87
        return new GigaSessionTestServer(Integer.parseInt(__port2), "mabel");
 
88
    }
 
89
}