qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arnaudsi...@apache.org
Subject svn commit: r703961 [2/2] - in /incubator/qpid/trunk/qpid/java/management/client/src: main/java/org/apache/qpid/management/ main/java/org/apache/qpid/management/configuration/ main/java/org/apache/qpid/management/domain/handler/base/ main/java/org/apac...
Date Mon, 13 Oct 2008 08:16:05 GMT
Modified: incubator/qpid/trunk/qpid/java/management/client/src/main/java/org/apache/qpid/management/domain/services/QpidService.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/client/src/main/java/org/apache/qpid/management/domain/services/QpidService.java?rev=703961&r1=703960&r2=703961&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/client/src/main/java/org/apache/qpid/management/domain/services/QpidService.java
(original)
+++ incubator/qpid/trunk/qpid/java/management/client/src/main/java/org/apache/qpid/management/domain/services/QpidService.java
Mon Oct 13 01:16:03 2008
@@ -20,131 +20,70 @@
  */
 package org.apache.qpid.management.domain.services;
 
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import java.util.Map;
+import java.io.IOException;
 import java.util.UUID;
-import java.util.concurrent.ConcurrentHashMap;
 
 import org.apache.qpid.QpidException;
-import org.apache.qpid.management.Constants;
+import org.apache.qpid.api.Message;
 import org.apache.qpid.management.Names;
-import org.apache.qpid.management.configuration.Configuration;
 import org.apache.qpid.management.configuration.QpidDatasource;
+import org.apache.qpid.management.domain.model.QpidMethod;
+import org.apache.qpid.management.domain.model.type.Binary;
+import org.apache.qpid.management.messages.MethodInvocationRequestMessage;
+import org.apache.qpid.management.messages.SchemaRequestMessage;
+import org.apache.qpid.nclient.Connection;
+import org.apache.qpid.nclient.Session;
 import org.apache.qpid.nclient.util.MessageListener;
 import org.apache.qpid.nclient.util.MessagePartListenerAdapter;
-import org.apache.qpid.transport.Connection;
 import org.apache.qpid.transport.MessageAcceptMode;
 import org.apache.qpid.transport.MessageAcquireMode;
 import org.apache.qpid.transport.MessageCreditUnit;
-import org.apache.qpid.transport.MessageTransfer;
 import org.apache.qpid.transport.Option;
-import org.apache.qpid.transport.Session;
-import org.apache.qpid.transport.SessionException;
-import org.apache.qpid.transport.SessionListener;
 import org.apache.qpid.transport.util.Logger;
 
 /**
  * Qpid Broker facade.
- *
+ * 
  * @author Andrea Gazzarini
  */
