/*
 * Copyright 2012 Thomas Bouffard (redfish4ktc)
 *
 * 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.
 *
 */

package org.ktc.soapui.maven.extension;

import com.eviware.soapui.tools.SoapUIMockServiceRunner;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.ktc.soapui.maven.extension.impl.RunnerType;
import org.ktc.soapui.maven.extension.impl.enums.EnumConverter;

public class MockServiceMojo extends AbstractSoapuiRunnerMojo {
    private String mockService;
    private String path;
    private String port;
    private boolean noBlock;
    
    @Override
    protected void performRunnerExecute() throws MojoExecutionException, MojoFailureException {
        RunnerType runnerTypeEnum = EnumConverter.toRunnerType(runnerType);
        SoapUIMockServiceRunner runner = runnerTypeEnum.newMockRunner();
        configureWithSharedParameters(runner);

        runner.setBlock(!noBlock);
        if (mockService != null) {
            runner.setMockService(mockService);
        }
        if (path != null) {
            runner.setPath(path);
        }
        if (port != null) {
            runner.setPort(port);
        }
        runner.setSaveAfterRun(saveAfterRun);


        try {
            runner.run();
        } catch (Exception e) {
            getLog().debug(e);
            throw new MojoFailureException("SoapUI has errors: " + e.getMessage(), e);
        }
    }
}

@@ -13,16 +13,21 @@
 ght 2012
+-2014
  Thomas 
@@ -1467,47 +1467,8 @@
 k);%0A
-        if (mockService != null) %7B%0A    
     
@@ -1519,114 +1519,30 @@
     
-%7D%0A        if (path != null) %7B%0A            runner.setPath(path);%0A        %7D%0A        if (port != null) %7B%0A    
+runner.setPath(path);%0A
     
@@ -1567,26 +1567,16 @@
 (port);%0A
-        %7D%0A
         
@@ -1614,17 +1614,16 @@
 rRun);%0A%0A
-%0A
         

Remove extra null checks in the mock mojo #118