[Title]Add buildWeb Module and modify related classes 83/11583/1
authorHeongseok Heo <hyeongseok.heo@samsung.com>
Wed, 30 Oct 2013 10:29:19 +0000 (19:29 +0900)
committerHeongseok Heo <hyeongseok.heo@samsung.com>
Wed, 30 Oct 2013 10:29:19 +0000 (19:29 +0900)
[Desc.]
Create BuildWebAppModule class for seperating build web module with CLI.
Add Test cases for build web.
Signed-off-by: Heongseok Heo <hyeongseok.heo@samsung.com>
Change-Id: Ia222632c3e7af577b5ccfa816c8c1508f775f753

org.tizen.ncli.ide/src/org/tizen/core/ide/BuildWebAppModule.java [new file with mode: 0644]
org.tizen.ncli.ide/src/org/tizen/core/ide/BuildWebParameter.java [new file with mode: 0644]
org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/AbstractCLI.java
org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/BuildWebCLI.java
org.tizen.ncli.ide/src/org/tizen/ncli/ide/subcommands/AbstractSubCommand.java
org.tizen.ncli.ide/src/org/tizen/ncli/ide/subcommands/BuildWebCLICommand.java
org.tizen.ncli.ide/src/org/tizen/ncli/ide/subcommands/BuildWebCLICommandData.java [deleted file]
org.tizen.ncli.ide/test/src/org/tizen/core/ide/BuildWebAppModuleTest.java [new file with mode: 0644]
org.tizen.ncli.ide/test/src/org/tizen/ncli/ide/subcommands/BuildWebCLICommandCallTest.java
org.tizen.ncli.ide/test/src/org/tizen/ncli/ide/subcommands/BuildWebCLICommandTest.java
org.tizen.ncli.ide/test/src/org/tizen/ncli/ide/subcommands/ConfigCommandTest.java