-public class QpidService implements SessionListener
+public class QpidService
 {
     private final static Logger LOGGER = Logger.get(QpidService.class);
-
-    // Inner static class used for logging and avoid conditional logic (isDebugEnabled())
duplication.
-    private static class Log
-    {
-        /**
-         * Logs the content f the message.
-         * This will be written on log only if DEBUG level is enabled.
-         *
-         * @param messageContent the raw content of the message.
-         */
-        static void logMessageContent(byte [] messageContent)
-        {
-            if (LOGGER.isDebugEnabled()) {
-                LOGGER.debug(
-                        "<QMAN-200001> : Message has been sent to management exchange.
Message content : %s",
-                        Arrays.toString(messageContent));
-            }
-        }
-
-        /**
-         * Logs the content f the message.
-         * This will be written on log only if DEBUG level is enabled.
-         *
-         * @param messageContent the raw content of the message.
-         */
-        static void logMessageContent(ByteBuffer messageContent)
-        {
-            if (LOGGER.isDebugEnabled()) {
-                LOGGER.debug(
-                        "<QMAN-200002> : Message has been sent to management exchange.");
-            }
-        }
-    }
-
+    
     private UUID _brokerId;
     private Connection _connection;
     private Session _session;
-    private Map<String,MessagePartListenerAdapter> _listeners;
-
+    
     /**
      * Builds a new service with the given connection data.
-     *
+     * 
      * @param connectionData the connection data of the broker.
      */
-    public QpidService(UUID brokerId)
+    public QpidService(UUID brokerId) 
     {
         this._brokerId = brokerId;
     }
-
+    
     /**
      * Estabilishes a connection with the broker.
-     *
+     * 
      * @throws QpidException in case of connection failure.
      */
     public void connect() throws Exception
     {
         _connection = QpidDatasource.getInstance().getConnection(_brokerId);
-        _listeners = new ConcurrentHashMap<String,MessagePartListenerAdapter>();
-        _session = _connection.createSession(Constants.NO_EXPIRATION);
-        _session.setSessionListener(this);
-    }
-
-    public void opened(Session ssn) {}
-
-    public void message(Session ssn, MessageTransfer xfr)
-    {
-        MessagePartListenerAdapter l = _listeners.get(xfr.getDestination());
-        if (l == null)
-        {
-            LOGGER.error("unhandled message: %s", xfr);
-        }
-        else
-        {
-            l.messageTransfer(xfr);
-        }
-    }
-
-    public void exception(Session ssn, SessionException exc)
-    {
-        LOGGER.error(exc, "session %s exception", ssn);
+        _session = _connection.createSession(0);
     }
-
-    public void closed(Session ssn) {}
-
+    
     /**
-     * All the previously entered outstanding commands are asynchronous.
+     * All the previously entered outstanding commands are asynchronous. 
      * Synchronous behavior is achieved through invoking this  method.
      */
-    public void sync()
+    public void sync() 
     {
         _session.sync();
     }
-
+    
     /**
      * Closes communication with broker.
      */
@@ -152,52 +91,51 @@
     {
         try
         {
+            
             _session.close();
             _session = null;
-            _listeners = null;
         } catch (Exception e)
         {
         }
         try
         {
-            _connection.close();
+            _connection.close();        
             _connection = null;
         } catch (Exception e)
         {
         }
     }
-
+    
     /**
      * Associate a message listener with a destination therefore creating a new subscription.
-     *
+     * 
      * @param queueName The name of the queue that the subscriber is receiving messages from.
      * @param destinationName the name of the destination, or delivery tag, for the subscriber.
-     * @param listener the listener for this destination.
-     *
+     * @param listener the listener for this destination. 
+     * 
      * @see Session#messageSubscribe(String, String, short, short, org.apache.qpid.nclient.MessagePartListener,
java.util.Map, org.apache.qpid.transport.Option...)
      */
-    public void createSubscription(String queueName, String destinationName, MessageListener
listener)
+    public void createSubscription(String queueName, String destinationName,MessageListener
listener)
     {
-        _listeners.put(destinationName, new MessagePartListenerAdapter(listener));
-        _session.messageSubscribe
-            (queueName,
-             destinationName,
-             MessageAcceptMode.NONE,
-             MessageAcquireMode.PRE_ACQUIRED,
-             null, 0, null);
-
-        _session.messageFlow(destinationName, MessageCreditUnit.BYTE, Session.UNLIMITED_CREDIT);
-        _session.messageFlow(destinationName, MessageCreditUnit.MESSAGE, Session.UNLIMITED_CREDIT);
-
+        _session.messageSubscribe(
+                queueName,
+                destinationName,
+                Session.TRANSFER_CONFIRM_MODE_NOT_REQUIRED,
+                Session.TRANSFER_ACQUIRE_MODE_PRE_ACQUIRE,
+                new MessagePartListenerAdapter(listener), null);
+        
+        _session.messageFlow(destinationName, MessageCreditUnit.BYTE, Session.MESSAGE_FLOW_MAX_BYTES);
+        _session.messageFlow(destinationName, MessageCreditUnit.MESSAGE, Integer.MAX_VALUE);
+        
         LOGGER.debug(
-                "<QMAN-200003> : New subscription between queue %s and destination
%s has been declared.",
+                "<QMAN-200003> : New subscription between queue %s and destination
%s has been declared.", 
                 queueName,
                 destinationName);
     }
-
+    
     /**
      * Removes a previously declared consumer from the broker.
-     *
+     * 
      * @param destinationName the name of the destination, or delivery tag, for the subscriber.
      * @see Session#messageCancel(String, Option...)
      */
@@ -205,10 +143,10 @@
     {
         _session.messageCancel(destinationName);
         LOGGER.debug(
-                "<QMAN-200026> : Subscription named %s has been removed from remote
broker.",
+                "<QMAN-200026> : Subscription named %s has been removed from remote
broker.", 
                 destinationName);
-    }
-
+    }    
+    
     /**
      * Declares a queue on the broker with the given name.
      *
@@ -232,27 +170,27 @@
         _session.queueDelete(queueName);
         LOGGER.debug("<QMAN-2000025> : Queue with name %s has been removed.",queueName);
     }
-
+    
     /**
      * Binds (on the broker) a queue with an exchange.
      *
-     * @param queueName the name of the queue to bind.
+     * @param queueName the name of the queue to bind. 
      * @param exchangeName the exchange name.
-     * @param routingKey the routing key used for the binding.
+     * @param routingKey the routing key used for the binding. 
      * @see Session#exchangeBind(String, String, String, java.util.Map, Option...)
      */
     public void declareBinding(String queueName, String exchangeName, String routingKey)
     {
         _session.exchangeBind(queueName, exchangeName, routingKey, null);
         LOGGER.debug(
-                "<QMAN-200005> : New binding with %s as routing key has been declared
between queue %s and exchange %s.",
+                "<QMAN-200005> : New binding with %s as routing key has been declared
between queue %s and exchange %s.", 
                 routingKey,queueName,
                 exchangeName);
     }
