Total Pageviews

2014/12/09

How to mock autowired fields via Mockito

Problem
Assume we wrote a calculation service which provide add and subtract service.
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
import lombok.extern.slf4j.Slf4j;

import org.springframework.stereotype.Service;

/**
 * The Class CalculationService.
 */
@Service
@Slf4j
public class CalculationService {

    public int add(int num1, int num2) {
        return num1 + num2;
    }
    
    public int subtract(int num1, int num2) {
        return num1 - num2;
    }
    
}

If we would like to do unit test for CalculationService class, and autowire CalculationService into service class as bellows:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import static org.junit.Assert.assertEquals;
import gov.nta.nss.service.CalculationService;

import org.junit.Before;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

public class CalculationServiceTest {

    /* Inject CalculationService */
    @Autowired
    private CalculationService service;

    /* Test add function in CalculationService */
    @Test
    public void testAdd() {
        // arrange & act
        int result = service.add(6, 5);

        // assert
        assertEquals(11, result);
    }

    /* Test subtract function in CalculationService */
    @Test
    public void testSubtract() {
        // arrange & act
        int result = service.subtract(6, 5);

        // assert
        assertEquals(1, result);
    }

}

As I executed this test class, it returned NullPointerException. This exception result from failed to autowire CalculationService. How to overcome this problem?



Solution
We can mock autowired fields by Mockito to solve this problem. Here is the revised test code:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import static org.junit.Assert.assertEquals;
import gov.nta.nss.service.CalculationService;

import org.junit.Before;
import org.junit.Test;
import org.mockito.InjectMocks;
import org.mockito.MockitoAnnotations;

public class CalculationServiceTest {

    /* Inject CalculationService */
    @InjectMocks
    private CalculationService service;

    /* Initialized mocks */
    @Before
    public void setUp() {
        MockitoAnnotations.initMocks(this);
    }

    /* Test add function in CalculationService */
    @Test
    public void testAdd() {
        // arrange & act
        int result = service.add(6, 5);

        // assert
        assertEquals(11, result);
    }

    /* Test subtract function in CalculationService */
    @Test
    public void testSubtract() {
        // arrange & act
        int result = service.subtract(6, 5);

        // assert
        assertEquals(1, result);
    }

}

Test result is bellowing:


Reference
[1] http://lkrnac.net/blog/2014/01/mock-autowired-fields/
[2] http://docs.mockito.googlecode.com/hg/org/mockito/Mockito.html


2014/12/05

How to implement indexOf in Oracle

Requirement
In Java, we can use indexOf method if we would like to return the index within this string of the first occurrence of the specified character. For instance, if we would like to get the characters which before left parenthesis, we can do this way. 

1
2
3
4
5
6
    public static void main(String[] args) {
        String str1 = "ABC(12345)";
        String str2 = "BC(34567)";
        System.out.println(str1.substring(0, str1.indexOf("(")));
        System.out.println(str2.substring(0, str2.indexOf("(")));
    }

But Oracle does not provide OOTB(Out of The Box) function to fulfill this requirement.

How to do 
We can make good use of INSTR function, the syntax is:

The INSTR functions search string for substring. The function returns an integer indicating the position of the character in string that is the first character of this occurrence. INSTR calculates strings using characters as defined by the input character set. INSTRB uses bytes instead of characters. INSTRC uses Unicode complete characters. INSTR2 uses UCS2 code points. INSTR4 uses UCS4 code points.

  • position is an nonzero integer indicating the character of string where Oracle Database begins the search. If position is negative, then Oracle counts backward from the end of string and then searches backward from the resulting position.
  • occurrence is an integer indicating which occurrence of string Oracle should search for. The value of occurrence must be positive.

Here has an example to fulfill this requirement:
1
2
SELECT SUBSTR('ABC(12345)', 0, INSTR('ABC(12345)', '(', 1, 1)-1) FROM DUAL;
SELECT SUBSTR('BC(34567)', 0, INSTR('BC(34567)', '(', 1, 1)-1 ) FROM DUAL;


