summaryrefslogtreecommitdiff
path: root/java-compat/test/src/main/java/test/Ice/invoke/Client.java
blob: d3988861f9354b3dd137334d6d9fe7f4e3324f85 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// **********************************************************************
//
// Copyright (c) 2003-present ZeroC, Inc. All rights reserved.
//
// **********************************************************************

package test.Ice.invoke;

import test.Ice.invoke.Test.MyClassPrx;

public class Client extends test.TestHelper
{
    public void run(String[] args)
    {
        Ice.Properties properties = createTestProperties(args);
        properties.setProperty("Ice.Package.Test", "test.Ice.invoke");
        try(Ice.Communicator communicator = initialize(properties))
        {
            MyClassPrx myClass = AllTests.allTests(this);

            //
            // Use reflection to load lambda.AllTests as that is only supported with Java >= 1.8
            //
            try
            {
                Class<?> cls = IceInternal.Util.findClass("test.Ice.invoke.lambda.AllTests", null);
                if(cls != null)
                {
                    java.lang.reflect.Method allTests =
                        cls.getDeclaredMethod("allTests", new Class<?>[]{ test.TestHelper.class });
                    allTests.invoke(null, this);
                }
            }
            catch(Exception ex)
            {
                throw new RuntimeException(ex);
            }
            myClass.shutdown();
        }
    }
}