~ubuntu-branches/ubuntu/quantal/zeroc-ice/quantal

« back to all changes in this revision

Viewing changes to java/test/Ice/exceptions/Server.java

  • Committer: Bazaar Package Importer
  • Author(s): Cleto Martin Angelina
  • Date: 2011-04-25 18:44:24 UTC
  • mfrom: (6.1.14 sid)
  • Revision ID: james.westby@ubuntu.com-20110425184424-sep9i9euu434vq4c
Tags: 3.4.1-7
* Bug fix: "libdb5.1-java.jar was renamed to db.jar", thanks to Ondřej
  Surý (Closes: #623555).
* Bug fix: "causes noise in php5", thanks to Jayen Ashar (Closes:
  #623533).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
// **********************************************************************
2
2
//
3
 
// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved.
 
3
// Copyright (c) 2003-2010 ZeroC, Inc. All rights reserved.
4
4
//
5
5
// This copy of Ice is licensed to you under the terms described in the
6
6
// ICE_LICENSE file included in this distribution.
7
7
//
8
8
// **********************************************************************
9
9
 
10
 
public class Server
 
10
package test.Ice.exceptions;
 
11
 
 
12
public class Server extends test.Util.Application
11
13
{
12
 
    private static int
13
 
    run(String[] args, Ice.Communicator communicator)
 
14
    public int run(String[] args)
14
15
    {
15
 
        Ice.Properties properties = communicator.getProperties();
16
 
        // We don't need to disable warnings, because we have a dummy logger.
17
 
        //properties.setProperty("Ice.Warn.Dispatch", "0");
18
 
        properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000:udp");
 
16
        Ice.Communicator communicator = communicator();
19
17
        Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
20
 
        Ice.Object object = new ThrowerI(adapter);
 
18
        Ice.Object object = new ThrowerI();
21
19
        adapter.add(object, communicator.stringToIdentity("thrower"));
22
20
        adapter.activate();
23
 
        communicator.waitForShutdown();
24
 
        return 0;
25
 
    }
26
 
 
27
 
    public static void
28
 
    main(String[] args)
29
 
    {
30
 
        int status = 0;
31
 
        Ice.Communicator communicator = null;
32
 
 
33
 
        try
34
 
        {
35
 
            //
36
 
            // For this test, we need a dummy logger, otherwise the
37
 
            // assertion test will print an error message.
38
 
            //
39
 
            Ice.InitializationData initData = new Ice.InitializationData();
40
 
            initData.logger = new DummyLogger();
41
 
 
42
 
            communicator = Ice.Util.initialize(args, initData);
43
 
            status = run(args, communicator);
44
 
        }
45
 
        catch(Exception ex)
46
 
        {
47
 
            ex.printStackTrace();
48
 
            status = 1;
49
 
        }
50
 
 
51
 
        if(communicator != null)
52
 
        {
53
 
            try
54
 
            {
55
 
                communicator.destroy();
56
 
            }
57
 
            catch(Ice.LocalException ex)
58
 
            {
59
 
                ex.printStackTrace();
60
 
                status = 1;
61
 
            }
62
 
        }
63
 
 
 
21
        return WAIT;
 
22
    }
 
23
 
 
24
    protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
 
25
    {
 
26
        Ice.InitializationData initData = new Ice.InitializationData();
 
27
        initData.properties = Ice.Util.createProperties(argsH);
 
28
        initData.logger = new DummyLogger();
 
29
 
 
30
        initData.properties.setProperty("Ice.Package.Test", "test.Ice.exceptions");
 
31
        initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
 
32
        // We don't need to disable warnings, because we have a dummy logger.
 
33
        // properties.setProperty("Ice.Warn.Dispatch", "0");
 
34
 
 
35
        return initData;
 
36
    }
 
37
 
 
38
    public static void main(String[] args)
 
39
    {
 
40
        Server app = new Server();
 
41
        int result = app.main("Server", args);
64
42
        System.gc();
65
 
        System.exit(status);
 
43
        System.exit(result);
66
44
    }
67
45
}