2018/7/30

使用CLI執行JUnit

java -cp .:$JENKINS_HOME/workspace/junit-4.12.jar:$JENKINS_HOME/workspace/hamcrest-core-1.3.jar org.junit.runner.JUnitCore EmployeeTest

2018/7/26

Spring Security的開發

一開始的需求很簡單,就是為Reatful Service弄個Basic access authentication,才發現需要看的文件零零散散的,原本是再找Spring Boot的Security,看一看還是要看到Spring的Security專案。
目前先把重要的文件先寫下來,細節以後有空再寫。

IntelliJ IDEA Mac的快速鍵

格式化程式碼 ⌥⌘L
刪除現在這行⌘delete
自動完成(當提示的下拉選單消失時,想手動叫出)⌃+space
把游標目前所在位置的單字選取起來⌃+g

關閉重複程式碼的波浪底線提示,如下圖:
IntelliJ很像預設會幫你把包括其他程式檔案中有重複的程式碼就會用波浪底線標起來,這樣其實很難看,可參考下圖把它提示關掉:
右邊的Weak Warning換成No highlighting,only fix,這樣波浪底線就會不見了

參考:

2018/7/22

GCP - Google Compute Engine

Google  Compute Engine是GCP提供的雲端服務,可提供使用者創造VM
這裡貼上上次用過的一些圖片

2018/7/14

用Spring Boot使用JPA開發Restful Service

JPA是啥在這目前就不多說明,這篇要寫的是如何用Spring Boot使用JPA開發Restful Service
資料庫用的是MySQL
使用Spring Web MVC框架來開發Restful Service
具體要做的事情是寫一個Restful Service,用JPA對MySQL做資料的存取

用Spring Boot開發的Restful Service範例程式

GET請求:
@RestController
@RequestMapping("/member")
public class WebController {

    @RequestMapping(value = "/firstname/{firstName}", method = {RequestMethod.GET})
    @ResponseBody
    public String queryFirstName(@PathVariable String firstName) {
        return firstName;
    }
}
然後可以用以下的網址來下請求
kiki是這個Web App的Context
使用PathVariable標註就可以取得URL的參數了,之後看要怎麼做後續的處理,這裡將queryFirstName這個method用ResponseBody標注起來,這樣此method回傳的東西就會變成此Service回應的Body,所以此Service就會回應Bloom

2018/7/2

FCF-流程模式與應用劇本的Flow

