Eclipse 入門 - その2
Eclipse 入門 - その1
Junit 入門(HelloWorld) - その1
import org.junit.*;
import static org.junit.Assert.*;
public class StringTest {
@Test
public void testHelloWorld() {
HelloWorld world = new HelloWorld();
assertNotNull(world);
assertEquals("Hello World.", world.sayHelloWorld());
}
}
public class HelloWorld {
public static void main (String[] args) {
HelloWorld word = new HelloWorld();
System.out.println(word.sayHelloWorld());
}
public String sayHelloWorld() {
return "Hello World.";
}
}
- 雑談
- メソッド "sayHelloWorld" で逃げた
- JUnitは "メソッドを実行し、その戻り値を検証する" モノかなーってw(勝手な妄想を)
Grails 入門 - その1
Welcome to Grails 1.3.5 - http://grails.org/
Licensed under Apache Standard License 2.0
Grails home is set to: /opt/local/share/java/grails
Base Directory: ~/grails
Resolving dependencies...
Downloading: /opt/local/share/java/grails/lib/gpars-0.9.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/lib/svnkit-1.3.1.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/lib/ant-1.7.1.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/lib/ant-launcher-1.7.1.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/lib/ant-junit-1.7.1.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/lib/ant-nodeps-1.7.1.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/lib/ant-trax-1.7.1.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/lib/jline-0.9.94.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/lib/jansi-1.2.1.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/lib/serializer-2.7.1.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/dist/grails-docs-1.3.5.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/dist/grails-bootstrap-1.3.5.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/dist/grails-scripts-1.3.5.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/dist/grails-core-1.3.5.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/dist/grails-resources-1.3.5.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/dist/grails-web-1.3.5.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/lib/slf4j-api-1.5.8.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/lib/slf4j-log4j12-1.5.8.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/lib/org.springframework.test-3.0.3.RELEASE.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/lib/concurrentlinkedhashmap-lru-1.0_jdk5.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/lib/servlet-api-2.5.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/lib/jsp-api-2.1.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/lib/groovy-all-1.7.5.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/lib/commons-beanutils-1.8.0.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/lib/commons-el-1.0.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/lib/commons-validator-1.3.1.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/lib/aopalliance-1.0.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/lib/commons-codec-1.3.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/lib/commons-collections-3.2.1.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/lib/commons-io-1.4.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/lib/commons-lang-2.4.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/lib/jta-1.1.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/lib/ejb3-persistence-1.0.2.GA.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/lib/sitemesh-2.4.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/dist/grails-crud-1.3.5.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/dist/grails-gorm-1.3.5.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/dist/grails-spring-1.3.5.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/lib/org.springframework.core-3.0.3.RELEASE.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/lib/org.springframework.aop-3.0.3.RELEASE.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/lib/org.springframework.aspects-3.0.3.RELEASE.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/lib/org.springframework.asm-3.0.3.RELEASE.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/lib/org.springframework.beans-3.0.3.RELEASE.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/lib/org.springframework.context-3.0.3.RELEASE.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/lib/org.springframework.context.support-3.0.3.RELEASE.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/lib/org.springframework.expression-3.0.3.RELEASE.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/lib/org.springframework.instrument-3.0.3.RELEASE.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/lib/org.springframework.jdbc-3.0.3.RELEASE.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/lib/org.springframework.jms-3.0.3.RELEASE.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/lib/org.springframework.orm-3.0.3.RELEASE.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/lib/org.springframework.oxm-3.0.3.RELEASE.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/lib/org.springframework.transaction-3.0.3.RELEASE.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/lib/org.springframework.web-3.0.3.RELEASE.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/lib/org.springframework.web.servlet-3.0.3.RELEASE.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/lib/aspectjweaver-1.6.8.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/lib/aspectjrt-1.6.8.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/lib/cglib-nodep-2.1_3.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/lib/commons-fileupload-1.2.1.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/lib/oro-2.0.8.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/lib/jstl-1.1.2.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/lib/commons-dbcp-1.2.2.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/lib/commons-pool-1.5.3.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/lib/hsqldb-1.8.0.10.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/lib/ehcache-core-1.7.1.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/lib/log4j-1.2.16.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/lib/jcl-over-slf4j-1.5.8.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/lib/jul-to-slf4j-1.5.8.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/lib/standard-1.1.2.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/lib/xpp3_min-1.1.3.4.O.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/lib/junit-4.8.1.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/dist/grails-test-1.3.5.jar ...
Download complete.
Dependencies resolved in 1662ms.
Running script /opt/local/share/java/grails/scripts/CreateApp_.groovy
Environment set to development
[mkdir] Created dir: ~/grails/helloworld/src
[mkdir] Created dir: ~/grails/helloworld/src/java
[mkdir] Created dir: ~/grails/helloworld/src/groovy
[mkdir] Created dir: ~/grails/helloworld/grails-app
[mkdir] Created dir: ~/grails/helloworld/grails-app/controllers
[mkdir] Created dir: ~/grails/helloworld/grails-app/services
[mkdir] Created dir: ~/grails/helloworld/grails-app/domain
[mkdir] Created dir: ~/grails/helloworld/grails-app/taglib
[mkdir] Created dir: ~/grails/helloworld/grails-app/utils
[mkdir] Created dir: ~/grails/helloworld/grails-app/views
[mkdir] Created dir: ~/grails/helloworld/grails-app/views/layouts
[mkdir] Created dir: ~/grails/helloworld/grails-app/i18n
[mkdir] Created dir: ~/grails/helloworld/grails-app/conf
[mkdir] Created dir: ~/grails/helloworld/test
[mkdir] Created dir: ~/grails/helloworld/test/unit
[mkdir] Created dir: ~/grails/helloworld/test/integration
[mkdir] Created dir: ~/grails/helloworld/scripts
[mkdir] Created dir: ~/grails/helloworld/web-app
[mkdir] Created dir: ~/grails/helloworld/web-app/js
[mkdir] Created dir: ~/grails/helloworld/web-app/css
[mkdir] Created dir: ~/grails/helloworld/web-app/images
[mkdir] Created dir: ~/grails/helloworld/web-app/META-INF
[mkdir] Created dir: ~/grails/helloworld/lib
[mkdir] Created dir: ~/grails/helloworld/grails-app/conf/spring
[mkdir] Created dir: ~/grails/helloworld/grails-app/conf/hibernate
[propertyfile] Creating new property file: ~/grails/helloworld/application.properties
[copy] Copying 1 resource to ~/grails/helloworld
[unjar] Expanding: ~/grails/helloworld/grails-shared-files.jar into ~/grails/helloworld
[delete] Deleting: ~/grails/helloworld/grails-shared-files.jar
[copy] Copying 1 resource to ~/grails/helloworld
[unjar] Expanding: ~/grails/helloworld/grails-app-files.jar into ~/grails/helloworld
[delete] Deleting: ~/grails/helloworld/grails-app-files.jar
[copy] Copying 1 resource to ~/.grails/1.3.5/projects/grails/integration-files
[unjar] Expanding: ~/.grails/1.3.5/projects/grails/integration-files/grails-integration-files.jar into ~/.grails/1.3.5/projects/grails/integration-files
[delete] Deleting: ~/.grails/1.3.5/projects/grails/integration-files/grails-integration-files.jar
[copy] Copying 3 files to ~/grails/helloworld
Created Eclipse project files.
Installing zip /opt/local/share/java/grails/plugins/grails-hibernate-1.3.5.zip... ...
[mkdir] Created dir: ~/.grails/1.3.5/projects/helloworld/plugins/hibernate-1.3.5
[unzip] Expanding: /opt/local/share/java/grails/plugins/grails-hibernate-1.3.5.zip into ~/.grails/1.3.5/projects/helloworld/plugins/hibernate-1.3.5
Installed plugin hibernate-1.3.5 to location ~/.grails/1.3.5/projects/helloworld/plugins/hibernate-1.3.5. ...
Resolving plugin JAR dependencies ...
Downloading: /opt/local/share/java/grails/lib/hibernate-core-3.3.1.GA.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/lib/hibernate-commons-annotations-3.1.0.GA.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/lib/hibernate-annotations-3.4.0.GA.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/lib/javassist-3.11.0.GA.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/lib/antlr-2.7.6.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/lib/dom4j-1.6.1.jar ...
Download complete.
Downloading: /opt/local/share/java/grails/lib/hibernate-ehcache-3.3.1.GA.jar ...
Download complete.
Executing hibernate-1.3.5 plugin post-install script ...
Plugin hibernate-1.3.5 installed
[delete] Deleting directory ~/.grails/1.3.5/projects/grails/resources
Installing zip /opt/local/share/java/grails/plugins/grails-tomcat-1.3.5.zip... ...
[mkdir] Created dir: ~/.grails/1.3.5/projects/helloworld/plugins/tomcat-1.3.5
[unzip] Expanding: /opt/local/share/java/grails/plugins/grails-tomcat-1.3.5.zip into ~/.grails/1.3.5/projects/helloworld/plugins/tomcat-1.3.5
Installed plugin tomcat-1.3.5 to location ~/.grails/1.3.5/projects/helloworld/plugins/tomcat-1.3.5. ...
Executing tomcat-1.3.5 plugin post-install script ...
Plugin tomcat-1.3.5 installed
Plugin provides the following new scripts:
- -
grails tomcat
Created Grails Application at ~/grails/helloworld
Welcome to Grails 1.3.5 - http://grails.org/
Licensed under Apache Standard License 2.0
Grails home is set to: /opt/local/share/java/grails
Base Directory: ~/grails/helloworld
Resolving dependencies...
Dependencies resolved in 1070ms.
Running script /opt/local/share/java/grails/scripts/CreateDomainClass.groovy
Environment set to development
[mkdir] Created dir: ~/.grails/1.3.5/projects/helloworld/plugin-classes
[groovyc] Compiling 2 source files to ~/.grails/1.3.5/projects/helloworld/plugin-classes
[mkdir] Created dir: ~/grails/helloworld/target/classes
[groovyc] Compiling 7 source files to ~/grails/helloworld/target/classes
[mkdir] Created dir: ~/grails/helloworld/grails-app/domain/helloworld
Created DomainClass for Hello
[groovyc] Compiling 1 source file to ~/grails/helloworld/target/classes
[mkdir] Created dir: ~/grails/helloworld/test/unit/helloworld
Created Tests for Hello
class Hello {
String message
}
Welcome to Grails 1.3.5 - http://grails.org/
Licensed under Apache Standard License 2.0
Grails home is set to: /opt/local/share/java/grails
Base Directory: ~/grails/helloworld
Resolving dependencies...
Dependencies resolved in 1162ms.
Running script /opt/local/share/java/grails/scripts/CreateController.groovy
Environment set to development
[groovyc] Compiling 1 source file to ~/grails/helloworld/target/classes
[mkdir] Created dir: ~/grails/helloworld/grails-app/controllers/helloworld
Created Controller for Hello
[mkdir] Created dir: ~/grails/helloworld/grails-app/views/hello
[groovyc] Compiling 1 source file to ~/grails/helloworld/target/classes
Created Tests for Hello
class HelloController {
def scaffold = true
}
Welcome to Grails 1.3.5 - http://grails.org/
Licensed under Apache Standard License 2.0
Grails home is set to: /opt/local/share/java/grails
Base Directory: ~/grails/helloworld
Resolving dependencies...
Dependencies resolved in 1172ms.
Running script /opt/local/share/java/grails/scripts/RunApp.groovy
Environment set to development
[copy] Copied 3 empty directories to 3 empty directories under ~/.grails/1.3.5/projects/helloworld/resources
[groovyc] Compiling 1 source file to ~/grails/helloworld/target/classes
[mkdir] Created dir: ~/.grails/1.3.5/projects/helloworld/resources/grails-app/i18n
[native2ascii] Converting 13 files from ~/grails/helloworld/grails-app/i18n to ~/.grails/1.3.5/projects/helloworld/resources/grails-app/i18n
[copy] Copying 1 file to ~/grails/helloworld/target/classes
[copy] Copied 2 empty directories to 2 empty directories under /.grails/1.3.5/projects/helloworld/resources
Running Grails application..
Server running. Browse to http://localhost:8080/helloworld
- ブラウザで http://localhost:8080/helloworld にアクセス
Grails インストール
Warning: port definitions are more than two weeks old, consider using selfupdate
- > Computing dependencies for grails
- > Fetching grails
- > Attempting to fetch grails-1.3.5.zip from http://distfiles.macports.org/grails
- > Verifying checksum(s) for grails
- > Extracting grails
- > Configuring grails
- > Building grails
- > Staging grails into destroot
- > Installing grails @1.3.5_1
- > Activating grails @1.3.5_1
****************************************************************************
* Remember to set the environment variable GRAILS_HOME to the path to
* the grails distribution: /opt/local/share/java/grails
****************************************************************************
- > Cleaning grails
Welcome to Grails 1.3.5 - http://grails.org/
Licensed under Apache Standard License 2.0
Grails home is set to: /opt/local/share/java/grails
No script name specified. Use 'grails help' for more info or 'grails interactive' to enter interactive mode
Groovy インストール
- Groovy : http://groovy.codehaus.org/
- MacBook% sudo port install groovy
Warning: port definitions are more than two weeks old, consider using selfupdate
- > Computing dependencies for groovy
- > Fetching groovy
- > Attempting to fetch groovy-src-1.7.5.zip from http://distfiles.macports.org/groovy
- > Verifying checksum(s) for groovy
- > Extracting groovy
- > Configuring groovy
- > Building groovy
- > Staging groovy into destroot
- > Installing groovy @1.7.5_0
- > Activating groovy @1.7.5_0
- > Cleaning groovy
- MacBook% groovy -v
Groovy Version: 1.7.5 JVM: 1.6.0_22