Reference
[1] https://docs.oracle.com/cd/B19306_01/server.102/b14200/functions068.htm#i77598
[2] http://fanli7.net/a/shujuku/Oracle/20120615/171956.html

2014/12/01

[閱讀筆記] 史丹佛給你讀得懂的經濟學

  1. 所得不均的問題在於流動性,處於所得分配最底層的人會往上升一點,但很少能持續移動到最上層。同樣的,處於所得分配最頂層的人可能會往後退,但很少一直退到最底層
  2. 社會救助的兩難,他應該像高空盪韆表演者下方的安全網,緩衝你掉落的力道,也幫助妳再彈上去。但常常因為社會救助產生就業鎖,因為就業獲得收入卻因此失去社會救助,產生負所得稅問題
  3. 總體經濟政策的四個目標是:經濟成長、低失業率、低通貨膨脹率、可支應成長的貿易餘額
  4. GDP(國內生產毛額)的定義是:計算一個經濟體一年內所生產的最終產品和服務的總價值,GDP可以根據產銷的商品價值,或需求與購買的商品價值來衡量。GDP = 消費 + 投資 + 政府支出 + 出口 - 進口
  5. 所得最低的國家,並不是因為全球化才變窮,而是因為和全世界其他地區脫節才變更窮
  6. 生產力成長的三大驅動因子是:實體資本增加(更多個資本設備讓員工使用)、更多的人力資本(員工有更多的經驗或教育)以及更好個技術(更有效率的生產方式)
  7. 工資提昇的基礎在於增加員工的平均生產力(及更好的教育投資)、更好的實體資本設備投資,以及發明並採用新技術。當一個國家可以把這三個因素結合在一起,就能達成工作好且薪資佳的理想目標
  8. 政府預算赤字上升,以下三件事的某些組合必然會發生:私人儲蓄上升、私人投資下降、外資流入增加
  9. 如果政府借越來越多錢來管理他的赤字,就會降低民間企業可取得用於投資的資金。因此政府借款增加意味著私人投資減少,相反的,政府借款減少表示企業可以取得更多資金用於投資
  10. 新廠房與新設備的實體資本投資,是經濟成長的基本元素之一,也是把新技術導入生產流程的關鍵方式之一。如果政府使預算赤字降低,企業可以取得更多資金,更容易採用新技術,有助於長期經濟成長。若預算赤字偏高,就會排擠私人投資,影響未來經濟成長
  11. 經濟學家把社會上具備以下三個功能的任何物品定義為貨幣:交易媒介、價值儲存、計價單位。房屋可以作為價值儲存,可以累積價值且可以賣掉他;但是房屋不能作為交易媒介,你不能買一台車時付給業務員一間臥室;房屋無法作為計價單位,你不知道一磅雞肉值多少浴室
  12. 銀行拼命放款時,由於這些放款造成購買力增加,社會將出現大量的總和需求。反之,若經濟不景氣,銀行可能決定減少貸款,避免錢收不回來。此時,社會的購買力和總和需求會減少。如果放款金額減少,就會對整個社會的經濟活動造成影響
  13. 中央銀行有三個傳統工具,可以在銀行與貨幣的架構內運作:法定準備金(reserve requirement)、重貼現率(discount rate)、公開市場操作(open market operation)
  14. 法定準備金,是銀行不可放貸出去的存款比例。當法定準備率提高時,銀行可以貸出的貨幣就變少,民間可獲得的貸款減少,總和需求就會縮小,市場利率提昇,借款變得較不吸引人;相反的,若法定準備金下降,市場利率就會下降,借款代價就會降低
  15. 重貼現率,是央行可以助長或抑制放款的另一種方式。如果中央銀行提高重貼現率,就會股利銀行手頭持有貨幣,銀行就會少貸出一些錢,降低了市場上的貨幣數量。相反的,如果降低重貼現率,銀行就會多貸出一些錢,增加市場上的貨幣供給
  16. 公開市場操作,是指中央銀行購買或銷售債券,藉以增加或減少貨幣供給。當聯準會購買債券,銀行就會擁有現金,而且可以增加他的放款金額,總和需求隨之上升。如果連準備賣債券給銀行,就會減少銀行今,銀行放款變少,民間流通的貨幣變少,總和需求就會下降
  17. 公開市場操作是近幾十年來,美國最常用的貨幣政策,主要的理由是,改變法定準備率與重貼現率,需要預測銀行如何因應這些規則變化,這是一個不確定的過程。但是透過公開市場操作,連準備決定買賣特定數量的債券,變能對市場利率變化來看結果,然後決定買賣更多或更少的債券
  18. 聯準會如果想讓貨幣供給變大,他有四個選擇;降低法定準備率、降低重貼現率、向銀行購買債券,或是購買與借款有關的證券。這些措施都可以稱為擴張性(或寬鬆)的貨幣政策
  19. 擴張性或寬鬆的貨幣政策,不會降低自然失業率。自然失業率,取決於動態市場裡勞動的供給與需求,會受到工作及雇用的誘因影響,如影響員工行為的福利與失業津貼,以及影響雇用成本與員工行為的規章制度
  20. 當通膨率出現負數時,稱作通貨緊縮(deflation),意即貨幣的購買力沒有隨著時間變低,反而隨著時間變得更有價值。聽起來不是一件壞事,但是當通貨緊縮與利率相互作用時,會造成貨幣政策難以處理的經濟衰退
  21. 實質利率=名目利率-通膨率,如果名目利率是7%,通膨率是-2%(通貨緊縮),實質利率變成9%,此時借款人的實質利率變高,導致銀行大量放款變成呆帳,銀行會變得無意承做新貸款,導致總體經濟需求下降,導致經濟衰退
  22. 當價格上升不是出於商品本身的任何特色,而是因為投資人期望價格持續上升時,稱之為泡沫。泡沫會創造其自身的動能,因為很多人突然購買,往往會推升價格,當足夠茤的人認清泡沫無法維持的時候,價格就會暴跌
  23. 貨幣政策像拉或推一條繩子,拉繩子時,他會向你移動,但你推繩子時,它會彎折起來而繩尾不動如山。當中因銀行透過收縮性政策拉繩子時,它可以明確地提高利率並降低總和需求;但若試圖透過擴張性政策推繩子,只要銀行仍決定不放款,那麼貨幣政策不會有任何效果
  24. 相似商品跨國界的貿易,會對國內生產者造成更大的競爭,然而競爭並非壞事,競爭有助於低價與創新
  25. 保護主義是政府對國內產業提供間接補貼,但國內消費者卻要用較高的價格買單
  26. 國際貿易的開放與閉鎖,與整體就業水準無關。循環性失業與經濟榮枯有關,自然失業率則與勞動市場誘因有關。保護主義不會讓就業機會變多,自由貿易也不會使就業機會減少
  27. 窮國與富國的差距越來越大,是因為窮國缺乏貿易,沒有參與全球化。例如日本、南韓、中國以及印度,都是運用對外貿易作為主要成長引擎之一
  28. 強勢貨幣有助於外國資金的淨流入,弱勢貨幣則會抑制資金流入。換句話說,強勢美元有助於外國人投資美國資產,而不是購買美國商品。反之,弱勢美元有助於外國人購買美國製的出口品,而不是投資美國資產
  29. 遭遇金融危機的國家都有某些共同點:國家GDP會大幅萎縮。如墨西哥在1995年萎縮6%、印尼在1998年萎縮13%、阿根廷在2002年萎縮11%
  30. 外資分成兩類:一是購買有形的公司或工廠的直接投資,二是購買股票或債券等金融工具的證券投資。直接投資比較不可能迅速撤出,因為一時衝動賣掉工廠是有難度的,而且直接投資者比較偏向長期收益。故如果中小型國家打算管制外資,鼓勵直接投資是可能的最佳方法


