@Override
    public void addProducer(ConnectionContext context, ProducerInfo info) throws Exception {

        // JMS allows producers to be created without first specifying a destination.  In these cases, every send
        // operation must specify a destination.  Because of this, we only authorize 'addProducer' if a destination is
        // specified. If not specified, the authz check in the 'send' method below will ensure authorization.
        if (info.getDestination() != null) {
            DestinationAction action = new DestinationAction(context, info.getDestination(), "write");
            assertAuthorized(action, "write to");
        }

        super.addProducer(context, info);
    }
@Test(expected=UnauthorizedException.class)
    public void testAddProducerNotAuthorized() throws Exception {
        String name = "myTopic";
        ActiveMQDestination dest = new ActiveMQTopic(name);

        Subject subject = new PermsSubject();
        ConnectionContext context = createContext(subject);
        ProducerInfo info = new ProducerInfo(null);
        info.setDestination(dest);

        filter.addProducer(context, info);
    }