package com.collective.celos.ci;

import com.collective.celos.ci.config.CelosCiCommandLine;
import com.collective.celos.ci.config.ContextParser;
import com.collective.celos.ci.config.deploy.CelosCiContext;
import com.collective.celos.ci.mode.CelosCiDeploy;
import com.collective.celos.ci.mode.CelosCiTest;
import com.collective.celos.ci.mode.CelosCiUndeploy;

public abstract class CelosCi {

    public static void main(String... args) throws Exception {

        ContextParser contextParser = new ContextParser();
        CelosCiCommandLine commandLine = contextParser.parse(args);

        CelosCi celosCi = createCelosCi(commandLine);
        celosCi.start();
    }

    public static CelosCi createCelosCi(CelosCiCommandLine commandLine) throws Exception {

        if (commandLine.getMode() == CelosCiContext.Mode.TEST) {
            return new CelosCiTest(commandLine);
        } else if (commandLine.getMode() == CelosCiContext.Mode.DEPLOY) {
            return new CelosCiDeploy(commandLine);
        } else if (commandLine.getMode() == CelosCiContext.Mode.UNDEPLOY) {
            return new CelosCiUndeploy(commandLine);
        }
        return null;
    }

    public abstract void start() throws Exception;

}

@@ -1146,19 +1146,80 @@
     
-return null
+throw new IllegalStateException(%22Unknown mode %22 + commandLine.getMode())
 ;%0A  

throw error