Package br.gov.frameworkdemoiselle.management

Examples of br.gov.frameworkdemoiselle.management.AttributeChangeMessage


 
  public void listenNotification(@Observes ManagementNotificationEvent event){
    Object lMessage = event.getNotification().getMessage();
   
    if (AttributeChangeMessage.class.isInstance(lMessage)){
      AttributeChangeMessage lAttrMessage = (AttributeChangeMessage)lMessage;
      message = lAttrMessage.getDescription() + " - " + lAttrMessage.getAttributeName();
    }
    else{
      message = lMessage.toString();
    }
  }
View Full Code Here


          // Manda uma notificação de mudança de atributo
          NotificationManager notificationManager = Beans.getReference(NotificationManager.class);
          Class<? extends Object> attributeType = newValue != null ? newValue.getClass() : null;

          Notification notification = new DefaultNotification( new AttributeChangeMessage(
              bundle.getString("management-notification-attribute-changed", propertyName, managedType.getType().getCanonicalName())
              , propertyName
              , attributeType
              , oldValue
              , newValue) );
View Full Code Here

  /**
   * Test sending a notification of change in attribute
   */
  @Test
  public void sendAttributeChangeNotification() {
    Notification n = new DefaultNotification( new AttributeChangeMessage("Test Message", "attribute", String.class, "old", "new") );
    manager.sendNotification(n);
   
    DummyNotificationListener listener = Beans.getReference(DummyNotificationListener.class);
    Assert.assertEquals("Test Message - attribute", listener.getMessage());
  }
View Full Code Here

    br.gov.frameworkdemoiselle.management.Notification demoiselleNotification = event.getNotification();
    Object message = demoiselleNotification.getMessage();
    Notification n;
   
    if (AttributeChangeMessage.class.isInstance( message )){
      AttributeChangeMessage attributeChangeMessage = (AttributeChangeMessage) message;
     
      n = new AttributeChangeNotification(config.getNotificationMBeanName(), sequence.incrementAndGet()
          , System.currentTimeMillis(), attributeChangeMessage.getDescription()
          , attributeChangeMessage.getAttributeName(), attributeChangeMessage.getAttributeType().getSimpleName()
          , attributeChangeMessage.getOldValue(), attributeChangeMessage.getNewValue());
    }
    else{
      n = new Notification(NOTIFICATION_TYPE_GENERIC, config.getNotificationMBeanName(), sequence.incrementAndGet(), System.currentTimeMillis(), demoiselleNotification.getMessage().toString());
    }
    sendNotification(n);
View Full Code Here

    } catch (InstanceNotFoundException e) {
      Assert.fail();
    }

    // Manda a notificação pelo Demoiselle
    Notification notification = new DefaultNotification( new AttributeChangeMessage("Attribute Changed", "name", String.class, "Demoiselle 1", "Demoiselle 2") );
    notificationManager.sendNotification(notification);

    // Se o componente funcionou, o Demoiselle propagou a notificação para o servidor MBean e o listener preencheu
    // o StringBuffer com nossa mensagem.
    Assert.assertEquals("Attribute Changed: name = Demoiselle 2", notificationBuffer.toString());
View Full Code Here

TOP

Related Classes of br.gov.frameworkdemoiselle.management.AttributeChangeMessage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.