diff --git a/org.tizen.ncli.ide/src/org/tizen/core/ide/BuildWebAppModule.java b/org.tizen.ncli.ide/src/org/tizen/core/ide/BuildWebAppModule.java
new file mode 100644 (file)
index 0000000..e51f7d6
--- /dev/null
@@ -0,0 +1,396 @@
+/*
+ * IDE
+ *
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Hyeongseok Heo <hyeongseok.heo@samsung.com>
+ * Kangho Kim <kh5325.kim@samsung.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.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ */
+package org.tizen.core.ide;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.tizen.common.FactoryWithArgument;
+import org.tizen.common.builder.BuildProcess;
+import org.tizen.common.builder.Builder;
+import org.tizen.common.builder.Resource;
+import org.tizen.common.builder.ResourceLayer;
+import org.tizen.common.builder.core.CopyBuilder;
+import org.tizen.common.builder.exception.BuildException;
+import org.tizen.common.file.FileHandler;
+import org.tizen.common.file.Filter;
+import org.tizen.common.file.SimpleFileFilter;
+import org.tizen.common.file.StandardFileHandler;
+import org.tizen.common.file.VirtualFileHandler;
+import org.tizen.common.file.filter.WildCardFilterFactory;
+import org.tizen.common.util.Assert;
+import org.tizen.common.util.FileUtil;
+import org.tizen.common.util.FilenameUtil;
+import org.tizen.web.builder.CssMinifyBuilder;
+import org.tizen.web.builder.HybridAppCLIBuilder;
+import org.tizen.web.builder.JSMinifyBuilder;
+import org.tizen.web.builder.UIFWBuilder;
+
+/**
+ * This class has a main role of build web application.
+ * <p>
+ * This class make out build result by parameters for build.<br>
+ * Independent with IDE or CLI
+ * 
+ * @author Harry Hyeongseok Heo{@literal <hyeongseok.heo@samsung.com>} (S-core)
+ * 
+ * 
+ */
+public class BuildWebAppModule {
+    private Logger log = LoggerFactory.getLogger(getClass());
+    private BuildWebParameter data;
+    private String cwd;
+    private String output = ".buildResult"; 
+    private SimpleFileFilter filter = new SimpleFileFilter(true);
+    public FactoryWithArgument<Filter, String> filterFactory = new WildCardFilterFactory();
+    public List<String> excludes = new ArrayList<String>();
+    private String[] DEFAULT_EXCLUDES = { 
+            ".build/*",
+            ".project",
+            ".settings/*",
+            ".sdk_delta.info", "*.wgt" 
+            };
+
+    public BuildWebAppModule() {
+        // TODO Auto-generated constructor stub
+    }
+    /**
+     * @param cwd
+     *            the cwd to set
+     */
+    public void setCwd(String cwd) {
+        this.cwd = cwd;
+    }
+
+    /**
+     * @param data the data to set
+     */
+    public void setData(BuildWebParameter data) {
+        this.data = data;
+    }
+
+    public BuildWebAppModule(BuildWebParameter data, String cwd, String output, SimpleFileFilter filter,
+            FactoryWithArgument<Filter, String> filterFactory, List<String> excludes) {
+        this.data = data;
+        this.cwd = cwd;
+        this.output = output;
+        this.filter = filter;
+        this.filterFactory = filterFactory;
+        this.excludes = excludes;
+    }
+
+    
+
+    public void buildResources() throws IOException, BuildException, Exception {
+        BuildProcess buildProcess = new BuildProcess();
+        
+        if( isPrerequisiteSatisfy()) {
+            // Set output
+            if( null != data && null != data.getOutputName()) {
+                this.output = cwd+File.separator+data.getOutputName();
+            }else {
+                this.output = cwd+File.separator+this.output;
+            }
+            // If output path exist, the path will be recreated.
+            deleteOutput();
+            // Set default exclude resources
+            addDefaultExclude();
+            
+            // Set start layer
+            FileHandler fh = new StandardFileHandler();
+            fh.setCurrentWorkingDirectory(cwd);
+            ResourceLayer startLayer = new ResourceLayer("Initial Resource Layer", fh);
+
+            log.debug("=== OUTPUT === {}", this.output);
+            // Get resource list for build
+            Resource[] resources = null;
+            resources = getBuildResources(startLayer);
+            log.trace("==!! Get Build Resources !!==");
+            if (null != resources) {
+                log.trace("Total resource count: {}", resources.length);
+                // Generate web builders to build process
+            }
+            
+            generateAllBuilders(buildProcess, startLayer);
+
+            if (buildProcess.getLastBuilder() != null) {
+                log.debug("start build process");
+                buildProcess.build(resources);
+
+                // check succeeding status.
+                checkHybridStructure(buildProcess);
+            }
+        }else {
+            throw new BuildException(null);
+        }
+        Assert.notNull(cwd,"Current Working Directory should not be NULL.");
+    }
+
+    private void deleteOutput() {
+        if(FileUtil.isExist(output)) {
+            FileUtil.recursiveDelete(new File(output));
+        }
+    }
+    private void addDefaultExclude() {
+        if( null != data && null != data.getExcludeList()) {
+            for (String defaultExclude : DEFAULT_EXCLUDES) {
+                log.trace("add exclude:{}",defaultExclude);
+                data.getExcludeList().add(defaultExclude);
+            }
+        }
+    }
+    /**
+     * Check pre-requisite for executing build
+     *        
+     * @return
+     */
+    private boolean isPrerequisiteSatisfy() {
+        return null != cwd && !"".equals(cwd.trim()) ;
+    }
+
+    /**
+     * get resource list
+     * 
+     * @param cwd
+     *            root path located resources. It means working path. means current path.
+     * @param relativeSrcDir
+     *            relative directory including resources.
+     * @param layer
+     *            {@link ResourceLayer} about resource
+     * @throws IOException
+     */
+    private List<Resource> getResources(String cwd, String relativeSrcDir, ResourceLayer layer) throws IOException {
+        List<Resource> resources = new ArrayList<Resource>();
+        List<File> files = null;
+        String absoluteDir = cwd + File.separator + relativeSrcDir;
+        files = FileUtil.findFiles(new File(absoluteDir), ".*", true);
+
+        for (File file : files) {
+            String fileRelativePath = FilenameUtil.getRelativePath(cwd, file.getCanonicalPath());
+
+            if (!FilenameUtil.equals(file.getCanonicalPath(), this.cwd) && !this.filter.accept(cwd, fileRelativePath)) {
+                log.debug("Ignore {}", fileRelativePath);
+                continue;
+            }
+
+            log.debug("resource path : {}", fileRelativePath);
+            Resource resource = new Resource(layer, fileRelativePath);
+
+            resources.add(resource);
+        }
+        return resources;
+    }
+
+    /**
+     * Get resource list for build.
+     * 
+     * @param cmdLine
+     * @param layer
+     *            parent layer
+     * @param includes
+     *            Include resource list. If you want to add all resources located in input path, set this parameter to
+     *            null. If you set this parameter, another resources will not be added to list.
+     * @param data
+     *            .excludes Exclude resource list. If you want to exclude resources, set this parameter using regular
+     *            expression. It should be set regular expression about file element.
+     * @return
+     * @throws IOException
+     */
+    private Resource[] getBuildResources(ResourceLayer layer) throws IOException {
+        List<Resource> resources = new ArrayList<Resource>();
+        // setIncludes(includes);
+         setExcludes(data.getExcludeList());
+        log.trace("CWD:{}",cwd);
+        String cwd = layer.getFileHandler().getCurrentWorkingDirectory();
+        resources.addAll(getResources(cwd, FilenameUtil.getRelativePath(cwd, cwd), layer));
+
+        // reference project
+        /*
+         * if (cmdLine.hasOption(OPT_NAME_REFERENCE_PROJECT)) { FileHandler refFh = new StandardFileHandler();
+         * ResourceLayer referenceLayer = new ResourceLayer(HybridAppCLIBuilder.RESOURCE_LAYER_REFERENCE_NAME , refFh);
+         * layer.setParent(referenceLayer); String refPath =
+         * convertPath(cmdLine.getOptionValue(OPT_NAME_REFERENCE_PROJECT)); refFh.setCurrentWorkingDirectory(refPath);
+         * 
+         * resources.addAll(getResources(refPath , FilenameUtil.getRelativePath(refPath, refPath) , referenceLayer)); }
+         */
+
+        return resources.toArray(new Resource[resources.size()]);
+    }
+
+    /**
+     * Generate builders to {@link BuildProcess}.
+     * 
+     * @param buildProcess
+     * @param parentLayer
+     * @throws IOException
+     */
+    public void generateAllBuilders(BuildProcess buildProcess, ResourceLayer parentLayer) throws IOException {
+
+        FileHandler fh = new VirtualFileHandler();
+        fh.setCurrentWorkingDirectory(parentLayer.getFileHandler().getCurrentWorkingDirectory());
+        if (null != this.data && this.data.isExcludeUIFW()) {
+            addUIFWBuilder(true, true, buildProcess, getLastResourceLayer(buildProcess, parentLayer), fh);
+        }
+        if (null != this.data && this.data.hasReference()) {
+            addHybridBuilder(buildProcess, getLastResourceLayer(buildProcess, parentLayer), fh);
+        }
+        if (null != this.data && this.data.isOptimize()) {
+            addOptimizingBuilders(buildProcess, getLastResourceLayer(buildProcess, parentLayer), fh);
+        }
+        addLastbuilder(buildProcess, getLastResourceLayer(buildProcess, parentLayer));
+    }
+
+    /**
+     * Add optimizing builders to buildProcess.
+     * 
+     * @param buildProcess
+     * @param parentLayer
+     */
+    private void addOptimizingBuilders(BuildProcess buildProcess, ResourceLayer parentLayer, FileHandler fh) {
+        if (buildProcess == null) {
+            return;
+        }
+
+        // add js minify builder
+        ResourceLayer jsMinLayer = new ResourceLayer(JSMinifyBuilder.RESOURCE_LAYER_NAME, parentLayer, fh);
+        JSMinifyBuilder jsMin = new JSMinifyBuilder(jsMinLayer);
+        buildProcess.addBuilder(jsMin);
+
+        // add css minify builder
+        ResourceLayer cssMinLayer = new ResourceLayer(CssMinifyBuilder.RESOURCE_LAYER_NAME, jsMinLayer, fh);
+        CssMinifyBuilder cssMin = new CssMinifyBuilder(cssMinLayer);
+        buildProcess.addBuilder(cssMin);
+    }
+
+    /**
+     * Add hybrid builder to buildProcess. It will be used to build including reference project.
+     * 
+     * @param cmdLine
+     * @param buildProcess
+     * @param lastLayer
+     * @throws IOException
+     */
+    private void addHybridBuilder(BuildProcess buildProcess, ResourceLayer lastLayer, FileHandler fh)
+            throws IOException {
+        ResourceLayer layer = new ResourceLayer(HybridAppCLIBuilder.RESOURCE_LAYER_NAME, lastLayer, fh);
+
+        String refPath = ""; // TODO add HybridOption! convertPath(cmdLine.getOptionValue(OPT_NAME_REFERENCE_PROJECT));
+
+        HybridAppCLIBuilder hybridAppBuilder = new HybridAppCLIBuilder(layer, refPath);
+        buildProcess.addBuilder(hybridAppBuilder);
+    }
+
+    /**
+     * get last resource layer located in buildProcess.
+     * 
+     * @param buildProcess
+     * @param defaultLayer
+     * @return
+     */
+    private ResourceLayer getLastResourceLayer(BuildProcess buildProcess, ResourceLayer defaultLayer) {
+        ResourceLayer lastLayer = buildProcess.getLastResourceLayer();
+        return (lastLayer != null) ? lastLayer : defaultLayer;
+    }
+
+    /**
+     * Add UI framework builder to buildProcess.
+     * 
+     * @param isExclude
+     *            If set true, Tizen web UI framework library will be excluded output path. Application will be used
+     *            target's Tizen web UI framework library.
+     * @param useMin
+     *            If 'isExclude' parameter set true and this parameter set true, application will be used target's
+     *            minified Tizen web UI framework library. Or, application will be used target's original Tizen web UI
+     *            framework library.
+     * @param buildProcess
+     * @param parentLayer
+     */
+    private void addUIFWBuilder(boolean isExclude, boolean useMin, BuildProcess buildProcess,
+            ResourceLayer parentLayer, FileHandler fh) {
+        ResourceLayer layer = new ResourceLayer(UIFWBuilder.RESOURCE_LAYER_NAME, parentLayer, fh);
+        UIFWBuilder uifwBuilder = new UIFWBuilder(isExclude, layer);
+        uifwBuilder.setUseMin(useMin);
+
+        buildProcess.addBuilder(uifwBuilder);
+    }
+
+    /**
+     * Add builder that write resources to file system to buildProcess.
+     * 
+     * @param buildProcess
+     * @param parentLayer
+     */
+    private void addLastbuilder(BuildProcess buildProcess, ResourceLayer parentLayer) {
+        // add file output builder
+        FileHandler fh = new StandardFileHandler();
+        fh.setCurrentWorkingDirectory(parentLayer.getFileHandler().getCurrentWorkingDirectory());
+        ResourceLayer toFSLayer = new ResourceLayer(CopyBuilder.RESOURCE_LAYER_NAME, parentLayer, fh);
+        CopyBuilder toFSBuilder = new CopyBuilder(FilenameUtil.getRelativePath(this.cwd, this.output), toFSLayer);
+        buildProcess.addBuilder(toFSBuilder);
+    }
+
+    /**
+     * Check whether this process have no problem. If have problems, BuildException will be occurred.
+     * 
+     * @param buildProcess
+     * @throws BuildException
+     */
+    protected void checkHybridStructure(BuildProcess buildProcess) throws Exception {
+        // Check hybrid structure. If a manifest file and a binary file are not found, this is a failure.
+        try {
+            Builder builder = buildProcess.getBuilder(HybridAppCLIBuilder.RESOURCE_LAYER_NAME);
+            if (builder != null) {
+                HybridAppCLIBuilder hybridBuilder = (HybridAppCLIBuilder) builder;
+                if (!hybridBuilder.isManifestFound()) {
+                    throw new IOException(HybridAppCLIBuilder.ERROR_MANIFEST_NOT_FOUND);
+                }
+                if (!hybridBuilder.isBinaryFound()) {
+                    throw new IOException(HybridAppCLIBuilder.ERROR_BINARY_NOT_FOUND);
+                }
+            }
+        } catch (IOException e) {
+            throw new Exception(e);
+        }
+
+        // TODO Notification ?? getPrompter().notify( MessageFormat.format( SUCCEED_MSG, this.output ) );
+    }
+    
+    /**
+     * Set excluding resource list
+     * @param excludes
+     */
+    private void setExcludes(List<String> excludes) {
+//        filter.clearExcludes();
+        if (null != excludes) {
+            for (final String exclude : excludes) {
+                filter.addExcludes(filterFactory.create(exclude));
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/org.tizen.ncli.ide/src/org/tizen/core/ide/BuildWebParameter.java b/org.tizen.ncli.ide/src/org/tizen/core/ide/BuildWebParameter.java
new file mode 100644 (file)
index 0000000..501f40f
--- /dev/null
@@ -0,0 +1,111 @@
+/*
+ * IDE
+ *
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Hyeongseok Heo <hyeongseok.heo@samsung.com>
+ * Kangho Kim <kh5325.kim@samsung.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.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ */
+package org.tizen.core.ide;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * Class for representing parameter of Web Build
+ * @author Harry Hyeongseok Heo{@literal <hyeongseok.heo@samsung.com>} (S-core)
+ * 
+ */
+public class BuildWebParameter {
+
+
+    private boolean optimize;
+    private boolean excludeUIFW;
+    private List<String> excludeList = new ArrayList<String>();
+    private String outputName;
+    private File workingDir;
+    private File[] refs;
+
+    public BuildWebParameter() {
+    }
+
+    public boolean isOptimize() {
+        return optimize;
+    }
+
+    public void setOptimize(boolean optimize) {
+        this.optimize = optimize;
+    }
+
+    public boolean isExcludeUIFW() {
+        return excludeUIFW;
+    }
+
+    public void setExcludeUIFW(boolean excludeUIFW) {
+        this.excludeUIFW = excludeUIFW;
+    }
+
+    public List<String> getExcludeList() {
+        return excludeList;
+    }
+
+    public void setExcludeList(List<String> excludeList) {
+        this.excludeList = excludeList;
+    }
+
+    public String getOutputName() {
+        return outputName;
+    }
+
+    public void setOutputName(String outputName) {
+        this.outputName = outputName;
+    }
+
+    public void setWorkingDir(File workingDir) {
+        this.workingDir = workingDir;
+
+    }
+    /**
+     * @return the workingDir
+     */
+    public File getWorkingDir() {
+        return workingDir;
+    }
+
+    public void setReferences(File... refs) {
+        this.refs = refs;
+    }
+
+    public boolean hasReference() {
+        if (null != this.refs && this.refs.length > 0) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    public List<File> getReferences() {
+        if( hasReference()) {
+            return Arrays.asList(this.refs);
+        }
+        return null;
+    }
+}
\ No newline at end of file
index 7cea7e3..d1f653a 100644 (file)
@@ -35,37 +35,27 @@ import org.slf4j.LoggerFactory;
 \r
 /**\r
  * Implemented common function of CLI options\r
+ * \r
  * @author Harry Hyeongseok Heo{@literal <hyeongseok.heo@samsung.com>} (S-core)\r
  */\r
 public abstract class AbstractCLI {\r
-       protected Logger log = LoggerFactory.getLogger(getClass());\r
-       \r
-    @Option(name="--" , metaVar="target path" , usage="Specify where is the root path for the command")\r
-    public File targetPath;\r
-    \r
+    protected Logger log = LoggerFactory.getLogger(getClass());\r
+\r
+    @Option(name = "--", metaVar = "working directory", usage = "Specify where is the base directory for the command")\r
+    public File workingDir;\r
+\r
     protected PrintWriter output = new PrintWriter(System.out);;\r
-    \r
+\r
     public final void execute(String[] args) {\r
         parseArgument(args);\r
         execute();\r
     }\r
-    \r
+\r
     /**\r
      * @param args\r
      */\r
     private void parseArgument(String[] args) {\r
         log.trace("Could not use parsing argument again!");\r
-//     log.trace("parseArgument...");\r
-//        CmdLineParser parser = new CmdLineParser(this);\r
-//        \r
-//        try {\r
-//            parser.parseArgument(args);\r
-//        } catch (CmdLineException e) {\r
-//             e.printStackTrace();\r
-//            System.err.println("Error occurred during parsing the arguments.");\r
-//            System.exit(1);\r
-//        }\r
     }\r
-\r
     public abstract void execute();\r
 }\r
index 2b794ea..6f6430c 100644 (file)
@@ -6,8 +6,8 @@ import java.util.List;
 import org.kohsuke.args4j.Option;\r
 import org.slf4j.Logger;\r
 import org.slf4j.LoggerFactory;\r
+import org.tizen.core.ide.BuildWebParameter;\r
 import org.tizen.ncli.ide.subcommands.BuildWebCLICommand;\r
-import org.tizen.ncli.ide.subcommands.BuildWebCLICommandData;\r
 \r
 \r
 public class BuildWebCLI extends AbstractCLI{\r
@@ -37,9 +37,9 @@ public class BuildWebCLI extends AbstractCLI{
        command.setOutputName(outputName);\r
        command.setExcludeUIFW(excludeUIFW);\r
        command.setExcludeList(excludeList);\r
-       command.setTargetPath(targetPath);\r
+       command.setWorkingDir(workingDir);\r
        \r
-       BuildWebCLICommandData commandData = command.runCommand();\r
+       BuildWebParameter commandData = command.runCommand();\r
        \r
        output.println("Build web project succeeded!");\r
        output.println(commandData);\r
index 71a1afc..6eaaa97 100644 (file)
@@ -44,13 +44,13 @@ import org.tizen.ncli.ide.exec.NewCommandLineExecutor;
  */\r
 abstract public class AbstractSubCommand<T> {\r
     protected final Logger log = LoggerFactory.getLogger( getClass() );\r
-    protected File targetPath;\r
+    protected File workingDir;\r
     \r
     /**\r
-        * @param targetPath the targetPath to set\r
+        * @param workingDir the workingDir to set\r
         */\r
-       public void setTargetPath(File targetPath) {\r
-               this.targetPath = targetPath;\r
+       public void setWorkingDir(File targetPath) {\r
+               this.workingDir = targetPath;\r
        }\r
 \r
        /**\r
index 8f898c7..52e3779 100644 (file)
@@ -29,456 +29,181 @@ import java.io.IOException;
 import java.util.ArrayList;\r
 import java.util.List;\r
 \r
-import org.tizen.common.FactoryWithArgument;\r
 import org.tizen.common.builder.BuildProcess;\r
 import org.tizen.common.builder.Builder;\r
 import org.tizen.common.builder.Resource;\r
 import org.tizen.common.builder.ResourceLayer;\r
-import org.tizen.common.builder.core.CopyBuilder;\r
 import org.tizen.common.builder.exception.BuildException;\r
 import org.tizen.common.file.FileHandler;\r
-import org.tizen.common.file.Filter;\r
 import org.tizen.common.file.SimpleFileFilter;\r
 import org.tizen.common.file.StandardFileHandler;\r
-import org.tizen.common.file.VirtualFileHandler;\r
 import org.tizen.common.file.FileHandler.Attribute;\r
 import org.tizen.common.file.filter.WildCardFilter;\r
 import org.tizen.common.file.filter.WildCardFilterFactory;\r
-import org.tizen.common.util.FileUtil;\r
-import org.tizen.common.util.FilenameUtil;\r
 import org.tizen.common.util.OSChecker;\r
 import org.tizen.common.util.StringUtil;\r
-import org.tizen.web.builder.CssMinifyBuilder;\r
+import org.tizen.core.ide.BuildWebAppModule;\r
+import org.tizen.core.ide.BuildWebParameter;\r
+import org.tizen.ncli.ide.shell.BuildWebCLI;\r
 import org.tizen.web.builder.HybridAppCLIBuilder;\r
-import org.tizen.web.builder.JSMinifyBuilder;\r
-import org.tizen.web.builder.UIFWBuilder;\r
 import org.tizen.web.builder.exception.MinifyException;\r
 import org.tizen.web.common.WebConstant;\r
 \r
 /**\r
+ * This class has a role of intermediate with {@link BuildWebCLI}} and {@link BuildWebAppModule}<br>\r
+ * \r
  * @author Harry Hyeongseok Heo{@literal <hyeongseok.heo@samsung.com>} (S-core)\r
- * @param <BuildWebCLICommandData>\r
- *\r
+ * @param <IBuildWebParameter>\r
+ * \r
  * \r
  */\r
-public class BuildWebCLICommand extends AbstractSubCommand<BuildWebCLICommandData> {\r
-       \r
-\r
-       private BuildWebCLICommandData data = new BuildWebCLICommandData();\r
-       //the current working directory that build process is executed\r
-       private String cwd = ".";\r
-       //the result directory name\r
-       private String output = ".buildResult";\r
-       private SimpleFileFilter filter = new SimpleFileFilter(true);\r
-       private FactoryWithArgument<Filter, String> filterFactory = new WildCardFilterFactory();\r
-       // file filter. If you want to exclude a directory, append '/*'\r
-    private static final String[] DEFAULT_EXCLUDES = {".build"+File.separator+"*"\r
-                                                    , ".project"\r
-                                                    , ".settings" + File.separator + "*"\r
-                                                    , ".sdk_delta.info"\r
-                                                    , "*.wgt"};\r
-    // excluding file list\r
-    private List<String> excludes = new ArrayList<String>();\r
-\r
-       /** \r
-        * Make build result from the <code>targetPath</code> to the <code>outputPath</code>.<br>\r
-        * If there is no targetPath specified , it will assume that current working directory as \r
-        * Build-web is executed with sequence like below. <br>\r
-        * <p>\r
-        * <li>Get the resources</li> \r
-        * <li> </li>\r
-        * \r
-        * </p> \r
-        */\r
-       @Override\r
-       protected BuildWebCLICommandData call() {\r
-               log.trace("BuildWeb command started ...");\r
-               initExcludes();\r
-               if (log.isTraceEnabled()) {\r
-                       log.trace("BuildData: {}", data); \r
-               }\r
-               if (null != this.targetPath) {\r
-                       // set CurrentWorkingDirectory (cwd) absolute path\r
-                       String canonicalPath = null;\r
-                       try {\r
-                               canonicalPath = this.targetPath.getCanonicalPath(); \r
-                               cwd = this.targetPath.getCanonicalPath();\r
-                               log.trace("canonicalPath:{}", canonicalPath);\r
-                       } catch (IOException e) {\r
-                               // TODO Auto-generated catch block\r
-                               e.printStackTrace();\r
-                       }\r
-               }\r
-\r
-               // TODO implement build process with BuildProcess\r
-\r
-\r
-               try {\r
-               // set output path (absolute)\r
-               if( !StringUtil.isEmpty(data.getOutputName())) {\r
-                       this.output = convertPath(data.getOutputName());\r
-               } else {\r
-                       this.output = cwd+File.separator+this.output;\r
-        }\r
-               \r
-               // If output path exist, the path will be recreated.\r
-               // Set exclude file list\r
-\r
-               // Set start layer\r
-               // Get resource list for build\r
-               // Generate web builders to build process\\r
+public class BuildWebCLICommand extends AbstractSubCommand<BuildWebParameter> {\r
 \r
-               BuildProcess buildProcess = new BuildProcess();\r
+    // file filter. If you want to exclude a directory, append '/*'\r
+    private static final String[] DEFAULT_EXCLUDES = { ".build" + File.separator + "*", ".project",\r
+            ".settings" + File.separator + "*", ".sdk_delta.info", "*.wgt" };\r
+    // private BuildWebAppModule webAppBuild = new BuildWebAppModule(new BuildWebParameter(), ".", ".buildResult", new\r
+    // SimpleFileFilter(true), new WildCardFilterFactory(), new ArrayList<String>());\r
+    private BuildWebAppModule buildWebAppModule = new BuildWebAppModule();\r
+    private BuildWebParameter webAppBuildData = new BuildWebParameter();\r
 \r
-               // Set start layer\r
-               FileHandler fh = new StandardFileHandler();\r
-               fh.setCurrentWorkingDirectory(cwd);\r
-               ResourceLayer startLayer = new ResourceLayer("Initial Resource Layer",\r
-                               fh);\r
-\r
-               log.debug("=== OUTPUT === {}",this.output);\r
-               log.trace("TEST OUTPUT:"+this.output);\r
-               // Get resource list for build\r
-               Resource[] resources = null;\r
-                       resources = getBuildResources(startLayer);\r
-                       log.trace("==!! Get Build Resources !!==");\r
-                       if (null != resources) {\r
-                               log.trace("Total resource count: {}", resources.length);\r
-\r
-                               // Generate web builders to build process\r
-                       }\r
-\r
-                       generateAllBuilders(buildProcess, startLayer);\r
-\r
-                       if (buildProcess.getLastBuilder() != null) {\r
-                               log.debug("start build process");\r
-                               buildProcess.build(resources);\r
-\r
-                               // check succeeding status.\r
-                               checkProcessComplete(buildProcess);\r
-                       }\r
-\r
-               } catch (MinifyException e) {\r
-                       StringBuffer msg = new StringBuffer();\r
-                       msg.append("Optimization failed.\n");\r
-                       msg.append("Error: " + e.getPath() + "(" + e.getLineNumber()\r
-                                       + "): " + e.getLineSource() + "\n");\r
-                       msg.append("Cause: " + e.getMessage() + "\n");\r
-                       // TODO print out Exception message\r
-                       // getPrompter().notify(msg.toString());\r
-                       e.printStackTrace();\r
-               } catch (IOException e) {\r
-                       e.printStackTrace();\r
-               } catch (BuildException e) {\r
-                       e.printStackTrace();\r
-               } catch (Exception e) {\r
-                       e.printStackTrace();\r
-               }\r
-\r
-               return data;\r
-       }\r
-       \r
-       /**\r
-     * get resource list\r
-     * @param cwd root path located resources. It means working path. means current path.\r
-     * @param relativeSrcDir relative directory including resources.\r
-     * @param layer {@link ResourceLayer} about resource\r
-     * @throws IOException\r
-     */\r
-    private List<Resource> getResources(String cwd, String relativeSrcDir, ResourceLayer layer) throws IOException {\r
-        List<Resource> resources = new ArrayList<Resource>();\r
-        List<File> files = null;\r
-        String absoluteDir = cwd+ File.separator + relativeSrcDir;\r
-        files = FileUtil.findFiles(new File(absoluteDir), ".*", true);\r
-\r
-        for (File file : files) {\r
-            String fileRelativePath = FilenameUtil.getRelativePath(cwd, file.getCanonicalPath());\r
-\r
-            if (!FilenameUtil.equals(file.getCanonicalPath(), this.cwd)\r
-                    && !filter.accept(cwd, fileRelativePath)) {\r
-                log.debug("Ignore {}", fileRelativePath);\r
-                continue;\r
-            }\r
-\r
-            log.debug("resource path : {}", fileRelativePath);\r
-            Resource resource = new Resource(layer, fileRelativePath);\r
-\r
-            resources.add(resource);\r
-        }\r
-        return resources;\r
-    }\r
-       \r
-    /**\r
-     * Get resource list for build.\r
-     * @param cmdLine\r
-     * @param layer parent layer\r
-     * @param includes Include resource list. If you want to add all resources located in input path, set this parameter to null.\r
-     *                  If you set this parameter, another resources will not be added to list.\r
-     * @param excludes Exclude resource list. If you want to exclude resources, set this parameter using regular expression.\r
-     *                  It should be set regular expression about file element.\r
-     * @return\r
-     * @throws IOException\r
-     */\r
-    private Resource[] getBuildResources( ResourceLayer layer ) throws IOException {\r
-        List<Resource> resources = new ArrayList<Resource>();\r
-//        setIncludes(includes);\r
-//        setExcludes(excludes);\r
-\r
-        String cwd = layer.getFileHandler().getCurrentWorkingDirectory();\r
-        resources.addAll(getResources(cwd\r
-                                        , FilenameUtil.getRelativePath(cwd, cwd)\r
-                                        , layer));\r
-\r
-        //reference project \r
-        /*if (cmdLine.hasOption(OPT_NAME_REFERENCE_PROJECT)) {\r
-            FileHandler refFh = new StandardFileHandler();\r
-            ResourceLayer referenceLayer = new ResourceLayer(HybridAppCLIBuilder.RESOURCE_LAYER_REFERENCE_NAME\r
-                                                                , refFh);\r
-            layer.setParent(referenceLayer);\r
-            String refPath = convertPath(cmdLine.getOptionValue(OPT_NAME_REFERENCE_PROJECT));\r
-            refFh.setCurrentWorkingDirectory(refPath);\r
-\r
-            resources.addAll(getResources(refPath\r
-                                            , FilenameUtil.getRelativePath(refPath, refPath)\r
-                                            , referenceLayer));\r
-        }*/\r
-\r
-        return resources.toArray(new Resource[resources.size()]);\r
-    }\r
-       \r
-       \r
     /**\r
-     * Generate builders to {@link BuildProcess}.\r
-     * @param buildProcess\r
-     * @param parentLayer\r
-     * @throws IOException\r
+     * With the {@link BuildWebParameter} , calling {@link BuildWebAppModule} to make out build result. <br>\r
+     * Below files or directories would be excluded by default.<br>\r
+     * <li>.build/*</li>\r
+     * <li>.project</li>\r
+     * <li>.settings/*</li>\r
+     * <li>.sdk_delta.info</li>\r
+     * <li>*.wgt</li>\r
      */\r
-    public void generateAllBuilders( BuildProcess buildProcess\r
-                                            , ResourceLayer parentLayer) throws IOException {\r
-\r
-        FileHandler fh = new VirtualFileHandler();\r
-        fh.setCurrentWorkingDirectory(parentLayer.getFileHandler().getCurrentWorkingDirectory());\r
-\r
-        if (data.isExcludeUIFW()) {\r
-            addUIFWBuilder(true ,true\r
-                            , buildProcess\r
-                            , getLastResourceLayer(buildProcess, parentLayer)\r
-                            , fh);\r
+    @Override\r
+    protected BuildWebParameter call() {\r
+        log.trace("BuildWeb command started ...");\r
+        initExcludes();\r
+        if (log.isTraceEnabled()) {\r
+            log.trace("BuildData: {}", webAppBuildData);\r
         }\r
-\r
-        if (data.hasReference()) {\r
-            addHybridBuilder( buildProcess\r
-                                , getLastResourceLayer(buildProcess, parentLayer)\r
-                                , fh);\r
+        if (null != webAppBuildData.getWorkingDir()) {\r
+            // set CurrentWorkingDirectory (cwd) absolute path\r
+            String canonicalPath = null;\r
+            try {\r
+                canonicalPath = this.workingDir.getCanonicalPath();\r
+                buildWebAppModule.setCwd(canonicalPath);\r
+                log.trace("canonicalPath:{}", canonicalPath);\r
+            } catch (IOException e) {\r
+                // TODO Auto-generated catch block\r
+                e.printStackTrace();\r
+            }\r
         }\r
 \r
-        if (data.isOptimize()) {\r
-            addOptimizingBuilders(buildProcess\r
-                                    , getLastResourceLayer(buildProcess, parentLayer)\r
-                                    , fh);\r
-        }\r
+        // TODO implement build process with BuildProcess\r
 \r
-        addLastbuilder(buildProcess, getLastResourceLayer(buildProcess, parentLayer));\r
-    }\r
-       \r
-    \r
-    /**\r
-     * Add optimizing builders to buildProcess.\r
-     * @param buildProcess\r
-     * @param parentLayer\r
-     */\r
-    private void addOptimizingBuilders(BuildProcess buildProcess, ResourceLayer parentLayer, FileHandler fh) {\r
-        if (buildProcess == null) {\r
-            return;\r
+        try {\r
+            // set output path (absolute)\r
+            if (!StringUtil.isEmpty(webAppBuildData.getOutputName())) {\r
+//                this.buildWebAppModule.setOutput(convertPath(webAppBuildData.getOutputName()));\r
+            } \r
+\r
+            // If output path exist, the path will be recreated.\r
+            // Set exclude file list\r
+\r
+            // Set start layer\r
+            // Get resource list for build\r
+            // Generate web builders to build process\\r
+\r
+            buildWebAppModule.buildResources();\r
+\r
+        } catch (MinifyException e) {\r
+            StringBuffer msg = new StringBuffer();\r
+            msg.append("Optimization failed.\n");\r
+            msg.append("Error: " + e.getPath() + "(" + e.getLineNumber() + "): " + e.getLineSource() + "\n");\r
+            msg.append("Cause: " + e.getMessage() + "\n");\r
+            // TODO print out Exception message\r
+            // getPrompter().notify(msg.toString());\r
+            e.printStackTrace();\r
+        } catch (IOException e) {\r
+            e.printStackTrace();\r
+        } catch (BuildException e) {\r
+            e.printStackTrace();\r
+        } catch (Exception e) {\r
+            e.printStackTrace();\r
         }\r
 \r
-        // add js minify builder\r
-        ResourceLayer jsMinLayer = new ResourceLayer(JSMinifyBuilder.RESOURCE_LAYER_NAME\r
-                                                        , parentLayer\r
-                                                        , fh);\r
-        JSMinifyBuilder jsMin = new JSMinifyBuilder(jsMinLayer);\r
-        buildProcess.addBuilder(jsMin);\r
-        \r
-        // add css minify builder\r
-        ResourceLayer cssMinLayer = new ResourceLayer(CssMinifyBuilder.RESOURCE_LAYER_NAME\r
-                                                        , jsMinLayer\r
-                                                        , fh);\r
-        CssMinifyBuilder cssMin = new CssMinifyBuilder(cssMinLayer);\r
-        buildProcess.addBuilder(cssMin);\r
-    }\r
-    \r
-    /**\r
-     * Add hybrid builder to buildProcess. It will be used to build including reference project.\r
-     * @param cmdLine\r
-     * @param buildProcess\r
-     * @param lastLayer\r
-     * @throws IOException\r
-     */\r
-    private void addHybridBuilder(BuildProcess buildProcess, ResourceLayer lastLayer, FileHandler fh) throws IOException {\r
-        ResourceLayer layer = new ResourceLayer(HybridAppCLIBuilder.RESOURCE_LAYER_NAME\r
-                                                    , lastLayer\r
-                                                    , fh);\r
-        \r
-        String refPath = ""; //TODO add HybridOption! convertPath(cmdLine.getOptionValue(OPT_NAME_REFERENCE_PROJECT));\r
-        \r
-        HybridAppCLIBuilder hybridAppBuilder = new HybridAppCLIBuilder( layer, refPath );\r
-        buildProcess.addBuilder(hybridAppBuilder);\r
-    }\r
-\r
-    /**\r
-     * get last resource layer located in buildProcess.\r
-     * @param buildProcess\r
-     * @param defaultLayer\r
-     * @return\r
-     */\r
-    private ResourceLayer getLastResourceLayer(BuildProcess buildProcess, ResourceLayer defaultLayer) {\r
-        ResourceLayer lastLayer = buildProcess.getLastResourceLayer();\r
-        return (lastLayer != null) ? lastLayer : defaultLayer;\r
+        return webAppBuildData;\r
     }\r
 \r
     /**\r
-     * Add UI framework builder to buildProcess.\r
-     * @param isExclude If set true, Tizen web UI framework library will be excluded output path.\r
-     *                  Application will be used target's Tizen web UI framework library.\r
-     * @param useMin If 'isExclude' parameter set true and this parameter set true,\r
-     *                  application will be used target's minified Tizen web UI framework library.\r
-     *                  Or, application will be used target's original Tizen web UI framework library.\r
-     * @param buildProcess\r
-     * @param parentLayer\r
-     */\r
-    private void addUIFWBuilder(boolean isExclude, boolean useMin, BuildProcess buildProcess,\r
-            ResourceLayer parentLayer, FileHandler fh) {\r
-        ResourceLayer layer = new ResourceLayer(UIFWBuilder.RESOURCE_LAYER_NAME\r
-                                                    , parentLayer\r
-                                                    , fh);\r
-        UIFWBuilder uifwBuilder = new UIFWBuilder(isExclude, layer);\r
-        uifwBuilder.setUseMin(useMin);\r
-\r
-        buildProcess.addBuilder(uifwBuilder);\r
-    }\r
-\r
-    /**\r
-     * Add builder that write resources to file system to buildProcess.\r
-     * @param buildProcess\r
-     * @param parentLayer\r
-     */\r
-    private void addLastbuilder(BuildProcess buildProcess, ResourceLayer parentLayer) {\r
-        // add file output builder\r
-        FileHandler fh = new StandardFileHandler();\r
-        fh.setCurrentWorkingDirectory(parentLayer.getFileHandler().getCurrentWorkingDirectory());\r
-        ResourceLayer toFSLayer = new ResourceLayer(CopyBuilder.RESOURCE_LAYER_NAME\r
-                                                        , parentLayer\r
-                                                        , fh);\r
-        CopyBuilder toFSBuilder = new CopyBuilder(FilenameUtil.getRelativePath(cwd, output), toFSLayer);\r
-        buildProcess.addBuilder(toFSBuilder);\r
-    }\r
-       \r
-    /**\r
-     * Check whether this process have no problem.\r
-     * If have problems, BuildException will be occurred.\r
+     * Convert <code>path</code> to canonical path\r
+     * \r
+     * @param path\r
+     *            relative or abstract path\r
      * \r
-     * @param buildProcess\r
-     * @throws BuildException\r
+     * @return canonical path\r
+     * \r
+     * @throws IOException\r
+     *             If file system deny request\r
      */\r
-    protected void checkProcessComplete(BuildProcess buildProcess) throws Exception {\r
-        // Check hybrid structure. If a manifest file and a binary file are not found, this is a failure.\r
-        try {\r
-            Builder builder = buildProcess.getBuilder( HybridAppCLIBuilder.RESOURCE_LAYER_NAME );\r
-            if ( builder != null ) {\r
-                HybridAppCLIBuilder hybridBuilder = (HybridAppCLIBuilder) builder;\r
-                if ( ! hybridBuilder.isManifestFound() ) {\r
-                    throw new IOException( HybridAppCLIBuilder.ERROR_MANIFEST_NOT_FOUND );\r
-                }\r
-                if ( ! hybridBuilder.isBinaryFound() ) {\r
-                    throw new IOException( HybridAppCLIBuilder.ERROR_BINARY_NOT_FOUND );\r
-                }\r
-            }\r
-        } catch( IOException e ) {\r
-            throw new Exception( e );\r
+    protected String convertPath(final String path) throws IOException {\r
+        String target = path;\r
+        if ((!OSChecker.isWindows()) && target.startsWith("~" + File.separator)) {\r
+            target = path.replaceFirst("~", System.getProperty("user.home"));\r
         }\r
-        \r
-       //TODO Notification ??  getPrompter().notify( MessageFormat.format( SUCCEED_MSG, this.output ) );\r
+        final FileHandler fileHandler = new StandardFileHandler();\r
+        return (String) fileHandler.get(target, Attribute.PATH);\r
     }\r
-    \r
-    /**\r
-        * Convert <code>path</code> to canonical path\r
-        * \r
-        * @param path relative or abstract path\r
-        * \r
-        * @return canonical path\r
-        * \r
-        * @throws IOException If file system deny request\r
-        */\r
-       protected\r
-       String\r
-       convertPath(\r
-               final String  path\r
-       )\r
-       throws IOException\r
-       {\r
-           String target = path;\r
-           if ((!OSChecker.isWindows())\r
-                   && target.startsWith("~"+File.separator)) {\r
-               target = path.replaceFirst("~", System.getProperty("user.home"));\r
-           }\r
-               final FileHandler fileHandler = new StandardFileHandler();\r
-               return (String) fileHandler.get( target, Attribute.PATH );\r
-       }\r
-       \r
+\r
     private void initExcludes() {\r
-       this.excludes.clear();\r
+        this.buildWebAppModule.excludes.clear();\r
+//FIXME \r
+//        for (String exclude : DEFAULT_EXCLUDES) {\r
+//            this.webAppBuild.excludes.add(exclude);\r
+//            webAppBuild.filter.addExcludes(webAppBuild.filterFactory.create(exclude));\r
+//        }\r
+//\r
+//        List<String> excludeList = webAppBuildData.getExcludeList();\r
+//        for (String exclude : excludeList) {\r
+//            this.webAppBuild.excludes.add(exclude);\r
+//            webAppBuild.filter.addExcludes(webAppBuild.filterFactory.create(exclude));\r
+//        }\r
+//\r
+//        if (webAppBuildData.isExcludeUIFW()) {\r
+//            this.webAppBuild.excludes.add(WebConstant.TIZEN_WEB_UI_FRAMWORK_LIBRARY_DIRECTORY + File.separator + "*");\r
+//            webAppBuild.filter.addExcludes(webAppBuild.filterFactory\r
+//                    .create(WebConstant.TIZEN_WEB_UI_FRAMWORK_LIBRARY_DIRECTORY + File.separator + "*"));\r
+//        }\r
+    }\r
 \r
-       for (String exclude : DEFAULT_EXCLUDES) {\r
-               this.excludes.add(exclude);\r
-               filter.addExcludes(filterFactory.create(exclude));\r
-       }\r
+    // ======================================================== END\r
 \r
-       List<String> excludeList = data.getExcludeList();\r
-       for (String exclude : excludeList) {\r
-               this.excludes.add(exclude);\r
-               filter.addExcludes(filterFactory.create(exclude));\r
-       }\r
+    private void printOptions() {\r
+        // TODO Auto-generated method stub\r
 \r
-       if (data.isExcludeUIFW()) {\r
-               this.excludes.add(WebConstant.TIZEN_WEB_UI_FRAMWORK_LIBRARY_DIRECTORY+File.separator+"*");\r
-               filter.addExcludes(filterFactory.create(WebConstant.TIZEN_WEB_UI_FRAMWORK_LIBRARY_DIRECTORY+File.separator+"*"));\r
-       }\r
     }\r
-       \r
-       \r
-       \r
-       \r
-       \r
-       //======================================================== END\r
 \r
-       private void printOptions() {\r
-               // TODO Auto-generated method stub\r
-               \r
-       }\r
+    public void setOptimize(boolean optimize) {\r
+        this.webAppBuildData.setOptimize(optimize);\r
+    }\r
 \r
-       public void setOptimize(boolean optimize) {\r
-               this.data.setOptimize(optimize);\r
-       }\r
+    public void setOutputName(String outputName) {\r
+        this.webAppBuildData.setOutputName(outputName);\r
+    }\r
 \r
-       public void setOutputName(String outputName) {\r
-               this.data.setOutputName(outputName);\r
-       }\r
+    public void setExcludeUIFW(boolean excludeUIFW) {\r
+        this.webAppBuildData.setExcludeUIFW(excludeUIFW);\r
+    }\r
 \r
-       public void setExcludeUIFW(boolean excludeUIFW) {\r
-               this.data.setExcludeUIFW(excludeUIFW);\r
-       }\r
+    public void setExcludeList(List<String> excludeList) {\r
+        this.webAppBuildData.setExcludeList(excludeList);\r
+    }\r
 \r
-       public void setExcludeList(List<String> excludeList) {\r
-               this.data.setExcludeList(excludeList);\r
-       }\r
-       \r
-       @Override\r
-       public void setTargetPath(File targetPath) {\r
-               this.data.setTargetPath(targetPath);\r
-       }\r
+    @Override\r
+    public void setWorkingDir(File targetPath) {\r
+        super.setWorkingDir(targetPath);\r
+        this.webAppBuildData.setWorkingDir(targetPath);\r
+    }\r
 \r
-       public void setReferences(File...refs) {\r
-               this.data.setReferences(refs);\r
-       }\r
+    public void setReferences(File... refs) {\r
+        this.webAppBuildData.setReferences(refs);\r
+    }\r
 \r
 }\r
diff --git a/org.tizen.ncli.ide/src/org/tizen/ncli/ide/subcommands/BuildWebCLICommandData.java b/org.tizen.ncli.ide/src/org/tizen/ncli/ide/subcommands/BuildWebCLICommandData.java
deleted file mode 100644 (file)
index 78e97e0..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-package org.tizen.ncli.ide.subcommands;\r
-\r
-import java.io.File;\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-\r
-public class BuildWebCLICommandData {\r
-\r
-       @Override\r
-       public String toString() {\r
-               StringBuilder builder = new StringBuilder();\r
-               builder.append("BuildWebCLICommandData [optimize=");\r
-               builder.append(optimize);\r
-               builder.append(", excludeUIFW=");\r
-               builder.append(excludeUIFW);\r
-               builder.append(", excludeList=");\r
-               builder.append(excludeList);\r
-               builder.append(", outputName=");\r
-               builder.append(outputName);\r
-               builder.append(", targetPath=");\r
-               builder.append(targetPath);\r
-               builder.append("]");\r
-               return builder.toString();\r
-       }\r
-\r
-       private boolean optimize;\r
-       private boolean excludeUIFW;\r
-       private List<String> excludeList = new ArrayList<String>();\r
-       private String outputName;\r
-       private File targetPath;\r
-       private File[] refs;\r
-\r
-       public BuildWebCLICommandData() {\r
-       }\r
-\r
-       public boolean isOptimize() {\r
-               return optimize;\r
-       }\r
-\r
-       public void setOptimize(boolean optimize) {\r
-               this.optimize = optimize;\r
-       }\r
-\r
-       public boolean isExcludeUIFW() {\r
-               return excludeUIFW;\r
-       }\r
-\r
-       public void setExcludeUIFW(boolean excludeUIFW) {\r
-               this.excludeUIFW = excludeUIFW;\r
-       }\r
-\r
-       public List<String> getExcludeList() {\r
-               return excludeList;\r
-       }\r
-\r
-       public void setExcludeList(List<String> excludeList) {\r
-               this.excludeList = excludeList;\r
-       }\r
-\r
-       public String getOutputName() {\r
-               return outputName;\r
-       }\r
-\r
-       public void setOutputName(String outputName) {\r
-               this.outputName = outputName;\r
-       }\r
-\r
-       public void setTargetPath(File targetPath) {\r
-               this.targetPath = targetPath;\r
-\r
-       }\r
-       \r
-       public void setReferences(File...refs) {\r
-               this.refs = refs;\r
-       }\r
-\r
-       public boolean hasReference() {\r
-               if( null != this.refs && this.refs.length > 0) {\r
-                       return true;\r
-               }else {\r
-                       return false;\r
-               }\r
-       }\r
-}
\ No newline at end of file
diff --git a/org.tizen.ncli.ide/test/src/org/tizen/core/ide/BuildWebAppModuleTest.java b/org.tizen.ncli.ide/test/src/org/tizen/core/ide/BuildWebAppModuleTest.java
new file mode 100644 (file)
index 0000000..244939e
--- /dev/null
@@ -0,0 +1,139 @@
+/*
+ * IDE
+ *
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Hyeongseok Heo <hyeongseok.heo@samsung.com>
+ * Kangho Kim <kh5325.kim@samsung.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.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ */
+package org.tizen.core.ide;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.fail;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.After;
+import org.junit.Assume;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.tizen.common.builder.exception.BuildException;
+import org.tizen.common.util.FileUtil;
+
+/**
+ * Test Case for {@link BuildWebAppModule}
+ * @author Harry Hyeongseok Heo{@literal <hyeongseok.heo@samsung.com>} (S-core)
+ *
+ * 
+ */
+public class BuildWebAppModuleTest {
+    private static final String TEST_PROJECT = "test/resources/testProject";
+
+    private Logger log = LoggerFactory.getLogger(getClass());
+    
+    private String output = ".buildResult";
+
+    private File cwdFile;
+
+    /**
+     * Test method for {@link org.tizen.core.ide.BuildWebAppModule#setCwd(java.lang.String)}.
+     */
+    @Ignore
+    @Test
+    public void testSetCwd() {
+        fail("Not yet implemented");
+    }
+
+    /**
+     * Test method for {@link org.tizen.core.ide.BuildWebAppModule#setOutput(java.lang.String)}.
+     */
+    @Ignore
+    @Test
+    public void testSetOutput() {
+        fail("Not yet implemented");
+    }
+    /**
+     * Test method for {@link org.tizen.core.ide.BuildWebAppModule#setExcludes(java.util.List)}.
+     */
+    @Ignore
+    @Test
+    public void testSetExcludes() {
+        fail("Not yet implemented");
+    }
+    
+    @Before
+    public void checkBeforeTest() {
+        cwdFile = new File(TEST_PROJECT);
+        log.trace("cwd:{}",cwdFile.getAbsolutePath());
+        log.trace("Exist? {}",cwdFile.exists());
+        //In case of out of container test , the test will be ignored.
+        Assume.assumeTrue(cwdFile.exists());
+    }
+
+    /**
+     * Test method for {@link org.tizen.core.ide.BuildWebAppModule#buildResources()}.
+     */
+    @Test
+    public void test_buildResources_exclude() {
+        BuildWebAppModule testObject = new BuildWebAppModule();
+        testObject.setCwd(cwdFile.getAbsolutePath());
+
+        // Setting build parameters
+        List<String> excludes = new ArrayList<String>();
+        excludes.add("section1.html");
+        BuildWebParameter buildParameter = new BuildWebParameter();
+        buildParameter.setExcludeList(excludes);
+        testObject.setData(buildParameter);
+
+        try {
+            // Test method call
+            testObject.buildResources();
+
+            // Assertion
+            File excludeFile = new File(TEST_PROJECT + File.separator + output + File.separator + "section1.html");
+            assertFalse(excludeFile.exists());
+        } catch (IOException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        } catch (BuildException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+            fail();
+        } catch (Exception e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+    }
+    
+    
+    @After
+    public void tearDown() {
+        File outputDir = new File(TEST_PROJECT+File.separator+output);
+        if( outputDir.exists()) {
+            FileUtil.recursiveDelete(outputDir);
+        }
+    }
+
+}
index a838c33..a77a7be 100644 (file)
-/*\r
- * IDE\r
- *\r
- * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.\r
- *\r
- * Contact:\r
- * Hyeongseok Heo <hyeongseok.heo@samsung.com>\r
- * Kangho Kim <kh5325.kim@samsung.com>\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
- * Contributors:\r
- * - S-Core Co., Ltd\r
- */\r
-package org.tizen.ncli.ide.subcommands;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-import java.io.File;\r
-\r
-import org.junit.AfterClass;\r
-import org.junit.BeforeClass;\r
-import org.junit.Test;\r
-import org.junit.runner.RunWith;\r
-import org.powermock.core.classloader.annotations.PowerMockIgnore;\r
-import org.powermock.core.classloader.annotations.PrepareForTest;\r
-import org.powermock.modules.junit4.PowerMockRunner;\r
-import org.tizen.common.util.FileUtil;\r
-import org.tizen.ncli.ide.core.config.TizenCLIConfigProvider;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertNotNull;\r
-import static org.junit.Assert.assertTrue;\r
-import static org.powermock.api.mockito.PowerMockito.doAnswer;\r
-import static org.powermock.api.mockito.PowerMockito.mockStatic;\r
-import static org.powermock.api.mockito.PowerMockito.spy;\r
-import static org.powermock.api.mockito.PowerMockito.when;\r
-import static org.powermock.api.mockito.PowerMockito.mock;\r
-import static org.powermock.api.mockito.PowerMockito.whenNew;\r
-\r
-/**\r
- * Test main logic of {@link BuildWebCLICommand#call()}\r
- * @author Harry Hyeongseok Heo{@literal <hyeongseok.heo@samsung.com>} (S-core)\r
- *\r
- * \r
- */\r
-@PowerMockIgnore({ "org.apache.log4j.*", "org.slf4j.Logger" })\r
-@RunWith(PowerMockRunner.class)\r
-public class BuildWebCLICommandCallTest {\r
-       \r
-       @BeforeClass\r
-       public static void setUpOnlyOnce() {\r
-       }\r
-\r
-       /**\r
-        * Test method for {@link org.tizen.ncli.ide.subcommands.BuildWebCLICommand#call()}.\r
-        * Test with testProject if build output is correct as expected.\r
-        */\r
-       @Test\r
-       public void testCall() {\r
-               File testProject = mock(File.class);\r
-               \r
-               \r
-               BuildWebCLICommand command = new BuildWebCLICommand();\r
-               command.setTargetPath(testProject);\r
-               command.setOutputName("test/resources/testProject/testBuildOutput");\r
-               command.setOptimize(true);\r
-               command.setExcludeUIFW(true);\r
-               \r
-               BuildWebCLICommandData buildData = command.runCommand();\r
-               assertNotNull(buildData);\r
-               \r
-//             File outputFolder = buildData.getResult();\r
-               \r
-               \r
-       }\r
-       \r
-//     @AfterClass\r
-       public static void tearDownOnlyOnce() {\r
-               File testProject = mock(File.class);\r
-               \r
-               if( null != testProject && testProject.exists()) {\r
-                       \r
-                       FileUtil.recursiveDelete(testProject);\r
-               }\r
-       }\r
-\r
-}\r
+/*
+ * IDE
+ *
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Hyeongseok Heo <hyeongseok.heo@samsung.com>
+ * Kangho Kim <kh5325.kim@samsung.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.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ */
+package org.tizen.ncli.ide.subcommands;
+
+import static org.junit.Assert.*;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.powermock.core.classloader.annotations.PowerMockIgnore;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+import org.tizen.common.util.FileUtil;
+import org.tizen.core.ide.BuildWebParameter;
+import org.tizen.ncli.ide.core.config.TizenCLIConfigProvider;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.powermock.api.mockito.PowerMockito.doAnswer;
+import static org.powermock.api.mockito.PowerMockito.mockStatic;
+import static org.powermock.api.mockito.PowerMockito.spy;
+import static org.powermock.api.mockito.PowerMockito.when;
+import static org.powermock.api.mockito.PowerMockito.mock;
+import static org.powermock.api.mockito.PowerMockito.whenNew;
+
+/**
+ * Test main logic of {@link BuildWebCLICommand#call()}
+ * 
+ * @author Harry Hyeongseok Heo{@literal <hyeongseok.heo@samsung.com>} (S-core)
+ * 
+ * 
+ */
+@PowerMockIgnore({ "org.apache.log4j.*", "org.slf4j.Logger" })
+@RunWith(PowerMockRunner.class)
+public class BuildWebCLICommandCallTest {
+
+    @BeforeClass
+    public static void setUpOnlyOnce() {
+    }
+
+    /**
+     * Test method for {@link org.tizen.ncli.ide.subcommands.BuildWebCLICommand#call()}. Test with testProject if build
+     * output is correct as expected.
+     * @throws Exception 
+     */
+    @Ignore
+    @Test
+    public void testCall() throws Exception {
+        // Prepare for test
+        File workingProject = mock(File.class);
+        whenNew(File.class).withArguments("/testProject").thenReturn(workingProject);
+        when(workingProject.getCanonicalPath()).thenReturn("/testProject");
+        when(workingProject.isDirectory()).thenReturn(Boolean.TRUE);
+        when(workingProject.exists()).thenReturn(Boolean.TRUE);
+        when(workingProject.canRead()).thenReturn(Boolean.TRUE);
+        
+        
+        
+        workingProject = new File("/testProject");
+
+        BuildWebCLICommand command = new BuildWebCLICommand();
+        command.setWorkingDir(workingProject);
+        command.setOutputName("testBuildOutput");
+        command.setOptimize(true);
+        command.setExcludeUIFW(true);
+        
+        
+
+        // Execute test method
+        BuildWebParameter buildData = command.runCommand();
+
+        // Assertion the result
+        assertNotNull(buildData);
+
+        // File outputFolder = buildData.getResult();
+
+    }
+
+    // @AfterClass
+    public static void tearDownOnlyOnce() {
+        File testProject = mock(File.class);
+
+        if (null != testProject && testProject.exists()) {
+
+            FileUtil.recursiveDelete(testProject);
+        }
+    }
+
+}
index d609bc5..f16b6ea 100644 (file)
@@ -31,72 +31,71 @@ import java.util.ArrayList;
 import java.util.List;\r
 \r
 import org.junit.Test;\r
+import org.tizen.core.ide.BuildWebParameter;\r
 \r
 /**\r
  * Test basic method of {@link BuildWebCLICommand}\r
  * \r
  * @author Harry Hyeongseok Heo{@literal <hyeongseok.heo@samsung.com>} (S-core)\r
- *\r
+ * \r
  * \r
  */\r
 public class BuildWebCLICommandTest {\r
 \r
-       \r
+    /**\r
+     * Test method for {@link org.tizen.ncli.ide.subcommands.BuildWebCLICommand#setOptimize(boolean)}.\r
+     */\r
+    @Test\r
+    public void testSetOptimize() {\r
+        BuildWebCLICommand command = new BuildWebCLICommand();\r
+        command.setOptimize(false);\r
+\r
+        BuildWebParameter buildData = command.runCommand();\r
+        assertNotNull(buildData);\r
+        assertEquals(false, buildData.isOptimize());\r
+\r
+    }\r
+\r
+    /**\r
+     * Test method for {@link org.tizen.ncli.ide.subcommands.BuildWebCLICommand#setOutputName(java.lang.String)}.\r
+     */\r
+    @Test\r
+    public void testSetOutputName() {\r
+        BuildWebCLICommand command = new BuildWebCLICommand();\r
+        command.setOutputName("TestBuildResult");\r
+\r
+        BuildWebParameter buildData = command.runCommand();\r
+        assertNotNull(buildData);\r
+        assertEquals("TestBuildResult", buildData.getOutputName());\r
+    }\r
+\r
+    /**\r
+     * Test method for {@link org.tizen.ncli.ide.subcommands.BuildWebCLICommand#setExcludeUIFW(boolean)}.\r
+     */\r
+    @Test\r
+    public void testSetExcludeUIFW() {\r
+        BuildWebCLICommand command = new BuildWebCLICommand();\r
+        command.setExcludeUIFW(true);\r
 \r
-       /**\r
-        * Test method for {@link org.tizen.ncli.ide.subcommands.BuildWebCLICommand#setOptimize(boolean)}.\r
-        */\r
-       @Test\r
-       public void testSetOptimize() {\r
-               BuildWebCLICommand command = new BuildWebCLICommand();\r
-               command.setOptimize(false);\r
-               \r
-               BuildWebCLICommandData buildData = command.runCommand();\r
-               assertNotNull(buildData);\r
-               assertEquals(false, buildData.isOptimize());\r
-               \r
-       }\r
+        BuildWebParameter buildData = command.runCommand();\r
+        assertNotNull(buildData);\r
+        assertEquals(true, buildData.isExcludeUIFW());\r
+    }\r
 \r
-       /**\r
-        * Test method for {@link org.tizen.ncli.ide.subcommands.BuildWebCLICommand#setOutputName(java.lang.String)}.\r
-        */\r
-       @Test\r
-       public void testSetOutputName() {\r
-               BuildWebCLICommand command = new BuildWebCLICommand();\r
-               command.setOutputName("TestBuildResult");\r
-               \r
-               BuildWebCLICommandData buildData = command.runCommand();\r
-               assertNotNull(buildData);\r
-               assertEquals("TestBuildResult", buildData.getOutputName());\r
-       }\r
+    /**\r
+     * Test method for {@link org.tizen.ncli.ide.subcommands.BuildWebCLICommand#setExcludeList(java.util.List)}.\r
+     */\r
+    @Test\r
+    public void testSetExcludeList() {\r
+        BuildWebCLICommand command = new BuildWebCLICommand();\r
+        List<String> excludeList = new ArrayList<String>();\r
+        excludeList.add(".git");\r
 \r
-       /**\r
-        * Test method for {@link org.tizen.ncli.ide.subcommands.BuildWebCLICommand#setExcludeUIFW(boolean)}.\r
-        */\r
-       @Test\r
-       public void testSetExcludeUIFW() {\r
-               BuildWebCLICommand command = new BuildWebCLICommand();\r
-               command.setExcludeUIFW(true);\r
-               \r
-               BuildWebCLICommandData buildData = command.runCommand();\r
-               assertNotNull(buildData);\r
-               assertEquals(true, buildData.isExcludeUIFW());\r
-       }\r
+        command.setExcludeList(excludeList);\r
 \r
-       /**\r
-        * Test method for {@link org.tizen.ncli.ide.subcommands.BuildWebCLICommand#setExcludeList(java.util.List)}.\r
-        */\r
-       @Test\r
-       public void testSetExcludeList() {\r
-               BuildWebCLICommand command = new BuildWebCLICommand();\r
-               List<String> excludeList = new ArrayList<String>();\r
-               excludeList.add(".git");\r
-               \r
-               command.setExcludeList(excludeList);\r
-               \r
-               BuildWebCLICommandData buildData = command.runCommand();\r
-               assertNotNull(buildData);               \r
-               assertEquals(".git", buildData.getExcludeList().get(0));\r
-       }\r
+        BuildWebParameter buildData = command.runCommand();\r
+        assertNotNull(buildData);\r
+        assertEquals(".git", buildData.getExcludeList().get(0));\r
+    }\r
 \r
 }\r
index 7546cc2..07447c8 100644 (file)
@@ -58,76 +58,73 @@ import org.tizen.ncli.ide.core.config.TizenCLIConfigProvider;
  * Test class for {@link ConfigCLICommand} <br>\r
  * \r
  * In this class , setting global or local configuration is tested.\r
+ * \r
  * @author Harry Hyeongseok Heo{@literal <hyeongseok.heo@samsung.com>} (S-core)\r
  * \r
  */\r
 @PowerMockIgnore({ "org.apache.log4j.*", "org.slf4j.Logger" })\r
 @RunWith(PowerMockRunner.class)\r
 @PrepareForTest(NCLIConfigLoader.class)\r
-public class ConfigCommandTest extends CommonCLISubCommandTest{\r
-       \r
-       @Before\r
-       public void setUp(){\r
-               \r
-               \r
-       }\r
-    \r
-    @PrepareForTest({NCLIConfigLoader.class,ConfigCLICommand.class})\r
+public class ConfigCommandTest extends CommonCLISubCommandTest {\r
+\r
+    @Before\r
+    public void setUp() {\r
+\r
+    }\r
+\r
+    @PrepareForTest({ NCLIConfigLoader.class, ConfigCLICommand.class })\r
     @Test\r
     public void test_setLocalConfig() throws Exception {\r
-         \r
-       File testFile = mock(File.class);\r
-       whenNew(File.class).withAnyArguments().thenReturn(testFile);\r
-       when(testFile.getName()).thenReturn(".tizen-cli-config");\r
-       when(testFile.getPath()).thenReturn("/tizen-sdk/tools/.tizen-cli-config");\r
-       when(testFile.exists()).thenReturn(true);\r
-       when(testFile.canWrite()).thenReturn(true);\r
-       \r
-       FileOutputStream mockFileOutputStream = mock(FileOutputStream.class);\r
-       whenNew(FileOutputStream.class).withAnyArguments().thenReturn(mockFileOutputStream);\r
-                  \r
-     //Mocking NCLIConfigLoader\r
-       mockStatic(NCLIConfigLoader.class);\r
-       when(NCLIConfigLoader.getLocalConfigFile()).thenReturn(testFile);\r
-       when(NCLIConfigLoader.loadLocalConf()).thenReturn(testLocalProp);\r
-       \r
-       \r
-       \r
-       ConfigCLICommand configCmd = new ConfigCLICommand();\r
-        \r
-       configCmd.setConfig("local.key.test", "this is LOCAL test value");\r
-        //method for test\r
+\r
+        File testFile = mock(File.class);\r
+        whenNew(File.class).withAnyArguments().thenReturn(testFile);\r
+        when(testFile.getName()).thenReturn(".tizen-cli-config");\r
+        when(testFile.getPath()).thenReturn("/tizen-sdk/tools/.tizen-cli-config");\r
+        when(testFile.exists()).thenReturn(true);\r
+        when(testFile.canWrite()).thenReturn(true);\r
+\r
+        FileOutputStream mockFileOutputStream = mock(FileOutputStream.class);\r
+        whenNew(FileOutputStream.class).withAnyArguments().thenReturn(mockFileOutputStream);\r
+\r
+        // Mocking NCLIConfigLoader\r
+        mockStatic(NCLIConfigLoader.class);\r
+        when(NCLIConfigLoader.getLocalConfigFile()).thenReturn(testFile);\r
+        when(NCLIConfigLoader.loadLocalConf()).thenReturn(testLocalProp);\r
+\r
+        ConfigCLICommand configCmd = new ConfigCLICommand();\r
+\r
+        configCmd.setConfig("local.key.test", "this is LOCAL test value");\r
+        // method for test\r
         Configuration cliConfig = configCmd.call();\r
         assertEquals("this is LOCAL test value", cliConfig.getLocalValue("local.key.test"));\r
-        \r
-        \r
+\r
     }\r
-    \r
-    @PrepareForTest({NCLIConfigLoader.class , ConfigCLICommand.class})\r
+\r
+    @PrepareForTest({ NCLIConfigLoader.class, ConfigCLICommand.class })\r
     @Test\r
     public void test_setGlobalConfig() throws Exception {\r
-       File testFile = mock(File.class);\r
+        File testFile = mock(File.class);\r
         whenNew(File.class).withAnyArguments().thenReturn(testFile);\r
         when(testFile.getName()).thenReturn(".tizen-cli-config");\r
         when(testFile.getPath()).thenReturn("/home/user/.tizen-cli-config");\r
         when(testFile.exists()).thenReturn(true);\r
         when(testFile.canWrite()).thenReturn(true);\r
-        \r
+\r
         FileOutputStream mockFileOutputStream = mock(FileOutputStream.class);\r
         whenNew(FileOutputStream.class).withAnyArguments().thenReturn(mockFileOutputStream);\r
-                  \r
-      //Mocking NCLIConfigLoader\r
+\r
+        // Mocking NCLIConfigLoader\r
         mockStatic(NCLIConfigLoader.class);\r
         when(NCLIConfigLoader.getGlobalConfigFile()).thenReturn(testFile);\r
         when(NCLIConfigLoader.loadGlobalConf()).thenReturn(testGlobalProp);\r
-        \r
+\r
         ConfigCLICommand configCmd = new ConfigCLICommand();\r
-         \r
+\r
         configCmd.setConfig("global.key.test", "this is GLOBAL test value");\r
         configCmd.setGlobal(true);\r
-         //method for test\r
-         Configuration cliConfig = configCmd.call();\r
-         assertEquals("this is GLOBAL test value", cliConfig.getGlobalValue("global.key.test"));\r
+        // method for test\r
+        Configuration cliConfig = configCmd.call();\r
+        assertEquals("this is GLOBAL test value", cliConfig.getGlobalValue("global.key.test"));\r
     }\r
 \r
 }\r