-
+    
     /**
      * Removes a previously declare binding between an exchange and a queue.
-     *
+     * 
      * @param queueName the name of the queue.
      * @param exchangeName the name of the exchange.
      * @param routingKey the routing key used for binding.
@@ -261,42 +199,141 @@
     {
         _session.exchangeUnbind(queueName, exchangeName, routingKey);
         LOGGER.debug(
-                "<QMAN-200005> : Binding with %s as routing key has been removed between
queue %s and exchange %s.",
+                "<QMAN-200005> : Binding with %s as routing key has been removed between
queue %s and exchange %s.", 
                 routingKey,queueName,
                 exchangeName);
     }
-
+    
     /**
-     * Sends a command message with the given data on the management queue.
-     *
-     * @param messageData the command message content.
+     * Sends a command message.
+     * 
+     * @param message the command message.
+     * @throws IOException when the message cannot be sent.
      */
-    public void sendCommandMessage(byte [] messageData)
+    public void sendMessage(Message message) throws IOException 
     {
         _session.messageTransfer(
                 Names.MANAGEMENT_EXCHANGE,
-                MessageAcceptMode.EXPLICIT,
-                MessageAcquireMode.PRE_ACQUIRED,
-                Configuration.getInstance().getCommandMessageHeader(),
-                messageData);
+                message,
+                MessageAcceptMode.EXPLICIT.getValue(),
+                MessageAcquireMode.PRE_ACQUIRED.getValue());
+    }    
+    
+    /**
+     * Requests a schema for the given package.class.hash.
+     * 
+     * @param packageName the package name.
+     * @param className the class name.
+     * @param schemaHash the schema hash.
+     * @throws IOException when the schema request cannot be sent.
+     */
+    public void requestSchema(final String packageName, final String className, final Binary
schemaHash) throws IOException
+    {
+        Message message = new SchemaRequestMessage()
+        {
+            @Override
+            protected String className ()
+            {
+                return className;
+            }
 
-        Log.logMessageContent (messageData);
-    }
+            @Override
+            protected String packageName ()
+            {
+                return packageName;
+            }
 
-    /**
-     * Sends a command message with the given data on the management queue.
-     *
-     * @param messageData the command message content.
-     */
-    public void sendCommandMessage(ByteBuffer messageData)
+            @Override
+            protected Binary schemaHash ()
+            {
+                return schemaHash;
+            }
+        };
+        
+        sendMessage(message);
+    }
+    
+    /**
+     * Invokes an operation on a broker object instance.
+     * 
+     * @param packageName the package name.
+     * @param className the class name.
+     * @param schemaHash the schema hash of the corresponding class.
+     * @param objectId the object instance identifier.
+     * @param parameters the parameters for this invocation.
+     * @param method the method (definition) invoked.
+     * @return the sequence number used for this message.
+     * @throws MethodInvocationException when the invoked method returns an error code.
+     * @throws UnableToComplyException when it wasn't possibile to invoke the requested operation.

+     */
+    public void invoke(
+            final String packageName, 
+            final String className, 
+            final Binary schemaHash, 
+            final Binary objectId, 
+            final Object[] parameters, 
+            final QpidMethod method,
+            final int sequenceNumber) throws MethodInvocationException, UnableToComplyException

     {
-        _session.messageTransfer(
-                Names.MANAGEMENT_EXCHANGE,
-                MessageAcceptMode.EXPLICIT,
-                MessageAcquireMode.PRE_ACQUIRED,
-                Configuration.getInstance().getCommandMessageHeader(),
-                messageData);
+        Message message = new MethodInvocationRequestMessage()
+        {
+            
+            @Override
+            protected int sequenceNumber ()
+            {
+                return sequenceNumber;
+            }
+            
+            protected Binary objectId() {
+                return objectId;
+            }
+            
+            protected String packageName()
+            {
+                return packageName;
+            }
+            
+            protected String className() 
+            {
+                return className;
+            }
+            
+            @Override
+            protected QpidMethod method ()
+            {
+                return method;
+            }
 
-        Log.logMessageContent (messageData);
-    }
+            @Override
+            protected Object[] parameters ()
+            {
+                return parameters;
+            }
+
+            @Override
+            protected Binary schemaHash ()
+            {
+                return schemaHash;
+            }
+        };
+        
+        try {
+            sendMessage(message);
+            sync();
+//            ReturnValueObject invocationResult = Configuration.getInstance()._resultExchangeChannel.poll(2000,TimeUnit.MILLISECONDS);
+//            if (invocationResult == null) {
+//                return null;
+//            }
+//            if (invocationResult.isException()) 
+//            {
+//                invocationResult.createAndThrowException();
+//            }   
+//            return invocationResult;
+//        } catch(MethodInvocationException exception) 
+//        {
+//            throw exception;
+        } catch(Exception exception) {
+            throw new UnableToComplyException(exception);
+        }
+    }  
 }
