Package org.ibeans.api.channel

Examples of org.ibeans.api.channel.MimeType


    {
        return new Answer()
        {
            public Object answer(InvocationOnMock invocation) throws Throwable
            {
                MimeType mime = mimeType;
                DataType ret = ((MockIBean)ibean).ibeanReturnType();
                if(ret!=null) ret.setMimeType(mime.toString());
                Object data;

                /**
                 * We need to have some special handling when dealing with a Mockito mock
                 * 1) If the return type on the ibeans is not set, use the method return type
                 * 2) the return annotation changes the return type so use the one defined on the actual Method
                 * 3) If the return type and the method return type are not assignable, then use the method return type
                 */
                if (ret == null || invocation.getMethod().isAnnotationPresent(Return.class) ||
                        !invocation.getMethod().getReturnType().isAssignableFrom(ret.getType()))
                {
                    ret = DataTypeFactory.createFromReturnType(invocation.getMethod());
                    mime = null;
                }

                data = loadData(resource, ret);
                ((MockIBean)ibean).ibeanSetMimeType(mime);
                ((MockIBean)ibean).ibeanSetMessageCallback(callback);

                Response response;
                Map<String, Object> headers = null;
                if(mime!=null)
                {
                    headers = new HashMap<String, Object>();
                    headers.put(MuleProperties.CONTENT_TYPE_PROPERTY, mime.toString());
                }
                response = plugin.createResponse(data, headers, null);
                if(callback!=null)
                {
                    callback.onMessage(response);
View Full Code Here


        try
        {
            String expr = (String) anno.annotationType().getMethod("expr").invoke(anno);
            String errorCode = (String) anno.annotationType().getMethod("errorCode").invoke(anno);
            String tempMime = (String) anno.annotationType().getMethod("mimeType").invoke(anno);
            MimeType mimeType = new MimeType(tempMime);

            Field f;
            String evaluator;

            try
View Full Code Here

    {
    //Both Mule and iBeans have DataType implementations, need to wrap the Mule DataType to work with iBeans
        if(muleDT instanceof CollectionDataType)
        {
            CollectionDataType dt = (CollectionDataType)muleDT;
            return org.ibeans.impl.support.datatype.DataTypeFactory.create(dt.getType(), dt.getItemType(), new MimeType(dt.getMimeType()));
        }
        else
        {
            return org.ibeans.impl.support.datatype.DataTypeFactory.create(muleDT.getType(), new MimeType(muleDT.getMimeType()));
        }

    }
View Full Code Here

TOP

Related Classes of org.ibeans.api.channel.MimeType

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.