2014/11/30

2014/11 Travel

石門水庫

光之穹頂 Dome of Light

駁二藝術特區


E-DA ROYAL HOTEL


2014/11/21

2014/11/20

[Oracle] Customize ADD_DAYS function in ROC era system

Requirement
I am using ROC era system as my date format (ex. 1031120 represents 20141120).
If I would like to create an Oracle function to do add days just like the Oracle build-in function ADD_MONTHS.

Solution
Here is my tailor-made Oracle function.
ADD_DAYS returns the date date plus integer days. 

  • The MINGUO_YYYMMDD argument only accept ROC era system as  date format, ex. 1031120.
  • The integer argument, DAYS, can be an integer or any value that can be implicitly converted to an integer. 
  • The return type is always VARCHAR2 with  ROC era system as  date format.
  • If date is the last day of the month or if the resulting month has fewer days than the day component of date, then the result is the last day of the resulting month. Otherwise, the result has the same day component as date.


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
create or replace FUNCTION ADD_DAYS 
(
  MINGUO_YYYMMDD IN VARCHAR2 --CHINESE YEAR
, DAYS IN NUMBER --5 MEANS ADD 5 DAYS, -3 MEANS SUBSTRACT 3 DAYS
) 
RETURN VARCHAR2 IS NEW_MINGUO_YYY_MM_DD VARCHAR2(7); --RETURN RESULT
BEGIN
  SELECT NEW_MINGUO_YYY_MM_DD 
  INTO NEW_MINGUO_YYY_MM_DD
  FROM(
    SELECT SUBSTR(TO_CHAR(TO_DATE(SUBSTR(MINGUO_YYYMMDD, 0, 3)+1911 || SUBSTR(MINGUO_YYYMMDD, 4, 4), 'YYYYMMDD')+DAYS, 'YYYYMMDD'), 0, 4)-1911 ||
            SUBSTR(TO_CHAR(TO_DATE(SUBSTR(MINGUO_YYYMMDD, 0, 3)+1911 || SUBSTR(MINGUO_YYYMMDD, 4, 4), 'YYYYMMDD')+DAYS, 'YYYYMMDD'), 5, 4) AS NEW_MINGUO_YYY_MM_DD
    FROM DUAL
  );
  RETURN NEW_MINGUO_YYY_MM_DD;