\ No newline at end of file

Modified: incubator/qpid/trunk/qpid/java/management/client/src/test/java/org/apache/qpid/management/configuration/ConfiguratorTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/client/src/test/java/org/apache/qpid/management/configuration/ConfiguratorTest.java?rev=703961&r1=703960&r2=703961&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/client/src/test/java/org/apache/qpid/management/configuration/ConfiguratorTest.java
(original)
+++ incubator/qpid/trunk/qpid/java/management/client/src/test/java/org/apache/qpid/management/configuration/ConfiguratorTest.java
Mon Oct 13 01:16:03 2008
@@ -86,12 +86,6 @@
 
         configurator.startElement(null, null, Tag.BROKERS.toString(), null);
         assertSame(configurator._brokerConfigurationParser,configurator._currentParser);
-        
-        configurator.startElement(null, null, Tag.MANAGEMENT_QUEUE.toString(), null);
-        assertSame(configurator._managementQueueHandlerParser,configurator._currentParser);
-        
-        configurator.startElement(null, null, Tag.METHOD_REPLY_QUEUE.toString(), null);
-        assertSame(configurator._methodReplyQueueHandlerParser,configurator._currentParser);
     }    
     /**
      * Create a stub configurator which returns the given datafile path.

Modified: incubator/qpid/trunk/qpid/java/management/client/src/test/java/org/apache/qpid/management/configuration/MappingParsersTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/client/src/test/java/org/apache/qpid/management/configuration/MappingParsersTest.java?rev=703961&r1=703960&r2=703961&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/client/src/test/java/org/apache/qpid/management/configuration/MappingParsersTest.java
(original)
+++ incubator/qpid/trunk/qpid/java/management/client/src/test/java/org/apache/qpid/management/configuration/MappingParsersTest.java
Mon Oct 13 01:16:03 2008
@@ -20,16 +20,11 @@
  */
 package org.apache.qpid.management.configuration;
 
