Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/jdk/javax/management/relation/RelationNotificationSourceTest.java
41149 views
1
/*
2
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation.
8
*
9
* This code is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12
* version 2 for more details (a copy is included in the LICENSE file that
13
* accompanied this code).
14
*
15
* You should have received a copy of the GNU General Public License version
16
* 2 along with this work; if not, write to the Free Software Foundation,
17
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18
*
19
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20
* or visit www.oracle.com if you need additional information or have any
21
* questions.
22
*/
23
24
/*
25
* @test
26
* @bug 4892674
27
* @summary Test that RelationNotification can be constructed with ObjectName.
28
* @author Eamonn McManus
29
*
30
* @run clean RelationNotificationSourceTest
31
* @run build RelationNotificationSourceTest
32
* @run main RelationNotificationSourceTest
33
*/
34
35
import java.util.Collections;
36
import javax.management.*;
37
import javax.management.relation.*;
38
import static javax.management.relation.RelationNotification.*;
39
40
public class RelationNotificationSourceTest {
41
public static void main(String[] args) throws Exception {
42
ObjectName name1 = new ObjectName("a:n=1");
43
ObjectName name2 = new ObjectName("a:n=2");
44
ObjectName name = new ObjectName("a:b=c");
45
Notification n1 =
46
new RelationNotification(RELATION_BASIC_REMOVAL,
47
name,
48
1234L,
49
System.currentTimeMillis(),
50
"message",
51
"id",
52
"typeName",
53
name1,
54
Collections.singletonList(name2));
55
if (!name.equals(n1.getSource()))
56
throw new Exception("FAILED: source is " + n1.getSource());
57
Notification n2 =
58
new RelationNotification(RELATION_BASIC_UPDATE,
59
name,
60
1234L,
61
System.currentTimeMillis(),
62
"message",
63
"id",
64
"typeName",
65
name1,
66
"role",
67
Collections.singletonList(name2),
68
Collections.singletonList(name2));
69
if (!name.equals(n2.getSource()))
70
throw new Exception("FAILED: source is " + n2.getSource());
71
System.out.println("TEST PASSED");
72
}
73
}
74
75