END ADD_DAYS;

Test
Add 5 days

1
SELECT ADD_DAYS('1031120', 5) FROM DUAL;



Subtract 3 days
1
SELECT ADD_DAYS('1030803', -3) FROM DUAL;







2014/11/18

[Oracle] How to add serial number for each record

Requirement
Here is my SQL statement to do query:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
SELECT YYY_MM,
       ASP,
       ITEM_CD,
       ITEM_NM,
       AMT_A,
       AMT_B,
       AMT_C
FROM FMS420FA
WHERE YYY_MM='10210'
ORDER BY ASP

Query result:

If I would like to add serial number for each record as bellowing, how to do it?


Solution
We can make good use of ROW_NUMBER function. ROW_NUMBER is an analytic function. It assigns a unique number to each row to which it is applied (either each row in the partition or each row returned by the query), in the ordered sequence of rows specified in the order_by_clause, beginning with 1.


The SQL statement had been revised as following:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
SELECT ROW_NUMBER() OVER (PARTITION BY YYY_MM
                          ORDER BY ASP) SEQ,
                                        YYY_MM,
                                        ASP,
                                        ITEM_CD,
                                        ITEM_NM,
                                        AMT_A,
                                        AMT_B,
                                        AMT_C
FROM FMS420FA
WHERE YYY_MM='10210'



Reference
[1] https://docs.oracle.com/cd/B19306_01/server.102/b14200/functions137.htm

An internal error occurred during: "Initializing Java Tooling". Duplicate field name&signature in class file org/eclipse/jdt/internal/compiler/ast/ASTNode

Problem
I change to a brand new workspace to import project from gitlab.
After imported and try to do maven => update projects, it show "An internal error occurred during: "Initializing Java Tooling". Duplicate field name&signature in class file org/eclipse/jdt/internal/compiler/ast/ASTNode". 

Here has its screenshot:


Root Cause
This error results from lombok's bug. 