-import java.util.Map;
 import java.util.UUID;
 
 import junit.framework.TestCase;
 
 import org.apache.qpid.management.TestConstants;
-import org.apache.qpid.management.domain.handler.base.IMessageHandler;
-import org.apache.qpid.management.domain.handler.impl.ConfigurationMessageHandler;
-import org.apache.qpid.management.domain.handler.impl.InstrumentationMessageHandler;
-import org.apache.qpid.management.domain.handler.impl.SchemaResponseMessageHandler;
 import org.apache.qpid.management.domain.model.AccessMode;
 import org.apache.qpid.management.domain.model.type.Type;
 import org.apache.qpid.management.domain.model.type.Uint8;
@@ -103,73 +98,6 @@
         assertEquals(username,result.getUsername());
         assertEquals(password,result.getPassword());
     }
-
-    /**
-     * Tests the execution of the management queue handler mapping parser.
-     * 
-     * <br>precondition: Two managenent queue handlers mapping are built by the parser;
-     * <br>postcondition: the corresponding management handlers are available on the
configuration.
-     */
-    public void testManagementQueueMessageListenerParser() 
-    {
-        String instrOpcode = "i";
-        String configOpCode = "c";
-        
-        ManagementQueueMessageListenerParser parser = new ManagementQueueMessageListenerParser();
-        
-        parser.setCurrrentAttributeValue(instrOpcode);
-        parser.setCurrentAttributeName(Tag.OPCODE.toString());
-        parser.setCurrrentAttributeValue(InstrumentationMessageHandler.class.getName());
-        parser.setCurrentAttributeName(Tag.CLASS_NAME.toString());
-        parser.setCurrentAttributeName(Tag.HANDLER.toString());
-
-        parser.setCurrrentAttributeValue(configOpCode);
-        parser.setCurrentAttributeName(Tag.OPCODE.toString());
-        parser.setCurrrentAttributeValue(ConfigurationMessageHandler.class.getName());
-        parser.setCurrentAttributeName(Tag.CLASS_NAME.toString());
-        parser.setCurrentAttributeName(Tag.HANDLER.toString());
-
-        
-        Map<Character,IMessageHandler> result = Configuration.getInstance().getManagementQueueHandlers();
-        
-        assertEquals(2,result.size());
-        
-        assertEquals(InstrumentationMessageHandler.class,result.get(instrOpcode.charAt(0)).getClass());
-        assertEquals(ConfigurationMessageHandler.class,result.get(configOpCode.charAt(0)).getClass());
 
-    }  
-    
-    /**
-     * Tests the execution of the method-reply queue handler mapping parser.
-     * 
-     * <br>precondition: two method-reply queue handler mappings are built by the parser;
-     * <br>postcondition: the corresponding method-reply handlers are available on
the configuration.
-     */
-    public void testMethodReplyQueueMessageListenerParser() 
-    {
-        String schemaOpcode = "s";
-        String configOpCode = "c";
-        
-        MethodReplyQueueMessageListenerParser parser = new MethodReplyQueueMessageListenerParser();
-        
-        parser.setCurrrentAttributeValue(schemaOpcode);
-        parser.setCurrentAttributeName(Tag.OPCODE.toString());
-        parser.setCurrrentAttributeValue(SchemaResponseMessageHandler.class.getName());
-        parser.setCurrentAttributeName(Tag.CLASS_NAME.toString());
-        parser.setCurrentAttributeName(Tag.HANDLER.toString());
-
-        parser.setCurrrentAttributeValue(configOpCode);
-        parser.setCurrentAttributeName(Tag.OPCODE.toString());
-        parser.setCurrrentAttributeValue(ConfigurationMessageHandler.class.getName());
-        parser.setCurrentAttributeName(Tag.CLASS_NAME.toString());
-        parser.setCurrentAttributeName(Tag.HANDLER.toString());
-
-        Map<Character,IMessageHandler> result = Configuration.getInstance().getMethodReplyQueueHandlers();
-        
-        assertEquals(2,result.size());
-        
-        assertEquals(SchemaResponseMessageHandler.class,result.get(schemaOpcode.charAt(0)).getClass());
-        assertEquals(ConfigurationMessageHandler.class,result.get(configOpCode.charAt(0)).getClass());
 
-    }
     
     /**
      * Tests the execution of the type mapping parser.

Modified: incubator/qpid/trunk/qpid/java/management/client/src/test/java/org/apache/qpid/management/configuration/StubConfigurator.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/client/src/test/java/org/apache/qpid/management/configuration/StubConfigurator.java?rev=703961&r1=703960&r2=703961&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/client/src/test/java/org/apache/qpid/management/configuration/StubConfigurator.java
(original)
+++ incubator/qpid/trunk/qpid/java/management/client/src/test/java/org/apache/qpid/management/configuration/StubConfigurator.java
Mon Oct 13 01:16:03 2008
@@ -46,6 +46,15 @@
         Configuration.getInstance().addTypeMapping(mapping);        
     }
     
+    public void addTypeMapping(String code,String clazzName,String validatorClassName)
+    {
+        TypeMapping mapping = new TypeMapping();
+        mapping.setCode(code);
+        mapping.setType(clazzName);
+        mapping.setValidatorClassName(validatorClassName);
+        Configuration.getInstance().addTypeMapping(mapping);        
+    }
+    
     public void addAccessModeMapping(String code, String value)
     {
         AccessModeMapping mapping = new AccessModeMapping();

Modified: incubator/qpid/trunk/qpid/java/management/client/src/test/java/org/apache/qpid/management/domain/handler/base/ContentIndicationMessageHandlerTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/client/src/test/java/org/apache/qpid/management/domain/handler/base/ContentIndicationMessageHandlerTest.java?rev=703961&r1=703960&r2=703961&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/client/src/test/java/org/apache/qpid/management/domain/handler/base/ContentIndicationMessageHandlerTest.java
(original)
+++ incubator/qpid/trunk/qpid/java/management/client/src/test/java/org/apache/qpid/management/domain/handler/base/ContentIndicationMessageHandlerTest.java
Mon Oct 13 01:16:03 2008
@@ -20,14 +20,9 @@
  */
 package org.apache.qpid.management.domain.handler.base;
 
