Skip to content

Commit 8f47976

Browse files
committed
Move themes to resources folder and move rabbitmqTest.java to test folder.
1 parent ba82c4e commit 8f47976

12 files changed

Lines changed: 28 additions & 73 deletions

File tree

.project

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<projectDescription>
3-
<name>test</name>
3+
<name>tinystruct2.0</name>
44
<comment></comment>
55
<projects>
66
</projects>

pom.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@
3131
<artifactId>amqp-client</artifactId>
3232
<version>5.6.0</version>
3333
</dependency>
34+
<!-- https://mvnrepository.com/artifact/junit/junit -->
35+
<dependency>
36+
<groupId>junit</groupId>
37+
<artifactId>junit</artifactId>
38+
<version>4.12</version>
39+
<scope>test</scope>
40+
</dependency>
41+
3442
</dependencies>
3543
<properties>
3644
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

src/main/java/application.properties

Lines changed: 0 additions & 47 deletions
This file was deleted.

src/main/java/tinystruct/examples/hello.java

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
import org.tinystruct.system.Configuration;
99
import org.tinystruct.system.Settings;
1010

11+
import java.lang.reflect.InvocationTargetException;
12+
1113
public class hello extends AbstractApplication {
1214

1315
@Override
@@ -20,15 +22,14 @@ public void init() {
2022

2123
@Override
2224
public String version() {
23-
System.out.println("tinystruct version 2.0.1");
24-
return null;
25+
return "tinystruct version 2.0.1";
2526
}
2627

2728
public String say(String words){
2829
return words;
2930
}
3031

31-
public String smile() throws ApplicationException{
32+
public String smile() {
3233
return ":)";
3334
}
3435

@@ -42,15 +43,15 @@ public hello render() {
4243
* @throws IllegalAccessException
4344
* @throws InstantiationException
4445
*/
45-
public static void main(String[] args) throws ApplicationException, InstantiationException, IllegalAccessException {
46+
public static void main(String[] args) throws ApplicationException, InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException {
4647
// Praise to the Lord!
4748
ApplicationManager.install(new hello());
4849

4950
// to print 'Hello World'
5051
ApplicationManager.call("say/Hello World", null); // Hello World
51-
52+
5253
// or...
53-
Application app=ApplicationManager.get( hello.class.getName());
54+
Application app=ApplicationManager.get( hello.class.getName());
5455
app.invoke("say", new Object[]{"<h1>Hello, World!</h1>"}); // <h1>Hello, World!</h1>
5556
app.invoke("say", new Object[]{"<h2>Bye!</h2>"}); // <h2>Bye!</h2>
5657

@@ -59,10 +60,12 @@ public static void main(String[] args) throws ApplicationException, Instantiatio
5960

6061
// to run nothing
6162
ApplicationManager.call("smile", null); // Looks nothing
62-
63+
6364
// What will be happened?
6465
System.out.println(ApplicationManager.call("smile", null)); // Will render the default template
65-
66+
ApplicationManager.call("render", null); // Will render the default template
67+
68+
6669
// Use ClassFileLoader to load Java class
6770
ClassFileLoader loader = ClassFileLoader.getInstance();
6871

@@ -72,7 +75,7 @@ public static void main(String[] args) throws ApplicationException, Instantiatio
7275

7376
Class<?> clz = loader.findClass("hello");
7477
if(clz!=null && clz.getSuperclass().equals(AbstractApplication.class)) {
75-
ApplicationManager.install((Application) clz.newInstance());
78+
ApplicationManager.install((Application) (clz.getDeclaredConstructor().newInstance()));
7679
ApplicationManager.call("say/Merry Christmas!", null);
7780
}
7881
}

src/main/resources/application.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ default.error.page=error
2828
[event]
2929
log.status=off
3030
log.file=
31-
system.directory=/Users/mover/applications/tinystruct2.0
31+
system.directory=/development/tinystruct2.0
3232

3333
[mail]
3434
mail.ssl.on = true

0 commit comments

Comments
 (0)