Solution
Step1. Shut down your eclipse
Step2. Go to here to download the jar file : http://projectlombok.org/download-edge.html
Step3. follow the instructions in  http://projectlombok.org/download-edge.html
Step4. Startup your eclipse and do again.



Reference
[1] http://stackoverflow.com/questions/21931107/eclipse-wont-switch-workspace

2014/11/13

How to Convert Oracle rows to columns

Requirement
Here has my query SQL statement.
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
SELECT SUBSTR(PDATE, 0, 5) AS YYY_MM,
       ROUND(SUM(NVL(PAY_T_BILL, 0))/100000000, 0) AS PAY_T_BILL
FROM FMS406VD
WHERE SUBSTR(PDATE, 0, 5) IN ('10201',
                              '10202',
                              '10203',
                              '10204',
                              '10205',
                              '10206',
                              '10207',
                              '10208',
                              '10209',
                              '10210',
                              '10211',
                              '10212')
  AND BL_ROC_YM = SUBSTR(PDATE, 0, 5)
GROUP BY SUBSTR(PDATE, 0, 5)
ORDER BY SUBSTR(PDATE, 0, 5)


Here is the query result

If I would like to convert row into column, how to do it?

Solution
You can make good use of PIVOT to fulfill this requirement. The SQL statement can be re-written into this way

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
SELECT AMT1, AMT2, AMT3, AMT4, AMT5, AMT6, AMT7, AMT8, AMT9, AMT10, AMT11, AMT12
          FROM(
          SELECT SUBSTR(PDATE, 0, 5) AS YYY_MM,
                 ROUND(SUM(NVL(PAY_T_BILL, 0))/100000000, 0) AS PAY_T_BILL
          FROM FMS406VD   
          WHERE SUBSTR(PDATE, 0, 5) IN ('10201', 
                                        '10202', 
                                        '10203', 
                                        '10204', 
                                        '10205', 
                                        '10206', 
                                        '10207', 
                                        '10208', 
                                        '10209', 
                                        '10210', 
                                        '10211',  
                                        '10212' )
                AND BL_ROC_YM = SUBSTR(PDATE, 0, 5)
          GROUP BY SUBSTR(PDATE, 0, 5)          
          ORDER BY SUBSTR(PDATE, 0, 5)
          )
          PIVOT(SUM(PAY_T_BILL) FOR YYY_MM IN (
                                          '10201' AS AMT1, 
                                          '10202' AS AMT2, 
                                          '10203' AS AMT3,
                                          '10204' AS AMT4,
                                          '10205' AS AMT5,
                                          '10206' AS AMT6,
                                          '10207' AS AMT7,
                                          '10208' AS AMT8,
                                          '10209' AS AMT9,
                                          '10210' AS AMT10,
                                          '10211' AS AMT11,
                                          '10212' AS AMT12))

The query result is as bellowing:


Reference
[1] http://www.oracle.com/technetwork/articles/sql/11g-pivot-097235.html

2014/11/12

What's the difference between 'commit' and 'commit and push' in Git?

When I want to commit changes into git repository, I see two options to commit. One is "Commit", another one is "Commit and Push".

Here has a clear picture
If you do git commit, it means you only commit changes into your local repository.
If you do git push, it means you will commit changes to remote repository.


Demo
If I click Commit

Remote repository does not know what happened.



 If I click "Commit and Push"

Remote repository received these changes.

Reference
[1] http://stackoverflow.com/questions/2745076/what-are-the-differences-between-git-commit-and-git-push

2014/11/11

How to create project in GitLab and import project into Eclipse

Go to GitLab to create my project
1. Click New Project
 2. Fill in your project name, namespace => Create project


Open Git Bash
1. Change directory to my specific dirctory => make dbm directory => Initialized empty Git repository
1:  albert@ALBERT-PC ~  
2:  $ cd d:  
3:  albert@ALBERT-PC /d  
4:  $ cd git  
5:  albert@ALBERT-PC /d/git  
6:  $ mkdir dbm  
7:  albert@ALBERT-PC /d/git  
8:  $ cd dbm  
9:  albert@ALBERT-PC /d/git/dbm  
10:  $ git init  
11:  Initialized empty Git repository in d:/git/dbm/.git/  