-import java.nio.ByteBuffer;
+import junit.framework.TestCase;
 
-import org.apache.qpid.management.TestConstants;
 import org.apache.qpid.management.domain.model.type.Binary;
-import org.apache.qpid.transport.codec.ManagementDecoder;
-import org.apache.qpid.transport.codec.ManagementEncoder;
-
-import junit.framework.TestCase;
 
 /**
  * Test case for Content indication message handler (base class).
@@ -37,62 +32,6 @@
 public class ContentIndicationMessageHandlerTest extends TestCase
 {      
     /**
-     * Tests the execution of the process method when the message is processed correctly.
-     */
-    public void testProcessOk() {
-        final String expectedPackageName = "org.apache.qpid.broker";
-        final String expectedClassName ="connection";
-        final long expectedMessageTimestamp = System.currentTimeMillis();
-        final long expectedCreationTime = expectedMessageTimestamp - 1000;
-        final long expectedDeletionTime = 0;   
-        final Binary expectedClassHash = new Binary(new byte[]{9,9,9,9,8,8,8,8,7,7,7,7,6,6,6,6});
-        final Binary expectedObjectId = new Binary(new byte[]{1,2,3,4,5,6,7,8,9,0,11,12,13,14,15,16});
-        final Binary expectedBody = new Binary(new byte[]{1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4});
-        
-        ContentIndicationMessageHandler mockHandler = new ContentIndicationMessageHandler()
-        {
-            @Override
-            protected void updateDomainModel (String packageName, String className, Binary
classHash, Binary objectId,
-                    long timeStampOfCurrentSample, long timeObjectWasCreated, long timeObjectWasDeleted,
byte[] contentData)
-            {
-                assertEquals(expectedPackageName,packageName);
-                assertEquals(expectedClassName,className);
-                assertEquals(expectedClassHash,classHash);
-                assertEquals(expectedMessageTimestamp,timeStampOfCurrentSample);
-                assertEquals(expectedCreationTime,timeObjectWasCreated);
-                assertEquals(expectedDeletionTime,timeObjectWasDeleted);
-                assertEquals(expectedObjectId,objectId);                
-                assertEquals(expectedBody,new Binary(contentData));
-            }
-            
-            @Override
-            void removeObjectInstance (String packageName, String className, Binary classHash,
Binary objectId)
-            {
-                fail("The object shouldn't be deleted because deletion time was set to 0!");
-            }
-        };
-        mockHandler.setDomainModel(TestConstants.DOMAIN_MODEL);
-        
-        ByteBuffer buffer = ByteBuffer.allocate(1000);
-        ManagementEncoder encoder = new ManagementEncoder(buffer);
-        
-        encoder.writeStr8(expectedPackageName);
-        encoder.writeStr8(expectedClassName);
-        expectedClassHash.encode(encoder);
-        encoder.writeDatetime(expectedMessageTimestamp);
-        encoder.writeDatetime(expectedCreationTime);
-        encoder.writeDatetime(expectedDeletionTime);
-        expectedObjectId.encode(encoder);
-        expectedBody.encode(encoder);
-        
-        buffer.flip();
-        ManagementDecoder decoder = new ManagementDecoder();
-        decoder.init(buffer);
-        
-        mockHandler.process(decoder, 1);
-    }
-    
-    /**
      * Tests the behaviour of the objectHasBeenRemoved method().
      */
     public void testObjectHasBeenRemoved() 

