[Title] modified PlatformTemplateLoader class for unit test 21/10321/1
authorGun Kim <gune.kim@samsung.com>
Sun, 29 Sep 2013 07:18:11 +0000 (16:18 +0900)
committerGun Kim <gune.kim@samsung.com>
Sun, 29 Sep 2013 07:57:10 +0000 (16:57 +0900)
[Type]
[Module]
[Priority]
[Jira#]
[Redmine#]
[Problem]
[Cause]
[Solution]
[TestCase]

org.tizen.common.ui/src/org/tizen/common/ui/wizards/PlatformTemplateLoader.java
org.tizen.common/src/org/tizen/common/core/application/TizenProjectDescription.java

index af776e0..9c2e8d1 100644 (file)
@@ -27,6 +27,7 @@ package org.tizen.common.ui.wizards;
 \r
 import java.io.File;\r
 import java.io.FileNotFoundException;\r
+import java.util.ArrayList;\r
 import java.util.HashMap;\r
 import java.util.List;\r
 import java.util.Map;\r
@@ -76,6 +77,17 @@ public class PlatformTemplateLoader {
             return platformTemplateMap;\r
         }\r
     }\r
+    \r
+    public List<File> loadPlatformSamples(ProfileInfo profileInfo) {\r
+        File rootPath = getSampleRoot(profileInfo, profileInfo.getLatestPlatformVersion(), subDir);\r
+        try {\r
+            List<File> templates = FileUtil.findFiles(rootPath, fileName, true);\r
+            return templates;\r
+        } catch (FileNotFoundException e) {\r
+            logger.warn("Failed to load template from " + rootPath);\r
+            return new ArrayList<File>(0);\r
+        }\r
+    }\r
 \r
     public static void mapToPlatformName(String[] categories, ProfileInfo profileInfo) {\r
         // We are using the flattened PlatformPathInfo, so we can use the latest path/version as its path/version.\r
index 3ae7f60..5101d0c 100644 (file)
@@ -68,10 +68,10 @@ public class TizenProjectDescription {
         }
 
         ProfileInfo profileInfo = InstallPathConfig.getProfileInfo(profile);
-        String path = profileInfo.getPlatformPath(version);
-        if ( path == null ) {
-            return null;
+        if ( profileInfo == null ) {
+            return new ProfileInfo(profile, version, null);
         }
+        String path = profileInfo.getPlatformPath(version);
 
         return new ProfileInfo(profile, version, path);
     }