ã¯ããã«
ãGoogleã®ã¤ã³ãã©ã§å®è¡ãããã¯ã©ã¦ããµã¼ãã¹ Google App Engineã2009å¹´4æ7æ¥ã«Javaã«å¯¾å¿ãã¾ãããJavaã¨ã³ã¸ãã¢ã«ãå©ç¨ã§ããããã«ãªã£ããGoogle App Engineãä¸ç·ã«åå¼·ãã¦è¡ãã¾ãããï¼
ãä»åã¯Google App Engineãå©ç¨ããããã°ã©ã ã«Unitãã¹ããå®è¡ããæ¹æ³ãåå¼·ãããã¨æãã¾ãã
対象èªè
- ã¦ã§ããµã¼ãã¹éçºã«èå³ã®ããJavaã¨ã³ã¸ãã¢
- Google App Engine for Javaã«èå³ãããæ¹
å¿ è¦ãªç°å¢
- ãGoogle Plugin for Eclipseããã¤ã³ã¹ãã¼ã«ããã¦ãããEclipse 3.3ï¼Europaï¼ã3.4ï¼Ganymedeï¼
- Google Plugin for Eclipseã«å«ã¾ããApp Engine SDKã®ãã¼ã¸ã§ã³1.2.2以é
ãéçºç°å¢ã®æ§ç¯æé ã«ã¤ãã¦ã¯ã第1åã®è§£èª¬ãåç §ãã¦ãã ããã
ããã®é£è¼ãéå§ããåæã®é ã«ï¼»Google Plugin for Eclipseï¼½ãã»ããã¢ãããããæ¹ã¯ãApp Engine SDKã®ãã¼ã¸ã§ã³ã1.2.0ã1.2.1ã«ãªã£ã¦ããã¨æãã¾ããEclipseã®ã¡ãã¥ã¼ããï¼»Helpï¼½-ï¼»Software Updatesï¼½ã§ãï¼»Available Softwareï¼½ã¿ããé¸æããï¼»Google Update Site for Eclipse 3.Xï¼½ã«ãã§ãã¯ãå ¥ãã¦ï¼»Installï¼½ãã¿ã³ãæ¼ãã¦App Engine SDKãã¢ãããã¼ããã¦ä¸ããã
Unitãã¹ãã¨ã¯ï¼
ãUnitãã¹ãã¨ã¯ãåã ã®ã¢ã¸ã¥ã¼ã«ï¼é¨åï¼ã対象ã¨ãããã¹ãã§ãããã¹ãã®ç®çã¯ããã°ãäºåã«çºè¦ãã¦è£½åã®å質ãé«ãããã¨ã§ãã
ããã°ãæ©ã段éã§çºè¦ããè¨è¨ãå¼·åºã«ããææ³ã¨ãã¦ãå¥ç´ã«ããè¨è¨ï¼Design by Contractã以ä¸DbCï¼ã¨å¼ã°ããè¨è¨ææ³ãæå¹ã§ãããã¨ã¯10年以ä¸åãããã¼ãã©ã³ãã»ã¡ã¤ã¤ã¼æ°ã«ãã£ã¦æå±ããã¦ãã¾ããDbCã§ã¯ãåã ã®ã¢ã¸ã¥ã¼ã«ã次ã®3ã¤ã®æ¡ä»¶ãç¨ããå¥ç´ã¨ãã¦å®ç¾©ãã¾ãã
- äºåæ¡ä»¶ - å ¥åã«å¯¾ããæ¡ä»¶
- äºå¾æ¡ä»¶ - åºåã«å¯¾ããæ¡ä»¶
- ä¸å¤æ¡ä»¶ - å ¥åºåã«é¢ããã常ã«æç«ããæ¡ä»¶
ãJavaã®å ¬å¼ããã¥ã¡ã³ãã«ãDbCã«é¢ããè¨è¿°ããããã¨ãããåããããã«ãè¿å¹´ã§ã¯DbCã®æå¹æ§ãå¤ãã®éçºè ã«ãã£ã¦æ¯æããã¦ãã¾ãã
ãUnitãã¹ããç¨ãããã¨ã§ãããã°ã©ã ã«ä¿®æ£ãå ããå¾ã«ãDbCã®è¨è¨ãç ´å£ããã¦ããªããã¨ãè£åãããã¨ãã§ããDbCã®å ç¢æ§ãç¶æãããã¨ãã§ãã¾ãã
ãããã¸ã§ã¯ãã«ãã£ã¦ã¯ããã¹ãããã°ã©ã ãæ¸ãååãªæéããªãã£ããããã¹ãããã°ã©ã ãæ¸ãæåããªãã¾ã¾ã½ã¼ã¹ã³ã¼ãã大è¦æ¨¡åãã¦ãã¾ã£ã¦ãããã¨ãããã¨æãã¾ãã
ããããªå ´åã«ãç§ããªã¹ã¹ã¡ãã¦ããã®ã¯ãä¸åº¦ãã°ãçºçãããããã°ãå®äºããã¿ã¤ãã³ã°ã§ãä¿®æ£ããã¡ã½ããã«å¯¾ãã¦ãã¹ãããã°ã©ã ãæ¸ããã¨ã§ããã¡ã½ãã2ï½3åã«æ°ãã¿ã¼ã³ã®ãã¹ãããã°ã©ã ãæ¸ããã¨ã¯ãããªã«æéããããã¾ããã ãã°ã®æ··å ¥ç®æã«çµåµèããã¦ã¦å®ã£ã¦ãããããªã¤ã¡ã¼ã¸ã§ãã¹ãããã°ã©ã ãæ¸ãã¦ããã¾ããå¤ãã®å ´åããã°ãæ··å ¥ããããç®æã¨ããã®ã¯ããã°ã©ã å ¨ä½ã§ãéããã¦ããã®ã§ãå³å¹æ§ããããã¨ãå¤ãã§ãã
ããã®ããã«ãããã°ç¯å²ã«å¯¾ãã¦ããã¹ãããã°ã©ã ãéçºãããã¨ã§ãå°ãªãã¨ãèªåãéå»ã«ä¿®æ£ããç¯å²ã¯ãä»äººãä»è¿ã®ããã°ã©ã ãä¿®æ£ãããã¨ã«ãã£ã¦åããªããªããããªãã°ã¬ã¼ãããå®ããã¨ãã§ãã¾ãã
ApiProxyã使ã£ã¦ã¿ããï¼
ãApiProxyãå©ç¨ããã¨ãGoogle App Engineã®å ¨ãµã¼ãã¹ã«ã¢ã¯ã»ã¹ãããã¨ãã§ãã¾ãããã¹ãããã°ã©ã ã§ã¯ããã®ApiProxyãå©ç¨ãããã¨ã§åãµã¼ãã¹ã®ãã¼ã¿ã調ã¹ããã¨ã«ãªãã¾ãã
ãã¾ãã¯ã以ä¸ã®è¨å®ã§App Engineã®ããã¸ã§ã¯ããä½æãã¦ãã ãããä»åã¯GWTãå©ç¨ãã¾ããã®ã§ãUse Google Web Toolkitã®ãã§ãã¯ã¯ããºãã¦ä¸ããï¼ç¬¬2åã®è§£èª¬ãåç §ãã¦ä¸ããï¼ãã¾ããæ¥æ¬èªï¼2ãã¤ãã³ã¼ãï¼ãæ±ãããã®ã§ãè¨èªè¨å®ãå¿ ãï¼»UTF-8ï¼½ã«è¨å®ãã¦ãã ããã
Project name | UnitTest |
Package | com.daisukeyamashita.test.unit |
ã©ã¤ãã©ãªã®è¿½å
ãGoogle App Engineã§ã¯ãããã°ã©ã ã®ãã¹ããç°¡åã«ããããã«ããã¼ã«ã«ã®ãã¹ãç°å¢ç¨ã®ã¹ã¿ããç¨æããã¦ãã¾ããUnitãã¹ããå®è¡ããã«ã¯ãã¹ã¿ããå«ããããã¤ãã©ã¤ãã©ãªãå¥é追å ããå¿ è¦ãããã¾ãã
ãï¼»ããã¸ã§ã¯ãåï¼½ãå³ã¯ãªãã¯ããï¼»Propertiesï¼½ãé¸æãã¾ãã
ãï¼»Java Build Pathï¼½-ï¼»Librariesï¼½ã¿ãã§ãï¼»Add External JARsï¼½ãã¿ã³ãæ¼ãã¦ã以ä¸ã®2ã¤ã®ã©ã¤ãã©ãªã追å ãã¾ãã
ãå°ãæ·±ãã§ããã以ä¸ã®ãã£ã¬ã¯ããªã«ããappengine-api.stubs.jar
ã¨appengine-local-runtime.jar
ã追å ãã¾ãã
ï¼Eclipseã®ã¤ã³ã¹ãã¼ã«ãã£ã¬ã¯ããªï¼\plugins \com.google.appengine.eclipse.sdkbundle_1.2.2.v200907131030 \appengine-java-sdk-1.2.2\lib\
ãç¶ãã¦ãï¼»Add Libraryï¼½ãã¿ã³ãæ¼ãã¾ããï¼»JUnitï¼½ãé¸æãã¦ãï¼»Nextï¼½ãã¿ã³ãã¯ãªãã¯ãã¾ããJUnitã®ãã¼ã¸ã§ã³ãé¸æããç»é¢ã«åãæ¿ããã¾ãããJUnit3ãå©ç¨ããã®ã§ããã®ã¾ã¾ï¼»Finishï¼½ãã¿ã³ãã¯ãªãã¯ãã¾ãã