Modified: incubator/qpid/trunk/qpid/java/management/client/src/test/java/org/apache/qpid/management/domain/model/DomainModelTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/client/src/test/java/org/apache/qpid/management/domain/model/DomainModelTest.java?rev=703961&r1=703960&r2=703961&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/client/src/test/java/org/apache/qpid/management/domain/model/DomainModelTest.java
(original)
+++ incubator/qpid/trunk/qpid/java/management/client/src/test/java/org/apache/qpid/management/domain/model/DomainModelTest.java
Mon Oct 13 01:16:03 2008
@@ -36,7 +36,6 @@
     @Override
     protected void setUp () throws Exception
     {
-        super.setUp();
         _model = new DomainModel(UUID.randomUUID());
     }
     

Modified: incubator/qpid/trunk/qpid/java/management/client/src/test/java/org/apache/qpid/management/domain/model/QpidMethodBuilderTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/client/src/test/java/org/apache/qpid/management/domain/model/QpidMethodBuilderTest.java?rev=703961&r1=703960&r2=703961&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/client/src/test/java/org/apache/qpid/management/domain/model/QpidMethodBuilderTest.java
(original)
+++ incubator/qpid/trunk/qpid/java/management/client/src/test/java/org/apache/qpid/management/domain/model/QpidMethodBuilderTest.java
Mon Oct 13 01:16:03 2008
@@ -25,7 +25,6 @@
 import static org.apache.qpid.management.domain.model.QpidFeatureBuilder.Attribute.type;
 import static org.apache.qpid.management.domain.model.QpidFeatureBuilder.Attribute.unit;
 
-import java.nio.ByteBuffer;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -36,7 +35,6 @@
 import org.apache.qpid.management.Names;
 import org.apache.qpid.management.domain.handler.impl.MethodOrEventDataTransferObject;
 import org.apache.qpid.management.domain.model.QpidFeatureBuilder.Attribute;
-import org.apache.qpid.transport.codec.ManagementEncoder;
 
 /**
  * Test case for Qpid Statistic builder.
@@ -146,21 +144,4 @@
         assertEquals(method.getDescription(),info.getDescription());
         assertEquals(method.getName(),info.getName());
     }
-    
-    public void testEncodeParameters() throws ValidationException, UnableToBuildFeatureException
{
-        _builder.build();
-        
-        Object [] parameters = new Object[]{new Integer(1), new Integer(2),new Integer(3)};
-        
-        ManagementEncoder encoder = new ManagementEncoder(ByteBuffer.allocate(1)){
-            @Override
-            public void writeUint16 (int s)
-            {
-               assertTrue(s == 1 || s == 2);
-            }
-        };
-        
-        QpidMethod method = (QpidMethod) _builder.getQpidFeature();
-        method.encodeParameters(parameters, encoder);
-    }
 }
\ No newline at end of file

Modified: incubator/qpid/trunk/qpid/java/management/client/src/test/java/org/apache/qpid/management/domain/model/QpidNumberPropertyTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/client/src/test/java/org/apache/qpid/management/domain/model/QpidNumberPropertyTest.java?rev=703961&r1=703960&r2=703961&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/client/src/test/java/org/apache/qpid/management/domain/model/QpidNumberPropertyTest.java
(original)
+++ incubator/qpid/trunk/qpid/java/management/client/src/test/java/org/apache/qpid/management/domain/model/QpidNumberPropertyTest.java
Mon Oct 13 01:16:03 2008
@@ -20,9 +20,12 @@
  */
 package org.apache.qpid.management.domain.model;
 
+import junit.framework.TestCase;
+
+import org.apache.qpid.management.configuration.StubConfigurator;
 import org.apache.qpid.management.domain.model.type.Uint64;
 
-public class QpidNumberPropertyTest extends BaseDomainModelTestCase
+public class QpidNumberPropertyTest extends TestCase
 {
     private QpidProperty _property;
     private Long _value = 55432L;
@@ -30,7 +33,8 @@
     @Override
     protected void setUp () throws Exception
     {
-        super.setUp();
+        StubConfigurator configurator = new StubConfigurator();
+        configurator.addTypeMapping("1", Uint64.class.getName(),QpidProperty.NumberValidator.class.getName());
         _property = new QpidProperty();
         _property.setName("average");
         _property.setAccessMode(AccessMode.RW);

Modified: incubator/qpid/trunk/qpid/java/management/client/src/test/java/org/apache/qpid/management/domain/model/QpidPackageTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/client/src/test/java/org/apache/qpid/management/domain/model/QpidPackageTest.java?rev=703961&r1=703960&r2=703961&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/client/src/test/java/org/apache/qpid/management/domain/model/QpidPackageTest.java
(original)
+++ incubator/qpid/trunk/qpid/java/management/client/src/test/java/org/apache/qpid/management/domain/model/QpidPackageTest.java
Mon Oct 13 01:16:03 2008
@@ -34,7 +34,6 @@
     @Override
     protected void setUp () throws Exception
     {
-        super.setUp();
         _qpidPackage = new QpidPackage(TestConstants.QPID_PACKAGE_NAME, TestConstants.DOMAIN_MODEL);
     }
     

Modified: incubator/qpid/trunk/qpid/java/management/client/src/test/java/org/apache/qpid/management/domain/model/QpidStringPropertyTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/client/src/test/java/org/apache/qpid/management/domain/model/QpidStringPropertyTest.java?rev=703961&r1=703960&r2=703961&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/client/src/test/java/org/apache/qpid/management/domain/model/QpidStringPropertyTest.java
(original)
+++ incubator/qpid/trunk/qpid/java/management/client/src/test/java/org/apache/qpid/management/domain/model/QpidStringPropertyTest.java
Mon Oct 13 01:16:03 2008
@@ -20,9 +20,12 @@
  */
 package org.apache.qpid.management.domain.model;
 
+import junit.framework.TestCase;
+
+import org.apache.qpid.management.configuration.StubConfigurator;
 import org.apache.qpid.management.domain.model.type.Str16;
 
-public class QpidStringPropertyTest extends BaseDomainModelTestCase
+public class QpidStringPropertyTest extends TestCase
 {
     private QpidProperty _property;
     private final String _5LettersString = "12345";
@@ -30,7 +33,8 @@
     @Override
     protected void setUp () throws Exception
     {
-        super.setUp();
+        StubConfigurator configurator = new StubConfigurator();
+        configurator.addTypeMapping("1", Str16.class.getName(),QpidProperty.StringValidator.class.getName());
         _property = new QpidProperty();
         _property.setName("name");
         _property.setAccessMode(AccessMode.RW);



Mime
View raw message