[
    {
        "id": "323ee37d.6efdfc",
        "type": "FCF-facebook-receive",
        "z": "7225b89d.d54578",
        "bot": "98bd3fe8.c4eb5",
        "x": 170,
        "y": 220,
        "wires": [
            [
                "51b76bf5.8eb624"
            ]
        ]
    },
    {
        "id": "1c4ca252.ccb9ae",
        "type": "FCF-facebook-send",
        "z": "7225b89d.d54578",
        "bot": "98bd3fe8.c4eb5",
        "track": false,
        "outputs": 0,
        "x": 660,
        "y": 220,
        "wires": []
    },
    {
        "id": "4f119c6d.ef24b4",
        "type": "FCF-Message",
        "z": "7225b89d.d54578",
        "name": "",
        "message": [
            ""
        ],
        "answer": false,
        "track": false,
        "parse_mode": "",
        "x": 480,
        "y": 260,
        "wires": [
            [
                "1c4ca252.ccb9ae"
            ]
        ]
    },
    {
        "id": "a3adcc67.610ab",
        "type": "FCF-Message",
        "z": "7225b89d.d54578",
        "name": "",
        "message": [
            ""
        ],
        "answer": false,
        "track": false,
        "parse_mode": "",
        "x": 480,
        "y": 180,
        "wires": [
            [
                "1c4ca252.ccb9ae"
            ]
        ]
    },
    {
        "id": "51b76bf5.8eb624",
        "type": "FCF-Dispatcher",
        "z": "7225b89d.d54578",
        "agentCredentials": "98d94233.f1991",
        "rules": [
            {
                "topic": "1"
            },
            {
                "topic": "2"
            }
        ],
        "outputs": 2,
        "x": 330,
        "y": 220,
        "wires": [
            [
                "a3adcc67.610ab"
            ],
            [
                "4f119c6d.ef24b4"
            ]
        ]
    },
    {
        "id": "5f898829.198678",
        "type": "FCF-facebook-receive",
        "z": "7225b89d.d54578",
        "bot": "98bd3fe8.c4eb5",
        "x": 170,
        "y": 400,
        "wires": [
            [
                "bf264e22.fcbda"
            ]
        ]
    },
    {
        "id": "bf264e22.fcbda",
        "type": "FCF-DataCollection",
        "z": "7225b89d.d54578",
        "rules": [
            {
                "messageContent": "",
                "variableName": ""
            }
        ],
        "collect": "query",
        "whetherToSendLocation": false,
        "x": 360,
        "y": 420,
        "wires": [
            [
                "a5221b3.c77bce8"
            ],
            [
                "db8eb49f.47fbc8"
            ]
        ]
    },
    {
        "id": "a5221b3.c77bce8",
        "type": "FCF-Message",
        "z": "7225b89d.d54578",
        "name": "",
        "message": [
            ""
        ],
        "answer": false,
        "track": false,
        "parse_mode": "",
        "x": 540,
        "y": 380,
        "wires": [
            [
                "94a4d4c5.4cb968"
            ]
        ]
    },
    {
        "id": "db8eb49f.47fbc8",
        "type": "FCF-Frame",
        "z": "7225b89d.d54578",
        "rules": [
            {
                "topic": ""
            }
        ],
        "name": "",
        "token": "",
        "outputs": 1,
        "x": 530,
        "y": 460,
        "wires": [
            []
        ]
    },
    {
        "id": "94a4d4c5.4cb968",
        "type": "FCF-facebook-send",
        "z": "7225b89d.d54578",
        "bot": "98bd3fe8.c4eb5",
        "track": true,
        "outputs": 1,
        "x": 700,
        "y": 380,
        "wires": [
            [
                "2d2adb84.8afa54"
            ]
        ]
    },
    {
        "id": "7f1b1e2d.afb1f",
        "type": "link in",
        "z": "7225b89d.d54578",
        "name": "",
        "links": [],
        "x": 235,
        "y": 440,
        "wires": [
            [
                "bf264e22.fcbda"
            ]
        ]
    },
    {
        "id": "2d2adb84.8afa54",
        "type": "link out",
        "z": "7225b89d.d54578",
        "name": "",
        "links": [],
        "x": 815,
        "y": 420,
        "wires": []
    },
    {
        "id": "e6ac8553.b72108",
        "type": "FCF-facebook-receive",
        "z": "7225b89d.d54578",
        "bot": "98bd3fe8.c4eb5",
        "x": 170,
        "y": 560,
        "wires": [
            [
                "f9321e63.486ff"
            ]
        ]
    },
    {
        "id": "f9321e63.486ff",
        "type": "FCF-KeywordExtraction",
        "z": "7225b89d.d54578",
        "agentCredentials": "8bfe4fb9.6e799",
        "outputs": 1,
        "x": 350,
        "y": 560,
        "wires": [
            [
                "2d50afb9.35264"
            ]
        ]
    },
    {
        "id": "2d50afb9.35264",
        "type": "FCF-Frame",
        "z": "7225b89d.d54578",
        "rules": [
            {
                "topic": ""
            }
        ],
        "name": "",
        "token": "",
        "outputs": 1,
        "x": 510,
        "y": 560,
        "wires": [
            []
        ]
    },
    {
        "id": "9f7571fa.a4cb7",
        "type": "FCF-facebook-receive",
        "z": "7225b89d.d54578",
        "bot": "98bd3fe8.c4eb5",
        "x": 170,
        "y": 680,
        "wires": [
            [
                "f1aae794.c7d3d8"
            ]
        ]
    },
    {
        "id": "f1aae794.c7d3d8",
        "type": "FCF-KeywordExtraction",
        "z": "7225b89d.d54578",
        "agentCredentials": "8bfe4fb9.6e799",
        "outputs": 1,
        "x": 350,
        "y": 720,
        "wires": [
            [
                "67f97e49.aea55"
            ]
        ]
    },
    {
        "id": "67f97e49.aea55",
        "type": "FCF-Frame",
        "z": "7225b89d.d54578",
        "rules": [
            {
                "topic": ""
            }
        ],
        "name": "",
        "token": "",
        "outputs": 1,
        "x": 470,
        "y": 780,
        "wires": [
            [
                "82ede6fe.6b7e88"
            ]
        ]
    },
    {
        "id": "dd20d2ac.d81a",
        "type": "FCF-Frame",
        "z": "7225b89d.d54578",
        "rules": [
            {
                "topic": ""
            }
        ],
        "name": "",
        "token": "",
        "outputs": 1,
        "x": 710,
        "y": 780,
        "wires": [
            [
                "e9976f71.071f7"
            ]
        ]
    },
    {
        "id": "82ede6fe.6b7e88",
        "type": "FCF-PullService",
        "z": "7225b89d.d54578",
        "rules": [
            {
                "topic": ""
            }
        ],
        "URL": "",
        "outputs": 1,
        "x": 590,
        "y": 720,
        "wires": [
            [
                "dd20d2ac.d81a"
            ]
        ]
    },
    {
        "id": "e9976f71.071f7",
        "type": "FCF-Message",
        "z": "7225b89d.d54578",
        "name": "",
        "message": [
            ""
        ],
        "answer": false,
        "track": false,
        "parse_mode": "",
        "x": 800,
        "y": 720,
        "wires": [
            [
                "69be43fd.b2aa9c"
            ]
        ]
    },
    {
        "id": "69be43fd.b2aa9c",
        "type": "FCF-facebook-send",
        "z": "7225b89d.d54578",
        "bot": "98bd3fe8.c4eb5",
        "track": false,
        "outputs": 0,
        "x": 960,
        "y": 680,
        "wires": []
    },
    {
        "id": "f57f4766.7b55f8",
        "type": "FCF-PushService",
        "z": "7225b89d.d54578",
        "url": "",
        "outputs": 1,
        "x": 260,
        "y": 960,
        "wires": [
            [
                "e8b5486a.36b398"
            ]
        ]
    },
    {
        "id": "e8b5486a.36b398",
        "type": "FCF-FacebookNotification",
        "z": "7225b89d.d54578",
        "outputs": 0,
        "x": 480,
        "y": 960,
        "wires": []
    },
    {
        "id": "167babdc.d9d9e4",
        "type": "FCF-facebook-receive",
        "z": "7225b89d.d54578",
        "bot": "98bd3fe8.c4eb5",
        "x": 150,
        "y": 1140,
        "wires": [
            [
                "ed6c88fd.a94938"
            ]
        ]
    },
    {
        "id": "c47078e0.004cf8",
        "type": "FCF-facebook-send",
        "z": "7225b89d.d54578",
        "bot": "98bd3fe8.c4eb5",
        "track": false,
        "outputs": 0,
        "x": 660,
        "y": 1140,
        "wires": []
    },
    {
        "id": "604ab498.ce1e1c",
        "type": "FCF-Message",
        "z": "7225b89d.d54578",
        "name": "",
        "message": [
            ""
        ],
        "answer": false,
        "track": false,
        "parse_mode": "",
        "x": 480,
        "y": 1140,
        "wires": [
            [
                "c47078e0.004cf8"
            ]
        ]
    },
    {
        "id": "c56eae30.bd8e8",
        "type": "FCF-Message",
        "z": "7225b89d.d54578",
        "name": "",
        "message": [
            ""
        ],
        "answer": false,
        "track": false,
        "parse_mode": "",
        "x": 480,
        "y": 1100,
        "wires": [
            [
                "c47078e0.004cf8"
            ]
        ]
    },
    {
        "id": "ed6c88fd.a94938",
        "type": "FCF-Dispatcher",
        "z": "7225b89d.d54578",
        "agentCredentials": "98d94233.f1991",
        "rules": [
            {
                "topic": "1"
            },
            {
                "topic": "2"
            },
            {
                "topic": "3"
            }
        ],
        "outputs": 3,
        "x": 310,
        "y": 1140,
        "wires": [
            [
                "c56eae30.bd8e8"
            ],
            [
                "604ab498.ce1e1c"
            ],
            [
                "aad1b308.ba045"
            ]
        ]
    },
    {
        "id": "aad1b308.ba045",
        "type": "FCF-Message",
        "z": "7225b89d.d54578",
        "name": "",
        "message": [
            ""
        ],
        "answer": false,
        "track": false,
        "parse_mode": "",
        "x": 480,
        "y": 1180,
        "wires": [
            [
                "c47078e0.004cf8"
            ]
        ]
    },
    {
        "id": "a32945ea.46d568",
        "type": "FCF-facebook-receive",
        "z": "7225b89d.d54578",
        "bot": "98bd3fe8.c4eb5",
        "x": 110,
        "y": 1320,
        "wires": [
            [
                "1bf9c33c.44097d"
            ]
        ]
    },
    {
        "id": "1bf9c33c.44097d",
        "type": "FCF-DataCollection",
        "z": "7225b89d.d54578",
        "rules": [
            {
                "messageContent": "",
                "variableName": ""
            }
        ],
        "collect": "query",
        "whetherToSendLocation": false,
        "x": 300,
        "y": 1320,
        "wires": [
            [
                "8a82ce0.362663"
            ],
            [
                "6e965d22.745e24"
            ]
        ]
    },
    {
        "id": "8a82ce0.362663",
        "type": "FCF-Message",
        "z": "7225b89d.d54578",
        "name": "",
        "message": [
            ""
        ],
        "answer": false,
        "track": false,
        "parse_mode": "",
        "x": 460,
        "y": 1280,
        "wires": [
            [
                "94b356c9.59d7a8"
            ]
        ]
    },
    {
        "id": "94b356c9.59d7a8",
        "type": "FCF-facebook-send",
        "z": "7225b89d.d54578",
        "bot": "98bd3fe8.c4eb5",
        "track": true,
        "outputs": 1,
        "x": 620,
        "y": 1280,
        "wires": [
            [
                "9080ee19.6ba83"
            ]
        ]
    },
    {
        "id": "cadf217c.f77d8",
        "type": "FCF-facebook-send",
        "z": "7225b89d.d54578",
        "bot": "98bd3fe8.c4eb5",
        "track": true,
        "outputs": 1,
        "x": 1020,
        "y": 1360,
        "wires": [
            [
                "7dcc91eb.ae87"
            ]
        ]
    },
    {
        "id": "6e965d22.745e24",
        "type": "FCF-Frame",
        "z": "7225b89d.d54578",
        "rules": [
            {
                "topic": ""
            }
        ],
        "name": "",
        "token": "",
        "outputs": 1,
        "x": 450,
        "y": 1360,
        "wires": [
            [
                "e3a2384c.2743c8"
            ]
        ]
    },
    {
        "id": "e3a2384c.2743c8",
        "type": "FCF-PullService",
        "z": "7225b89d.d54578",
        "rules": [
            {
                "topic": ""
            }
        ],
        "URL": "",
        "outputs": 1,
        "x": 590,
        "y": 1360,
        "wires": [
            [
                "63ce94e.f45f86c"
            ]
        ]
    },
    {
        "id": "63ce94e.f45f86c",
        "type": "FCF-Message",
        "z": "7225b89d.d54578",
        "name": "",
        "message": [
            ""
        ],
        "answer": false,
        "track": false,
        "parse_mode": "",
        "x": 740,
        "y": 1360,
        "wires": [
            [
                "6efbea33.442e24"
            ]
        ]
    },
    {
        "id": "ba204130.7fcfd",
        "type": "link in",
        "z": "7225b89d.d54578",
        "name": "",
        "links": [],
        "x": 175,
        "y": 1280,
        "wires": [
            [
                "1bf9c33c.44097d"
            ]
        ]
    },
    {
        "id": "9080ee19.6ba83",
        "type": "link out",
        "z": "7225b89d.d54578",
        "name": "",
        "links": [],
        "x": 735,
        "y": 1280,
        "wires": []
    },
    {
        "id": "6efbea33.442e24",
        "type": "FCF-Frame",
        "z": "7225b89d.d54578",
        "rules": [
            {
                "topic": ""
            }
        ],
        "name": "",
        "token": "",
        "outputs": 1,
        "x": 870,
        "y": 1360,
        "wires": [
            [
                "cadf217c.f77d8"
            ]
        ]
    },
    {
        "id": "7dcc91eb.ae87",
        "type": "FCF-Dispatcher",
        "z": "7225b89d.d54578",
        "agentCredentials": "98d94233.f1991",
        "rules": [
            {
                "topic": "1"
            },
            {
                "topic": "2"
            },
            {
                "topic": "3"
            }
        ],
        "outputs": 3,
        "x": 1190,
        "y": 1360,
        "wires": [
            [
                "ddd81121.4ab91"
            ],
            [
                "96fa6890.2b3448"
            ],
            [
                "ec067ee.6f27e8"
            ]
        ]
    },
    {
        "id": "ddd81121.4ab91",
        "type": "link out",
        "z": "7225b89d.d54578",
        "name": "",
        "links": [],
        "x": 1315,
        "y": 1320,
        "wires": []
    },
    {
        "id": "96fa6890.2b3448",
        "type": "link out",
        "z": "7225b89d.d54578",
        "name": "",
        "links": [],
        "x": 1315,
        "y": 1360,
        "wires": []
    },
    {
        "id": "ec067ee.6f27e8",
        "type": "link out",
        "z": "7225b89d.d54578",
        "name": "",
        "links": [],
        "x": 1315,
        "y": 1400,
        "wires": []
    },
    {
        "id": "e09bc8da.162608",
        "type": "FCF-facebook-send",
        "z": "7225b89d.d54578",
        "bot": "98bd3fe8.c4eb5",
        "track": true,
        "outputs": 1,
        "x": 700,
        "y": 1480,
        "wires": [
            [
                "707a5063.bc556"
            ]
        ]
    },
    {
        "id": "75fae486.edaf6c",
        "type": "FCF-Message",
        "z": "7225b89d.d54578",
        "name": "",
        "message": [
            ""
        ],
        "answer": false,
        "track": false,
        "parse_mode": "",
        "x": 520,
        "y": 1480,
        "wires": [
            [
                "e09bc8da.162608"
            ]
        ]
    },
    {
        "id": "46f59e9b.47c33",
        "type": "FCF-Message",
        "z": "7225b89d.d54578",
        "name": "",
        "message": [
            ""
        ],
        "answer": false,
        "track": false,
        "parse_mode": "",
        "x": 520,
        "y": 1440,
        "wires": [
            [
                "e09bc8da.162608"
            ]
        ]
    },
    {
        "id": "11451281.6f087d",
        "type": "FCF-Dispatcher",
        "z": "7225b89d.d54578",
        "agentCredentials": "98d94233.f1991",
        "rules": [
            {
                "topic": "1"
            },
            {
                "topic": "2"
            },
            {
                "topic": "3"
            }
        ],
        "outputs": 3,
        "x": 350,
        "y": 1480,
        "wires": [
            [
                "46f59e9b.47c33"
            ],
            [
                "75fae486.edaf6c"
            ],
            [
                "c72b8a00.f2c228"
            ]
        ]
    },
    {
        "id": "c72b8a00.f2c228",
        "type": "FCF-Message",
        "z": "7225b89d.d54578",
        "name": "",
        "message": [
            ""
        ],
        "answer": false,
        "track": false,
        "parse_mode": "",
        "x": 520,
        "y": 1520,
        "wires": [
            [
                "e09bc8da.162608"
            ]
        ]
    },
    {
        "id": "e25201da.27ef5",
        "type": "link in",
        "z": "7225b89d.d54578",
        "name": "",
        "links": [],
        "x": 235,
        "y": 1480,
        "wires": [
            [
                "11451281.6f087d"
            ]
        ]
    },
    {
        "id": "707a5063.bc556",
        "type": "link out",
        "z": "7225b89d.d54578",
        "name": "",
        "links": [],
        "x": 815,
        "y": 1480,
        "wires": []
    },
    {
        "id": "2487dbad.576004",
        "type": "link in",
        "z": "7225b89d.d54578",
        "name": "",
        "links": [],
        "x": 175,
        "y": 1620,
        "wires": [
            [
                "cf18aefc.51bc2"
            ]
        ]
    },
    {
        "id": "cf18aefc.51bc2",
        "type": "FCF-DataCollection",
        "z": "7225b89d.d54578",
        "rules": [
            {
                "messageContent": "",
                "variableName": ""
            }
        ],
        "collect": "query",
        "whetherToSendLocation": false,
        "x": 300,
        "y": 1620,
        "wires": [
            [
                "7c46d3c4.c860ec"
            ],
            [
                "7e6d6425.8e04ac"
            ]
        ]
    },
    {
        "id": "7c46d3c4.c860ec",
        "type": "FCF-Message",
        "z": "7225b89d.d54578",
        "name": "",
        "message": [
            ""
        ],
        "answer": false,
        "track": false,
        "parse_mode": "",
        "x": 460,
        "y": 1580,
        "wires": [
            [
                "fe25289.77ed6d8"
            ]
        ]
    },
    {
        "id": "fe25289.77ed6d8",
        "type": "FCF-facebook-send",
        "z": "7225b89d.d54578",
        "bot": "98bd3fe8.c4eb5",
        "track": true,
        "outputs": 1,
        "x": 620,
        "y": 1580,
        "wires": [
            [
                "2900348e.dea8cc"
            ]
        ]
    },
    {
        "id": "2900348e.dea8cc",
        "type": "link out",
        "z": "7225b89d.d54578",
        "name": "",
        "links": [],
        "x": 735,
        "y": 1580,
        "wires": []
    },
    {
        "id": "7e6d6425.8e04ac",
        "type": "FCF-Frame",
        "z": "7225b89d.d54578",
        "rules": [
            {
                "topic": ""
            }
        ],
        "name": "",
        "token": "",
        "outputs": 1,
        "x": 450,
        "y": 1640,
        "wires": [
            [
                "439da3bc.95e1dc"
            ]
        ]
    },
    {
        "id": "439da3bc.95e1dc",
        "type": "FCF-PullService",
        "z": "7225b89d.d54578",
        "rules": [
            {
                "topic": ""
            }
        ],
        "URL": "",
        "outputs": 1,
        "x": 590,
        "y": 1640,
        "wires": [
            [
                "40b75a0f.d7adb4"
            ]
        ]
    },
    {
        "id": "40b75a0f.d7adb4",
        "type": "FCF-Message",
        "z": "7225b89d.d54578",
        "name": "",
        "message": [
            ""
        ],
        "answer": false,
        "track": false,
        "parse_mode": "",
        "x": 740,
        "y": 1640,
        "wires": [
            [
                "f3bffd26.80274"
            ]
        ]
    },
    {
        "id": "f3bffd26.80274",
        "type": "FCF-facebook-send",
        "z": "7225b89d.d54578",
        "bot": "98bd3fe8.c4eb5",
        "track": false,
        "outputs": 0,
        "x": 900,
        "y": 1640,
        "wires": []
    },
    {
        "id": "22711368.c2bf3c",
        "type": "link in",
        "z": "7225b89d.d54578",
        "name": "",
        "links": [],
        "x": 1075,
        "y": 1300,
        "wires": [
            [
                "7dcc91eb.ae87"
            ]
        ]
    },
    {
        "id": "4b092aa9.3f6174",
        "type": "FCF-KeywordExtraction",
        "z": "7225b89d.d54578",
        "agentCredentials": "8bfe4fb9.6e799",
        "outputs": 1,
        "x": 290,
        "y": 1400,
        "wires": [
            [
                "6e965d22.745e24"
            ]
        ]
    },
    {
        "id": "1b9e5c8f.2b5153",
        "type": "link in",
        "z": "7225b89d.d54578",
        "name": "",
        "links": [],
        "x": 155,
        "y": 1400,
        "wires": [
            [
                "4b092aa9.3f6174"
            ]
        ]
    },
    {
        "id": "98bd3fe8.c4eb5",
        "type": "FCF-facebook-node",
        "z": "",
        "botname": "PhoneBot"
    },
    {
        "id": "98d94233.f1991",
        "type": "FCF-DialogflowConfig",
        "z": "",
        "agentName": "AirConditioningBot"
    },
    {
        "id": "8bfe4fb9.6e799",
        "type": "FCF-DialogflowConfig",
        "z": "",
        "agentName": "ParkingBot"
    }
]