Package org.openengsb.core.api.model

Examples of org.openengsb.core.api.model.BeanDescription


     * @return a SecureRequest corresponding to the given ServiceId and MethodId
     */
    private MethodCallMessage createSecureRequest(ServiceId serviceId, MethodId methodId)
        throws ArgumentConversionException {
        MethodCallMessage methodCallRequest = createMethodCallRequest(serviceId, methodId);
        BeanDescription beanDescription = BeanDescription.fromObject(new Password("yourpassword"));
        methodCallRequest.setPrincipal("yourusername");
        methodCallRequest.setCredentials(beanDescription);
        return methodCallRequest;
    }
View Full Code Here


        return publicKey;
    }

    private static byte[] marshalSecureRequest(MethodCallMessage methodCallRequest,
            String username, Object credentials) throws IOException {
        BeanDescription credentialsBean = BeanDescription.fromObject(credentials);
        methodCallRequest.setPrincipal(username);
        methodCallRequest.setCredentials(credentialsBean);
        return MAPPER.writeValueAsBytes(methodCallRequest);
    }
View Full Code Here

        return convertStringToResult(resultString);
    }

    private static String marshalSecureRequest(MethodCallMessage methodCallRequest,
            String username, Object credentails) throws IOException {
        BeanDescription auth = BeanDescription.fromObject(credentails);
        methodCallRequest.setPrincipal(username);
        methodCallRequest.setCredentials(auth);
        return MAPPER.writeValueAsString(methodCallRequest);
    }
View Full Code Here

        MethodCall methodCall = new MethodCall("createWithId", new Object[]{ connectorId, connectorDescription });
        Map<String, String> metaData = new HashMap<String, String>();
        metaData.put("serviceId", "connectorManager");
        methodCall.setMetaData(metaData);
        MethodCallMessage methodCallRequest = new MethodCallMessage(methodCall, false);
        BeanDescription auth = BeanDescription.fromObject(new Password("password"));
        methodCallRequest.setPrincipal("admin");
        methodCallRequest.setCredentials(auth);

        ObjectMapper mapper = new ObjectMapper();
        return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(methodCallRequest);
View Full Code Here

        MethodCall methodCall = new MethodCall("delete", new Object[]{ connectorId });
        Map<String, String> metaData = new HashMap<String, String>();
        metaData.put("serviceId", "connectorManager");
        methodCall.setMetaData(metaData);
        MethodCallMessage methodCallRequest = new MethodCallMessage(methodCall, false);
        BeanDescription auth = BeanDescription.fromObject(new Password("password"));
        methodCallRequest.setPrincipal("admin");
        methodCallRequest.setCredentials(auth);
        ObjectMapper mapper = new ObjectMapper();
        String writeValueAsString = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(methodCallRequest);
        System.out.println(writeValueAsString);
View Full Code Here

            "tcp://127.0.0.1:%s?example-remote" });
        Map<String, String> metaData = new HashMap<String, String>();
        metaData.put("serviceId", "connectorManager");
        methodCall.setMetaData(metaData);
        MethodCallMessage methodCallRequest = new MethodCallMessage(methodCall, false);
        BeanDescription auth = BeanDescription.fromObject(new Password("password"));
        methodCallRequest.setPrincipal("admin");
        methodCallRequest.setCredentials(auth);

        ObjectMapper mapper = new ObjectMapper();
        String writeValueAsString = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(methodCallRequest);
View Full Code Here

public class BeanDescriptionTest {

    @Test
    public void testWrapSimpleBean_shouldContainStringData() throws Exception {
        SimpleTestBean bean = new SimpleTestBean("42", 42L);
        BeanDescription beanDescription = BeanDescription.fromObject(bean);
        assertThat(beanDescription.getData().get("stringValue"), is("42"));
        assertThat(beanDescription.getData().get("longValue"), is("42"));
    }
View Full Code Here

    }

    @Test
    public void testWrapAndUnWrapSimpleBean_shouldBeEqualObject() throws Exception {
        SimpleTestBean bean = new SimpleTestBean("42", 42L);
        BeanDescription beanDescription = BeanDescription.fromObject(bean);
        SimpleTestBean bean2 = beanDescription.toObject(SimpleTestBean.class);

        assertThat(bean2.getLongValue(), is(42L));
        assertThat(bean2.getStringValue(), is("42"));
    }
View Full Code Here

TOP

Related Classes of org.openengsb.core.api.model.BeanDescription

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.