kazuki43zoo / api-stub Goto Github PK
View Code? Open in Web Editor NEWStub for API on Spring Boot
License: Other
Stub for API on Spring Boot
License: Other
MyBatisでSQLをアノテーションに記載する際に、Groovyの複数行文字列を使うと可読性が高い。
①APIキー一覧からデータキーを一度登録した後、削除する。(レスポンス一覧上データキーが残ったままのはず)
②①のレスポンスを削除すると下記のエラーが発生
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Fri Jul 15 19:39:39 JST 2016
There was an unexpected error (type=Internal Server Error, status=500).
### Error updating database. Cause: org.h2.jdbc.JdbcSQLException: 列 "DATA_KEY" にはnull値が許されていません NULL not allowed for column "DATA_KEY"; SQL statement: UPDATE mock_api_response SET data_key = ?, status_code = ?, header = ?, body = ? , body_editor_mode = ?, attachment_file = ?, file_name = ? , waiting_msec = ?, description = ? WHERE id = ? [23502-192] ### The error may involve com.kazuki43zoo.domain.repository.ApiResponseRepository.update-Inline ### The error occurred while setting parameters ### SQL: UPDATE mock_api_response SET data_key = ?, status_code = ?, header = ?, body = ? , body_editor_mode = ?, attachment_file = ?, file_name = ? , waiting_msec = ?, description = ? WHERE id = ? ### Cause: org.h2.jdbc.JdbcSQLException: 列 "DATA_KEY" にはnull値が許されていません NULL not allowed for column "DATA_KEY"; SQL statement: UPDATE mock_api_response SET data_key = ?, status_code = ?, header = ?, body = ? , body_editor_mode = ?, attachment_file = ?, file_name = ? , waiting_msec = ?, description = ? WHERE id = ? [23502-192] ; SQL []; 列 "DATA_KEY" にはnull値が許されていません NULL not allowed for column "DATA_KEY"; SQL statement: UPDATE mock_api_response SET data_key = ?, status_code = ?, header = ?, body = ? , body_editor_mode = ?, attachment_file = ?, file_name = ? , waiting_msec = ?, description = ? WHERE id = ? [23502-192]; nested exception is org.h2.jdbc.JdbcSQLException: 列 "DATA_KEY" にはnull値が許されていません NULL not allowed for column "DATA_KEY"; SQL statement: UPDATE mock_api_response SET data_key = ?, status_code = ?, header = ?, body = ? , body_editor_mode = ?, attachment_file = ?, file_name = ? , waiting_msec = ?, description = ? WHERE id = ? [23502-192]
Add unit tests and integration test (e2e tests).
レスポンス一覧から削除すると下記エラーが発生する。
=========================
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Fri Jul 15 19:49:15 JST 2016
There was an unexpected error (type=Internal Server Error, status=500).
### Error updating database. Cause: org.h2.jdbc.JdbcSQLException: SQLステートメントに文法エラーがあります "DELETE FROM mock_api_response WHERE id = ?[*]""" Syntax error in SQL statement "DELETE FROM mock_api_response WHERE id = ?[*]"""; SQL statement: DELETE FROM mock_api_response WHERE id = ?" [42000-192] ### SQL: DELETE FROM mock_api_response WHERE id = ?" ### Cause: org.h2.jdbc.JdbcSQLException: SQLステートメントに文法エラーがあります "DELETE FROM mock_api_response WHERE id = ?[*]""" Syntax error in SQL statement "DELETE FROM mock_api_response WHERE id = ?[*]"""; SQL statement: DELETE FROM mock_api_response WHERE id = ?" [42000-192] ; bad SQL grammar []; nested exception is org.h2.jdbc.JdbcSQLException: SQLステートメントに文法エラーがあります "DELETE FROM mock_api_response WHERE id = ?[*]""" Syntax error in SQL statement "DELETE FROM mock_api_response WHERE id = ?[*]"""; SQL statement: DELETE FROM mock_api_response WHERE id = ?" [42000-192]
2016-07-15 12:09:06.600 ERROR 11076 --- [nio-8080-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.builder.BuilderException: Error invoking SqlProvider method (com.kazuki43zoo.domain.repository.ApiResponseRepository$SqlProvider.findAll). Cause: java.lang.InstantiationException: com.kazuki43zoo.domain.repository.ApiResponseRepository$SqlProvider] with root cause
java.lang.NoSuchMethodException: com.kazuki43zoo.domain.repository.ApiResponseRepository$SqlProvider.<init>()
at java.lang.Class.getConstructor0(Unknown Source) ~[na:1.8.0_77]
at java.lang.Class.newInstance(Unknown Source) ~[na:1.8.0_77]
at org.apache.ibatis.builder.annotation.ProviderSqlSource.createSqlSource(ProviderSqlSource.java:89) ~[mybatis-3.4.0.jar!/:3.4.0]
at org.apache.ibatis.builder.annotation.ProviderSqlSource.getBoundSql(ProviderSqlSource.java:73) ~[mybatis-3.4.0.jar!/:3.4.0]
at org.apache.ibatis.mapping.MappedStatement.getBoundSql(MappedStatement.java:292) ~[mybatis-3.4.0.jar!/:3.4.0]
at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:81) ~[mybatis-3.4.0.jar!/:3.4.0]
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:148) ~[mybatis-3.4.0.jar!/:3.4.0]
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141) ~[mybatis-3.4.0.jar!/:3.4.0]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_77]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_77]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_77]
at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.8.0_77]
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:434) ~[mybatis-spring-1.3.0.jar!/:1.3.0]
at com.sun.proxy.$Proxy52.selectList(Unknown Source) ~[na:na]
at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:231) ~[mybatis-spring-1.3.0.jar!/:1.3.0]
at org.apache.ibatis.binding.MapperMethod.executeForMany(MapperMethod.java:128) ~[mybatis-3.4.0.jar!/:3.4.0]
at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:68) ~[mybatis-3.4.0.jar!/:3.4.0]
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:53) ~[mybatis-3.4.0.jar!/:3.4.0]
at com.sun.proxy.$Proxy61.findAll(Unknown Source) ~[na:na]
at com.kazuki43zoo.domain.service.ApiResponseService.findAll(ApiResponseService.java:36) ~[api-stub-core-1.0.0-SNAPSHOT.jar!/:1.0.0-SNAPSHOT]
at com.kazuki43zoo.domain.service.ApiResponseService$$FastClassBySpringCGLIB$$62a7f42e.invoke(<generated>) ~[api-stub-core-1.0.0-SNAPSHOT.jar!/:1.0.0-SNAPSHOT]
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) ~[spring-core-4.2.7.RELEASE.jar!/:4.2.7.RELEASE]
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:720
...
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<executable>true</executable> <!-- Add -->
</configuration>
</plugin>
登録済みのデータを新規作成時のデフォルト値にできると、バリエーションデータの作成がやりやすい。
By this change, following artifacts are updated too.
リクエスト内容をレスポンスにそのまま引き継ぐ機能が欲しいです。
【イメージ】
request
{
"uuid" : "550e8400-e29b-41d4-a716-446655440000",
"name" : "josh"
}
response
{
"uuid" : "550e8400-e29b-41d4-a716-446655440000",
"result_code" : "000"
}
org.h2.jdbc.JdbcSQLException: ??‡????????????????? ̄?????§??≪??‰?????‰??????????????? (VM?μ???†???????‡??????‡????????????????? ̄???????????’????????
≪??????????????≪?? ̄???db URL??≪ ";DB_CLOSE_ON_EXIT=FALSE" ??’????????????????????????)
Database is already closed (to disable automatic closing at VM shutdown, add ";DB_CLOSE_ON_EXIT=FALSE" to the db URL) [90121-191]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:345)
at org.h2.message.DbException.get(DbException.java:179)
at org.h2.message.DbException.get(DbException.java:155)
at org.h2.message.DbException.get(DbException.java:144)
at org.h2.jdbc.JdbcConnection.checkClosed(JdbcConnection.java:1468)
at org.h2.jdbc.JdbcConnection.checkClosed(JdbcConnection.java:1443)
at org.h2.jdbc.JdbcConnection.createStatement(JdbcConnection.java:191)
at org.h2.server.web.DbStarter.contextDestroyed(DbStarter.java:76)
at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4856)
at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5474)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:224)
at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1424)
at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1413)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
JSONパスとXPathの入力チェック(構文チェック)と、ダミーデータを用いたデータキーの抽出テスト機能があった方が親切っぽい。
一時削除(論理削除)+復活みたいな機能が必要?必要ない気はするけど・・。
いったん様子見。
一覧画面にページングの機能が欲しいです。
検索である程度絞れますが、データが多くなるにつれ見難くなってきてしまっている
無駄に・意図せず履歴がたまっていきそうなので、オプション機能に変更する
データのインポート、エクスポート機能がほしい。
いったんレスポンスデータだけ対応する。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.