2. create README file => add README to track => commit
1:  albert@ALBERT-PC /d/git/dbm (master)  
2:  $ touch README  
3:  albert@ALBERT-PC /d/git/dbm (master)  
4:  $ git add README  
5:  albert@ALBERT-PC /d/git/dbm (master)  
6:  $ git commit -m "first commit"  
7:  [master (root-commit) b45a8a4] first commit  
8:   1 file changed, 0 insertions(+), 0 deletions(-)  
9:   create mode 100644 README  

3. add git remote repository => push to remote
1:  albert@ALBERT-PC /d/git/dbm (master)  
2:  $ git remote add origin http://192.168.31.166/ifmis/dbm.git  
3:  albert@ALBERT-PC /d/git/dbm (master)  
4:  $ git push -u origin master  
5:  Username for 'http://192.168.31.166': albert_kuo  
6:  Password for 'http://albert_kuo@192.168.31.166':  
7:  Counting objects: 3, done.  
8:  Writing objects: 100% (3/3), 206 bytes | 0 bytes/s, done.  
9:  Total 3 (delta 0), reused 0 (delta 0)  
10:  To http://192.168.31.166/ifmis/dbm.git  
11:   * [new branch]   master -> master  
12:  Branch master set up to track remote branch master from origin.  

README file had been commit into git

Assume I create my project skeleton into my git folder

