33 import java.rmi.registry.Registry; |
33 import java.rmi.registry.Registry; |
34 import java.security.Security; |
34 import java.security.Security; |
35 import java.util.Objects; |
35 import java.util.Objects; |
36 |
36 |
37 import org.testng.Assert; |
37 import org.testng.Assert; |
38 import org.testng.TestNG; |
|
39 import org.testng.annotations.BeforeSuite; |
38 import org.testng.annotations.BeforeSuite; |
40 import org.testng.annotations.DataProvider; |
39 import org.testng.annotations.DataProvider; |
41 import org.testng.annotations.Test; |
40 import org.testng.annotations.Test; |
42 |
41 |
43 /* |
42 /* |
63 private static int port; |
62 private static int port; |
64 private static Registry registry; |
63 private static Registry registry; |
65 |
64 |
66 static final int REGISTRY_MAX_DEPTH = 20; |
65 static final int REGISTRY_MAX_DEPTH = 20; |
67 |
66 |
68 static final int REGISTRY_MAX_ARRAY = 10000; |
67 static final int REGISTRY_MAX_ARRAY = 1_000_000; |
69 |
68 |
70 static final String registryFilter = |
69 static final String registryFilter = |
71 System.getProperty("sun.rmi.registry.registryFilter", |
70 System.getProperty("sun.rmi.registry.registryFilter", |
72 Security.getProperty("sun.rmi.registry.registryFilter")); |
71 Security.getProperty("sun.rmi.registry.registryFilter")); |
73 |
72 |
74 @DataProvider(name = "bindAllowed") |
73 /** |
75 static Object[][] bindAllowedObjects() { |
74 * Data RMI Registry bind test. |
76 Object[][] objects = { |
|
77 }; |
|
78 return objects; |
|
79 } |
|
80 |
|
81 /** |
|
82 * Data RMI Regiry bind test. |
|
83 * - name |
75 * - name |
84 * - Object |
76 * - Object |
85 * - true/false if object is blacklisted by a filter (implicit or explicit) |
77 * - true/false if object is blacklisted by a filter (implicit or explicit) |
86 * @return array of test data |
78 * @return array of test data |
87 */ |
79 */ |
88 @DataProvider(name = "bindData") |
80 @DataProvider(name = "bindData") |
89 static Object[][] bindObjects() { |
81 static Object[][] bindObjects() { |
90 Object[][] data = { |
82 Object[][] data = { |
91 { "byte[max]", new XX(new byte[REGISTRY_MAX_ARRAY]), false }, |
83 { "byte[max]", new XX(new byte[REGISTRY_MAX_ARRAY]), false }, |
92 { "String", new XX("now is the time"), false}, |
84 { "String", new XX("now is the time"), false}, |
93 { "String[]", new XX(new String[3]), false}, |
85 { "String[3]", new XX(new String[3]), false}, |
94 { "Long[4]", new XX(new Long[4]), registryFilter != null }, |
86 { "Long[4]", new XX(new Long[4]), false }, |
|
87 { "Object[REGISTRY_MAX_ARRAY]", new XX(new Object[REGISTRY_MAX_ARRAY]), false }, |
95 { "rej-byte[toobig]", new XX(new byte[REGISTRY_MAX_ARRAY + 1]), true }, |
88 { "rej-byte[toobig]", new XX(new byte[REGISTRY_MAX_ARRAY + 1]), true }, |
|
89 { "rej-Object[toobig]", new XX(new Object[REGISTRY_MAX_ARRAY + 1]), true }, |
96 { "rej-MarshalledObject", createMarshalledObject(), true }, |
90 { "rej-MarshalledObject", createMarshalledObject(), true }, |
97 { "rej-RejectableClass", new RejectableClass(), registryFilter != null}, |
91 { "rej-RejectableClass", new RejectableClass(), registryFilter != null}, |
98 }; |
92 }; |
99 return data; |
93 return data; |
100 } |
94 } |