Test status quo for @Repeatable annotation support in AnnotationJmxAttributeSource
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2024 the original author or authors.
|
||||
* Copyright 2002-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.springframework.jmx.export.annotation;
|
||||
|
||||
import javax.management.MBeanNotificationInfo;
|
||||
import javax.management.modelmbean.ModelMBeanAttributeInfo;
|
||||
import javax.management.modelmbean.ModelMBeanInfo;
|
||||
import javax.management.modelmbean.ModelMBeanOperationInfo;
|
||||
@@ -36,6 +37,17 @@ class AnnotationMetadataAssemblerTests extends AbstractMetadataAssemblerTests {
|
||||
|
||||
private static final String OBJECT_NAME = "bean:name=testBean4";
|
||||
|
||||
@Test
|
||||
@Override
|
||||
protected void notificationMetadata() throws Exception {
|
||||
ModelMBeanInfo info = (ModelMBeanInfo) getMBeanInfo();
|
||||
MBeanNotificationInfo[] notifications = info.getNotifications();
|
||||
assertThat(notifications).as("Incorrect number of notifications").hasSize(2);
|
||||
assertThat(notifications[0].getName()).as("Incorrect notification name").isEqualTo("My Notification 1");
|
||||
assertThat(notifications[0].getNotifTypes()).as("notification types").containsExactly("type.foo", "type.bar");
|
||||
assertThat(notifications[1].getName()).as("Incorrect notification name").isEqualTo("My Notification 2");
|
||||
assertThat(notifications[1].getNotifTypes()).as("notification types").containsExactly("type.enigma");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testAttributeFromInterface() throws Exception {
|
||||
@@ -111,4 +123,5 @@ class AnnotationMetadataAssemblerTests extends AbstractMetadataAssemblerTests {
|
||||
protected int getExpectedOperationCount() {
|
||||
return super.getExpectedOperationCount() + 4;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2024 the original author or authors.
|
||||
* Copyright 2002-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -25,10 +25,11 @@ import org.springframework.stereotype.Service;
|
||||
* @author Juergen Hoeller
|
||||
*/
|
||||
@Service("testBean")
|
||||
@ManagedResource(objectName = "bean:name=testBean4", description = "My Managed Bean", log = true,
|
||||
@ManagedResource(value = "bean:name=testBean4", description = "My Managed Bean", log = true,
|
||||
logFile = "build/jmx.log", currencyTimeLimit = 15, persistPolicy = "OnUpdate", persistPeriod = 200,
|
||||
persistLocation = "./foo", persistName = "bar.jmx")
|
||||
@ManagedNotification(name = "My Notification", notificationTypes = { "type.foo", "type.bar" })
|
||||
@ManagedNotification(name = "My Notification 1", notificationTypes = { "type.foo", "type.bar" })
|
||||
@ManagedNotification(name = "My Notification 2", notificationTypes = "type.enigma")
|
||||
public class AnnotationTestBean implements ITestBean {
|
||||
|
||||
private String name;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2024 the original author or authors.
|
||||
* Copyright 2002-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -150,7 +150,7 @@ public abstract class AbstractJmxAssemblerTests extends AbstractJmxTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void notificationMetadata() throws Exception {
|
||||
protected void notificationMetadata() throws Exception {
|
||||
ModelMBeanInfo info = (ModelMBeanInfo) getMBeanInfo();
|
||||
MBeanNotificationInfo[] notifications = info.getNotifications();
|
||||
assertThat(notifications).as("Incorrect number of notifications").hasSize(1);
|
||||
|
||||
Reference in New Issue
Block a user