Add all files into track => commit => push to remote
1:  albert@ALBERT-PC /d/git/dbm (master)  
2:  $ git add .  
3:  warning: LF will be replaced by CRLF in dbm-webapp/src/main/jasperreports/README.md.  
4:  The file will have its original line endings in your working directory.  
5:  warning: LF will be replaced by CRLF in dbm-webapp/src/main/webapp/WEB-INF/templates/README.md.  
6:  The file will have its original line endings in your working directory.  
7:  warning: LF will be replaced by CRLF in dbm-webapp/src/main/webapp/scripts/README.md.  
8:  The file will have its original line endings in your working directory.  
9:  warning: LF will be replaced by CRLF in dbm-webapp/src/main/webapp/styles/README.md.  
10:  The file will have its original line endings in your working directory.  
11:  warning: LF will be replaced by CRLF in dbm-webapp/src/test/database/README.md.  
12:  The file will have its original line endings in your working directory.  
13:  warning: LF will be replaced by CRLF in dbm-webapp/src/test/database/test-datasource.xml.template-or  
14:  acle.  
15:  The file will have its original line endings in your working directory.  
16:  warning: LF will be replaced by CRLF in dbm-webapp/src/test/database/test-datasource.xml.template-sq  
17:  lserver.  
18:  The file will have its original line endings in your working directory.  
19:  warning: LF will be replaced by CRLF in pom.xml.  
20:  The file will have its original line endings in your working directory.  
21:  albert@ALBERT-PC /d/git/dbm (master)  
22:  $ git commit -m "create project skeleton"  
23:  [master 4abf50e] create project skeleton  
24:  warning: LF will be replaced by CRLF in dbm-webapp/src/main/jasperreports/README.md.  
25:  The file will have its original line endings in your working directory.  
26:  warning: LF will be replaced by CRLF in dbm-webapp/src/main/webapp/WEB-INF/templates/README.md.  
27:  The file will have its original line endings in your working directory.  
28:  warning: LF will be replaced by CRLF in dbm-webapp/src/main/webapp/scripts/README.md.  
29:  The file will have its original line endings in your working directory.  
30:  warning: LF will be replaced by CRLF in dbm-webapp/src/main/webapp/styles/README.md.  
31:  The file will have its original line endings in your working directory.  
32:  warning: LF will be replaced by CRLF in dbm-webapp/src/test/database/README.md.  
33:  The file will have its original line endings in your working directory.  
34:  warning: LF will be replaced by CRLF in dbm-webapp/src/test/database/test-datasource.xml.template-or  
35:  acle.  
36:  The file will have its original line endings in your working directory.  
37:  warning: LF will be replaced by CRLF in dbm-webapp/src/test/database/test-datasource.xml.template-sq  
38:  lserver.  
39:  The file will have its original line endings in your working directory.  
40:  warning: LF will be replaced by CRLF in pom.xml.  
41:  The file will have its original line endings in your working directory.  
42:   22 files changed, 498 insertions(+)  
43:   create mode 100644 README.md  
44:   create mode 100644 dbm-entity/pom.xml  
45:   create mode 100644 dbm-entity/src/main/java/gov/nta/entity/package-info.java  
46:   create mode 100644 dbm-service/pom.xml  
47:   create mode 100644 dbm-service/src/main/java/gov/nta/dbm/repository/package-info.java  
48:   create mode 100644 dbm-service/src/main/java/gov/nta/dbm/service/package-info.java  
49:   create mode 100644 dbm-webapp/pom.xml  
50:   create mode 100644 dbm-webapp/src/main/jasperreports/README.md  
51:   create mode 100644 dbm-webapp/src/main/java/gov/nta/dbm/web/controller/package-info.java  
52:   create mode 100644 dbm-webapp/src/main/java/gov/nta/dbm/web/dto/package-info.java  
53:   create mode 100644 dbm-webapp/src/main/java/gov/nta/dbm/web/rest/package-info.java  
54:   create mode 100644 dbm-webapp/src/main/resources/gov/nta/dbm/Messages.properties  
55:   create mode 100644 dbm-webapp/src/main/webapp/WEB-INF/jboss-deployment-structure.xml  
56:   create mode 100644 dbm-webapp/src/main/webapp/WEB-INF/jboss-web.xml  
57:   create mode 100644 dbm-webapp/src/main/webapp/WEB-INF/templates/README.md  
58:   create mode 100644 dbm-webapp/src/main/webapp/WEB-INF/web.xml  
59:   create mode 100644 dbm-webapp/src/main/webapp/scripts/README.md  
60:   create mode 100644 dbm-webapp/src/main/webapp/styles/README.md  
61:   create mode 100644 dbm-webapp/src/test/database/README.md  
62:   create mode 100644 dbm-webapp/src/test/database/test-datasource.xml.template-oracle  
63:   create mode 100644 dbm-webapp/src/test/database/test-datasource.xml.template-sqlserver  
64:   create mode 100644 pom.xml  
65:  albert@ALBERT-PC /d/git/dbm (master)  
66:  $ git push -u origin master  
67:  Username for 'http://192.168.31.166': albert_kuo  
68:  Password for 'http://albert_kuo@192.168.31.166':  
69:  Counting objects: 64, done.  
70:  Delta compression using up to 4 threads.  
71:  Compressing objects: 100% (34/34), done.  
72:  Writing objects: 100% (63/63), 10.12 KiB | 0 bytes/s, done.  
73:  Total 63 (delta 2), reused 0 (delta 0)  
74:  To http://192.168.31.166/ifmis/dbm.git  
75:    b45a8a4..4abf50e master -> master  
76:  Branch master set up to track remote branch master from origin.

See..my project skeleton had been commit

Import Git project into Eclipse
1. Copy url

2. File => Import => choose SCM type to "git" => paste url => Finish

3. Well done.




Do not have git connector when I want to Checkout Maven project from SCM

Problem
I would like to import Maven project from Git
File => import

Check out Maven Projects from SCM => Next

I do not have "git" option to select !

Solution
Install git connector

Window => Preferences

Maven => Discovery => Open Catalog

Check "m2e-egit" => Finish

After installation, click Yes to restart eclipse

File => import => Check out Maven Projects from SCM => Next
We have "git" option now!




Unable to ignore resources. Attempted to beginRule: .....

Problem
After I imported Maven project from Git, I always get this error when I do maven-->update projects

Solution
This link, http://www.eclipse.org/forums/index.php/t/493493/ , provides some workaround solutions. 

But you can check the post in the bottom, the author say its plug-in's problem. After I updated it, this error message had gone away.