Java tutorial
/** * Copyright (c) 2011 Zauber S.A. <http://www.zaubersoftware.com> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * This file was automatically generated by the Mule Cloud Connector Development Kit */ package com.zaubersoftware.mule.module.jenkins.config; import java.util.HashMap; import java.util.Map; import org.apache.commons.io.IOUtils; import org.mule.api.MuleEvent; import org.mule.construct.SimpleFlowConstruct; import org.mule.tck.FunctionalTestCase; public class JenkinsNamespaceHandlerTestCase extends FunctionalTestCase { @Override protected String getConfigResources() { return "jenkins-namespace-config.xml"; } public void testExistsFlow() throws Exception { String payload = "test-project"; MuleEvent event = getTestEvent(payload); SimpleFlowConstruct flow = lookupFlowConstruct("exists"); MuleEvent responseEvent = flow.process(event); assertEquals(Boolean.TRUE, responseEvent.getMessage().getPayload(Boolean.class)); } public void testCreate() throws Exception { final Map<String, Object> payload = new HashMap<String, Object>(); payload.put("name", "test-project"); payload.put("template", getClass().getClassLoader().getResourceAsStream("config.xml")); MuleEvent event = getTestEvent(payload); SimpleFlowConstruct flow = lookupFlowConstruct("create"); flow.process(event); } public void testRender() throws Exception { MuleEvent event = getTestEvent(""); SimpleFlowConstruct flow = lookupFlowConstruct("render"); String s = flow.process(event).getMessage().getPayloadAsString(); assertTrue(s.contains("<groupId>foo-bar</groupId>")); } private SimpleFlowConstruct lookupFlowConstruct(String name) { return (SimpleFlowConstruct) muleContext.getRegistry().lookupFlowConstruct(name); } }