• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

future-architect / uroborosql / #743

28 Jun 2024 04:17PM UTC coverage: 90.988% (+0.5%) from 90.484%
#743

push

web-flow
add paramIfNotEmpty method (#318)

* v0.x to master merge

* fix nanoseconds diff (java8 to java11)

* eclipse cleanup and  optimize import

* eclipse format

* optimize Imports

* remove unused annotation

* library version up

* migrate v0.x to master
- update java version 8 to 11
- update junit4 to junit5
- library version update

* fix test failed

* remove unused annotation

* fixed bug

* use var

* fix java8 coding style

* Refactoring TransactionContextManager

* Refactoring SqlAgent

* 途中コミット

* fix testcase

* fix review

* fix javadoc comments

* merge v0.x PR

* cleanup code

* cleanup test code

* change build status badge

* - agent.query, update, proc, batch にそれぞれSupplierを引数にとるメソッドを追加
- SqlQuery.paramとSqlEntityUpdate.setにFunctionを受け取るメソッドを追加

* testcaseの整形

* - SqlFluent と ExtractionCondition の分離
- Arrays.asList -> List.of への変更
- テストの整形

* - v0.x系の不具合対応の追いつき
- ログ出力の整理

* - SqlKindの整理(ENTITY_XXXの追加)
- REPL_LOGの追加
- Deprecatedメソッドの削除(SqlAgent)
- SqlAgent, ExecutionContextでsetterをfluent APIに変更

* DB接続URLの修正

* add and fix testcases.

* add event testcases.

* fix typo

* add paramIfNotEmpty method and StringUtils rename ObjectUtils

* fix review comments.

* remove unused import

1695 of 1958 new or added lines in 97 files covered. (86.57%)

26 existing lines in 10 files now uncovered.

8249 of 9066 relevant lines covered (90.99%)

0.91 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

59.38
/src/main/java/jp/co/future/uroborosql/coverage/CoverageData.java
1
/**
2
 * Copyright (c) 2017-present, Future Corporation
3
 *
4
 * This source code is licensed under the MIT license found in the
5
 * LICENSE file in the root directory of this source tree.
6
 */
7
package jp.co.future.uroborosql.coverage;
8

9
import java.security.MessageDigest;
10

11
import org.slf4j.Logger;
12
import org.slf4j.LoggerFactory;
13

14
/**
15
 * カバレッジログ出力用データクラス
16
 *
17
 * @author ota
18
 */
19
public class CoverageData {
20
        /** カバレッジロガー. */
21
        private static final Logger COVERAGE_LOG = LoggerFactory.getLogger("jp.co.future.uroborosql.sql.coverage");
1✔
22

23
        /** SQL名. */
24
        private final String sqlName;
25

26
        /** 変換前SQL. */
27
        private final String sql;
28

29
        /** MD5文字列. */
30
        private final String md5;
31

32
        /** 分岐情報. */
33
        private final PassedRoute passRoute;
34

35
        /**
36
         * コンストラクタ
37
         *
38
         * @param sqlName SQL名
39
         * @param sql SQL
40
         * @param passRoute 分岐情報
41
         */
42
        public CoverageData(final String sqlName, final String sql, final PassedRoute passRoute) {
1✔
43
                this.sqlName = sqlName;
1✔
44
                this.sql = sql;
1✔
45
                this.md5 = makeMd5(sql);
1✔
46
                this.passRoute = passRoute;
1✔
47
        }
1✔
48

49
        /**
50
         * MD5文字列の生成
51
         *
52
         * @param original 生成元文字列
53
         * @return MD5文字列
54
         */
55
        private String makeMd5(final String original) {
56
                try {
57
                        var digest = MessageDigest.getInstance("MD5");
1✔
58
                        var hash = digest.digest(original.getBytes("UTF-8"));
1✔
59
                        var builder = new StringBuilder();
1✔
60
                        for (var element : hash) {
1✔
61
                                if ((0xff & element) < 0x10) {
1✔
62
                                        builder.append("0" + Integer.toHexString(0xff & element));
1✔
63
                                } else {
64
                                        builder.append(Integer.toHexString(0xff & element));
1✔
65
                                }
66
                        }
67
                        return builder.toString();
1✔
68
                } catch (Exception ex) {
×
NEW
69
                        COVERAGE_LOG.error(ex.getMessage(), ex);
×
70
                }
71
                return "";
×
72
        }
73

74
        /**
75
         * JSON化
76
         *
77
         * @return JSON
78
         */
79
        public String toJSON() {
NEW
80
                var builder = new StringBuilder();
×
NEW
81
                builder.append("{\"sqlName\":");
×
NEW
82
                if (sqlName != null) {
×
NEW
83
                        builder.append(sqlName.replace('/', '/'));
×
84
                } else {
NEW
85
                        builder.append("");
×
86
                }
NEW
87
                builder.append(",\"md5\":").append(md5)
×
NEW
88
                                .append(",\"passRoute\":").append(passRoute)
×
NEW
89
                                .append("}");
×
NEW
90
                return builder.toString();
×
91
        }
92

93
        /**
94
         * SQL名取得.
95
         *
96
         * @return SQLファイルのルートからの相対パス(ファイル拡張子なし)
97
         */
98
        public String getSqlName() {
99
                return sqlName;
1✔
100
        }
101

102
        /**
103
         * 変換前SQL取得.
104
         *
105
         * @return 変換前SQL
106
         */
107
        public String getSql() {
108
                return sql;
1✔
109
        }
110

111
        /**
112
         * SQLのMD5取得.
113
         *
114
         * @return MD5
115
         */
116
        public String getMd5() {
117
                return md5;
1✔
118
        }
119

120
        /**
121
         * 分岐情報取得.
122
         *
123
         * @return 分岐情報
124
         */
125
        public PassedRoute getPassRoute() {
126
                return passRoute;
1✔
127
        }
128

129
        /**
130
         * {@inheritDoc}
131
         *
132
         * JSON化文字列を返す
133
         *
134
         * @see java.lang.Object#toString()
135
         */
136
        @Override
137
        public String toString() {
UNCOV
138
                return toJSON();
×
139
        }
140

141
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc