Do not to test a private method.

本文探讨了单元测试中私有方法的测试策略,提出将私有方法移到独立类中进行测试或通过公共方法间接测试私有方法功能的方法,并强调了只在私有方法功能与公共接口相关时才进行测试。

If you want to unit test a private method, something may be wrong. Unit tests are (generally speaking) meant to test the interface of a class, meaning its public (and protected) methods. You can of course "hack" a solution to this (even if just by making the methods public), but you may also want to consider:

  1. If the method you'd like to test is really worth testing, it may be worth to move it into its own class.
  2. Add more tests to the public methods that call the private method, testing the private method's functionality. (As the commentators indicated, you should only do this if these private methods's functionality is really a part in with the public interface. If they actually perform functions that are hidden from the user (i.e. the unit test), this is probably bad).

http://stackoverflow.com/questions/250692/how-do-you-unit-test-private-methods

转载于:https://www.cnblogs.com/kklldog/p/4496143.html

看看错误是什么? Hibernate: insert into notification_switch (ctime, mtime, account_id, enable, type) values (?, ?, ?, ?, ?) 11-03-2025 11:32:24.772 INFO [main] [TID: N/A] c.t.n.c.a.s.i.StatServiceImpl: [STAT] {"service":"IndexServerApiImpl$MockitoMock$1163662474","method":"toString","exception":0,"exeMs":1,"statKey":"@ThirdPartyApiStat"} 11-03-2025 11:32:43.249 INFO [main] [TID: N/A] c.t.n.c.a.s.i.StatServiceImpl: [STAT] {"service":"IndexServerApiImpl$MockitoMock$1163662474","method":"toString","exception":0,"exeMs":0,"statKey":"@ThirdPartyApiStat"} 11-03-2025 11:32:46.654 INFO [main] [TID: N/A] c.t.n.c.a.s.i.StatServiceImpl: [STAT] {"service":"IndexServerApiImpl$MockitoMock$1163662474","method":"toString","exception":0,"exeMs":0,"statKey":"@ThirdPartyApiStat"} Hibernate: select userprivac0_.id as id1_4_, userprivac0_.ctime as ctime2_4_, userprivac0_.mtime as mtime3_4_, userprivac0_.account_id as account_4_4_, userprivac0_.agreement_status as agreemen5_4_, userprivac0_.order_service_type as order_se6_4_, userprivac0_.privacy_code as privacy_7_4_, userprivac0_.region as region8_4_ from user_privacy_status userprivac0_ where userprivac0_.account_id=? and userprivac0_.privacy_code=? 11-03-2025 11:32:50.890 INFO [main] [TID: N/A] c.t.n.c.a.s.i.StatServiceImpl: [STAT] {"service":"IndexServerApiImpl$MockitoMock$1163662474","method":"toString","exception":0,"exeMs":0,"statKey":"@ThirdPartyApiStat"} 11-03-2025 11:32:54.677 INFO [main] [TID: N/A] c.t.n.c.a.s.i.StatServiceImpl: [STAT] {"service":"IndexServerApiImpl$MockitoMock$1163662474","method":"toString","exception":0,"exeMs":1,"statKey":"@ThirdPartyApiStat"} 11-03-2025 11:32:57.090 INFO [main] [TID: N/A] c.t.n.c.a.s.i.StatServiceImpl: [STAT] {"service":"IndexServerApiImpl$MockitoMock$1163662474","method":"toString","exception":0,"exeMs":0,"statKey":"@ThirdPartyApiStat"} 11-03-2025 11:32:57.586 INFO [main] [TID: N/A] c.t.n.c.a.s.i.StatServiceImpl: [STAT] {"service":"IndexServerApiImpl$MockitoMock$1163662474","method":"toString","exception":0,"exeMs":0,"statKey":"@ThirdPartyApiStat"} 11-03-2025 11:32:58.076 INFO [main] [TID: N/A] c.t.n.c.a.s.i.StatServiceImpl: [STAT] {"service":"IndexServerApiImpl$MockitoMock$1163662474","method":"toString","exception":0,"exeMs":0,"statKey":"@ThirdPartyApiStat"} 11-03-2025 11:33:01.421 WARN [main] [TID: N/A] c.t.n.c.a.s.i.StatServiceImpl: [STAT] {"accountId":"326006","weeklyReportMessage":"receive data from bigdata, but user does not agree for weekly report","tspSupported":true,"statKey":"@WeeklyReportStat"} 11-03-2025 11:33:01.567 INFO [main] [TID: N/A] c.t.n.c.a.s.i.StatServiceImpl: [STAT] {"service":"IndexServerApiImpl$MockitoMock$1163662474","method":"toString","exception":0,"exeMs":0,"statKey":"@ThirdPartyApiStat"} 11-03-2025 11:33:02.396 INFO [main] [TID: N/A] c.t.n.c.a.s.i.StatServiceImpl: [STAT] {"service":"IndexServerApiImpl$MockitoMock$1163662474","method":"toString","exception":0,"exeMs":0,"statKey":"@ThirdPartyApiStat"} 11-03-2025 11:33:03.910 INFO [main] [TID: N/A] c.t.n.c.a.s.i.StatServiceImpl: [STAT] {"service":"IndexServerApiImpl$MockitoMock$1163662474","method":"toString","exception":0,"exeMs":0,"statKey":"@ThirdPartyApiStat"} 11-03-2025 11:33:04.387 INFO [main] [TID: N/A] c.t.n.c.a.s.i.StatServiceImpl: [STAT] {"service":"IndexServerApiImpl$MockitoMock$1163662474","method":"toString","exception":0,"exeMs":0,"statKey":"@ThirdPartyApiStat"} 11-03-2025 11:33:04.719 INFO [main] [TID: N/A] c.t.n.c.a.s.i.StatServiceImpl: [STAT] {"service":"IndexServerApiImpl$MockitoMock$1163662474","method":"toString","exception":0,"exeMs":0,"statKey":"@ThirdPartyApiStat"} 11-03-2025 11:33:05.098 INFO [main] [TID: N/A] c.t.n.c.a.s.i.StatServiceImpl: [STAT] {"service":"IndexServerApiImpl$MockitoMock$1163662474","method":"toString","exception":0,"exeMs":0,"statKey":"@ThirdPartyApiStat"} 11-03-2025 11:33:05.598 WARN [Apollo-RemoteConfigLongPollService-1] [TID: N/A] c.c.f.a.i.RemoteConfigLongPollService: Long polling failed, will retry in 64 seconds. appId: tapocare_app, cluster: dev-aps1, namespaces: networkAcceleration__application.yaml, long polling url: null, reason: Get config services failed from https://apollo-configservice-alpha.i.tplinknbu.com/services/config?appId=tapocare_app&ip=192.168.131.1 [Cause: Could not complete get operation [Cause: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target [Cause: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target [Cause: unable to find valid certification path to requested target]]]] 11-03-2025 11:33:05.753 INFO [main] [TID: N/A] c.t.n.c.a.s.i.StatServiceImpl: [STAT] {"service":"IndexServerApiImpl$MockitoMock$1163662474","method":"toString","exception":0,"exeMs":0,"statKey":"@ThirdPartyApiStat"} Hibernate: select userprivac0_.id as id1_4_, userprivac0_.ctime as ctime2_4_, userprivac0_.mtime as mtime3_4_, userprivac0_.account_id as account_4_4_, userprivac0_.agreement_status as agreemen5_4_, userprivac0_.order_service_type as order_se6_4_, userprivac0_.privacy_code as privacy_7_4_, userprivac0_.region as region8_4_ from user_privacy_status userprivac0_ where userprivac0_.account_id=? and userprivac0_.privacy_code=? 11-03-2025 11:33:06.364 INFO [main] [TID: N/A] c.t.n.c.a.s.i.StatServiceImpl: [STAT] {"service":"IndexServerApiImpl$MockitoMock$1163662474","method":"toString","exception":0,"exeMs":2,"statKey":"@ThirdPartyApiStat"} 11-03-2025 11:33:07.143 INFO [main] [TID: N/A] c.t.n.c.a.s.i.StatServiceImpl: [STAT] {"service":"IndexServerApiImpl$MockitoMock$1163662474","method":"toString","exception":0,"exeMs":0,"statKey":"@ThirdPartyApiStat"} 11-03-2025 11:33:07.498 INFO [main] [TID: N/A] c.t.n.c.a.s.i.StatServiceImpl: [STAT] {"service":"IndexServerApiImpl$MockitoMock$1163662474","method":"toString","exception":0,"exeMs":0,"statKey":"@ThirdPartyApiStat"} 11-03-2025 11:33:07.713 INFO [main] [TID: N/A] c.t.n.c.a.s.i.StatServiceImpl: [STAT] {"service":"IndexServerApiImpl$MockitoMock$1163662474","method":"toString","exception":0,"exeMs":0,"statKey":"@ThirdPartyApiStat"} 11-03-2025 11:33:07.982 INFO [main] [TID: N/A] c.t.n.c.a.s.i.StatServiceImpl: [STAT] {"service":"IndexServerApiImpl$MockitoMock$1163662474","method":"toString","exception":0,"exeMs":0,"statKey":"@ThirdPartyApiStat"} 11-03-2025 11:33:08.081 WARN [main] [TID: N/A] c.t.n.c.a.s.i.StatServiceImpl: [STAT] {"accountId":"20066661","weeklyReportMessage":"receive data from bigdata, but user does not agree for weekly report","tspSupported":true,"statKey":"@WeeklyReportStat"} 11-03-2025 11:33:08.247 INFO [main] [TID: N/A] c.t.n.c.a.s.i.StatServiceImpl: [STAT] {"service":"IndexServerApiImpl$MockitoMock$1163662474","method":"toString","exception":0,"exeMs":0,"statKey":"@ThirdPartyApiStat"} 11-03-2025 11:33:08.447 INFO [main] [TID: N/A] c.t.n.c.a.s.i.StatServiceImpl: [STAT] {"service":"IndexServerApiImpl$MockitoMock$1163662474","method":"toString","exception":0,"exeMs":0,"statKey":"@ThirdPartyApiStat"} 11-03-2025 11:33:09.070 INFO [main] [TID: N/A] c.t.n.c.a.s.i.StatServiceImpl: [STAT] {"service":"IndexServerApiImpl$MockitoMock$1163662474","method":"toString","exception":0,"exeMs":0,"statKey":"@ThirdPartyApiStat"} Hibernate: select userprivac0_.id as id1_4_, userprivac0_.ctime as ctime2_4_, userprivac0_.mtime as mtime3_4_, userprivac0_.account_id as account_4_4_, userprivac0_.agreement_status as agreemen5_4_, userprivac0_.order_service_type as order_se6_4_, userprivac0_.privacy_code as privacy_7_4_, userprivac0_.region as region8_4_ from user_privacy_status userprivac0_ where userprivac0_.account_id=? and userprivac0_.privacy_code=? 11-03-2025 11:33:14.043 INFO [main] [TID: N/A] c.t.n.c.a.s.i.StatServiceImpl: [STAT] {"service":"IndexServerApiImpl$MockitoMock$1163662474","method":"toString","exception":0,"exeMs":1,"statKey":"@ThirdPartyApiStat"} 11-03-2025 11:33:20.394 INFO [main] [TID: N/A] c.t.n.c.a.s.i.StatServiceImpl: [STAT] {"service":"IndexServerApiImpl$MockitoMock$1163662474","method":"toString","exception":0,"exeMs":0,"statKey":"@ThirdPartyApiStat"} 11-03-2025 11:33:20.875 INFO [main] [TID: N/A] c.t.n.c.a.s.i.StatServiceImpl: [STAT] {"service":"IndexServerApiImpl$MockitoMock$1163662474","method":"toString","exception":0,"exeMs":0,"statKey":"@ThirdPartyApiStat"} Hibernate: select userreport0_.id as id1_5_, userreport0_.ctime as ctime2_5_, userreport0_.mtime as mtime3_5_, userreport0_.account_id as account_4_5_, userreport0_.content as content5_5_, userreport0_.device_id as device_i6_5_, userreport0_.device_report as device_r7_5_, userreport0_.expired_time as expired_8_5_, userreport0_.order_service_type as order_se9_5_, userreport0_.report_date as report_10_5_, userreport0_.status as status11_5_, userreport0_.timezone as timezon12_5_, userreport0_.type as type13_5_ from user_report userreport0_ where userreport0_.account_id=? and userreport0_.type=? and userreport0_.report_date=? order by userreport0_.id DESC limit ? 11-03-2025 11:33:22.385 INFO [main] [TID: N/A] c.t.n.c.a.s.i.StatServiceImpl: [STAT] {"service":"IndexServerApiImpl$MockitoMock$1163662474","method":"toString","exception":0,"exeMs":0,"statKey":"@ThirdPartyApiStat"} 11-03-2025 11:33:52.382 INFO [main] [TID: N/A] c.t.n.c.a.s.i.StatServiceImpl: [STAT] {"service":"IndexServerApiImpl$MockitoMock$1163662474","method":"toString","exception":0,"exeMs":0,"statKey":"@ThirdPartyApiStat"} 11-03-2025 11:34:05.136 INFO [main] [TID: N/A] c.t.n.c.a.s.i.StatServiceImpl: [STAT] {"service":"IndexServerApiImpl$MockitoMock$1163662474","method":"toString","exception":0,"exeMs":0,"statKey":"@ThirdPartyApiStat"} 11-03-2025 11:34:31.234 DEBUG [main] [TID: N/A] c.t.n.c.a.a.i.IndexServerApiImpl: BatchQueryLastEventDeviceInfoRequest accountId: 20112672, deviceUniqueIdList: [000132D61EC76E9BCD3F83DD011F00C320011005] 11-03-2025 11:34:31.248 DEBUG [main] [TID: N/A] c.t.n.c.a.a.i.IndexServerApiImpl: can't extract brand from http request context because of the request not from web: null java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request. at org.springframework.web.context.request.RequestContextHolder.currentRequestAttributes(RequestContextHolder.java:131) ~[spring-web-5.2.9.RELEASE.jar:5.2.9.RELEASE] at com.tplink.nbu.cloudstorage.appserver.api.impl.IndexServerApiImpl.extractBrandFromContext(IndexServerApiImpl.java:407) ~[classes/:?] at com.tplink.nbu.cloudstorage.appserver.api.impl.IndexServerApiImpl.addHeaders(IndexServerApiImpl.java:363) ~[classes/:?] at com.tplink.nbu.cloudstorage.appserver.api.impl.IndexServerApiImpl.getLastEventDeviceBlockingStub(IndexServerApiImpl.java:321) ~[classes/:?] at com.tplink.nbu.cloudstorage.appserver.api.impl.IndexServerApiImpl.batchQueryLastEventDeviceInfo(IndexServerApiImpl.java:932) ~[classes/:?] at com.tplink.nbu.cloudstorage.appserver.api.impl.IndexServerApiImpl$MockitoMock$1163662474.batchQueryLastEventDeviceInfo$accessor$cLPa5k80(Unknown Source) ~[classes/:?] at com.tplink.nbu.cloudstorage.appserver.api.impl.IndexServerApiImpl$MockitoMock$1163662474$auxiliary$vt4wFwho.call(Unknown Source) ~[classes/:?] at org.mockito.internal.invocation.RealMethod$FromCallable$1.call(RealMethod.java:40) ~[mockito-core-3.1.0.jar:?] at org.mockito.internal.invocation.RealMethod$FromBehavior.invoke(RealMethod.java:62) ~[mockito-core-3.1.0.jar:?] at org.mockito.internal.invocation.InterceptedInvocation.callRealMethod(InterceptedInvocation.java:152) ~[mockito-core-3.1.0.jar:?] at org.mockito.internal.stubbing.answers.CallsRealMethods.answer(CallsRealMethods.java:43) ~[mockito-core-3.1.0.jar:?] at org.mockito.Answers.answer(Answers.java:100) ~[mockito-core-3.1.0.jar:?] at org.mockito.internal.handler.MockHandlerImpl.handle(MockHandlerImpl.java:103) ~[mockito-core-3.1.0.jar:?] at org.mockito.internal.handler.NullResultGuardian.handle(NullResultGuardian.java:29) ~[mockito-core-3.1.0.jar:?] at org.mockito.internal.handler.InvocationNotifierHandler.handle(InvocationNotifierHandler.java:35) ~[mockito-core-3.1.0.jar:?] at org.mockito.internal.creation.bytebuddy.MockMethodInterceptor.doIntercept(MockMethodInterceptor.java:61) ~[mockito-core-3.1.0.jar:?] at org.mockito.internal.creation.bytebuddy.MockMethodInterceptor.doIntercept(MockMethodInterceptor.java:49) ~[mockito-core-3.1.0.jar:?] at org.mockito.internal.creation.bytebuddy.MockMethodInterceptor$DispatcherDefaultingToRealMethod.interceptSuperCallable(MockMethodInterceptor.java:108) ~[mockito-core-3.1.0.jar:?] at com.tplink.nbu.cloudstorage.appserver.api.impl.IndexServerApiImpl$MockitoMock$1163662474.batchQueryLastEventDeviceInfo(Unknown Source) ~[classes/:?] at com.tplink.nbu.cloudstorage.appserver.api.impl.IndexServerApiImpl$MockitoMock$1163662474$$FastClassBySpringCGLIB$$af0f867b.invoke(<generated>) ~[classes/:?] at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) ~[spring-core-5.2.9.RELEASE.jar:5.2.9.RELEASE] at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:771) ~[spring-aop-5.2.9.RELEASE.jar:5.2.9.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) ~[spring-aop-5.2.9.RELEASE.jar:5.2.9.RELEASE] at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:749) ~[spring-aop-5.2.9.RELEASE.jar:5.2.9.RELEASE] at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:88) ~[spring-aop-5.2.9.RELEASE.jar:5.2.9.RELEASE] at com.tplink.nbu.cloudstorage.appserver.aop.ThirdPartyApiLogAspect.logApiExeTime(ThirdPartyApiLogAspect.java:52) ~[classes/:?] at jdk.internal.reflect.GeneratedMethodAccessor245.invoke(Unknown Source) ~[?:?] at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?] at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:644) ~[spring-aop-5.2.9.RELEASE.jar:5.2.9.RELEASE] at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:633) ~[spring-aop-5.2.9.RELEASE.jar:5.2.9.RELEASE] at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70) ~[spring-aop-5.2.9.RELEASE.jar:5.2.9.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:175) ~[spring-aop-5.2.9.RELEASE.jar:5.2.9.RELEASE] at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:749) ~[spring-aop-5.2.9.RELEASE.jar:5.2.9.RELEASE] at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:95) ~[spring-aop-5.2.9.RELEASE.jar:5.2.9.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.2.9.RELEASE.jar:5.2.9.RELEASE] at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:749) ~[spring-aop-5.2.9.RELEASE.jar:5.2.9.RELEASE] at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:691) ~[spring-aop-5.2.9.RELEASE.jar:5.2.9.RELEASE] at com.tplink.nbu.cloudstorage.appserver.api.impl.IndexServerApiImpl$MockitoMock$1163662474$$EnhancerBySpringCGLIB$$81a9df8b.batchQueryLastEventDeviceInfo(<generated>) ~[classes/:?] at com.tplink.nbu.cloudstorage.appserver.service.impl.WeeklyReportServiceImpl.tryFillAliasAndGetAgentNvrChannelDeviceId(WeeklyReportServiceImpl.java:966) ~[classes/:?] at com.tplink.nbu.cloudstorage.appserver.service.impl.WeeklyReportServiceImpl.lambda$getUsefulDeviceReportsAndSum$14(WeeklyReportServiceImpl.java:884) ~[classes/:?] at java.util.ArrayList.forEach(ArrayList.java:1541) ~[?:?] at com.tplink.nbu.cloudstorage.appserver.service.impl.WeeklyReportServiceImpl.getUsefulDeviceReportsAndSum(WeeklyReportServiceImpl.java:874) ~[classes/:?] at com.tplink.nbu.cloudstorage.appserver.service.impl.WeeklyReportServiceImpl.checkAndCalculate(WeeklyReportServiceImpl.java:831) ~[classes/:?] at com.tplink.nbu.cloudstorage.appserver.service.impl.WeeklyReportServiceImpl.parseAndProcessReports(WeeklyReportServiceImpl.java:500) ~[classes/:?] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?] at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?] at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344) ~[spring-aop-5.2.9.RELEASE.jar:5.2.9.RELEASE] at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:205) ~[spring-aop-5.2.9.RELEASE.jar:5.2.9.RELEASE] at com.sun.proxy.$Proxy272.parseAndProcessReports(Unknown Source) ~[?:?] at com.tplink.nbu.cloudstorage.appserver.service.impl.WeeklyReportServiceImplTest.lambda$testCalculate$7(WeeklyReportServiceImplTest.java:272) ~[test-classes/:?] at org.junit.jupiter.api.AssertDoesNotThrow.assertDoesNotThrow(AssertDoesNotThrow.java:72) [junit-jupiter-api-5.5.2.jar:5.5.2] at org.junit.jupiter.api.AssertDoesNotThrow.assertDoesNotThrow(AssertDoesNotThrow.java:59) [junit-jupiter-api-5.5.2.jar:5.5.2] at org.junit.jupiter.api.Assertions.assertDoesNotThrow(Assertions.java:3065) [junit-jupiter-api-5.5.2.jar:5.5.2] at com.tplink.nbu.cloudstorage.appserver.service.impl.WeeklyReportServiceImplTest.testCalculate(WeeklyReportServiceImplTest.java:272) [test-classes/:?] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?] at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?] at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) [junit-4.12.jar:4.12] at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) [junit-4.12.jar:4.12] at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) [junit-4.12.jar:4.12] at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) [junit-4.12.jar:4.12] at org.springframework.test.context.junit4.statements.RunBeforeTestExecutionCallbacks.evaluate(RunBeforeTestExecutionCallbacks.java:74) [spring-test-5.2.9.RELEASE.jar:5.2.9.RELEASE] at org.springframework.test.context.junit4.statements.RunAfterTestExecutionCallbacks.evaluate(RunAfterTestExecutionCallbacks.java:84) [spring-test-5.2.9.RELEASE.jar:5.2.9.RELEASE] at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) [junit-4.12.jar:4.12] at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75) [spring-test-5.2.9.RELEASE.jar:5.2.9.RELEASE] at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86) [spring-test-5.2.9.RELEASE.jar:5.2.9.RELEASE] at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84) [spring-test-5.2.9.RELEASE.jar:5.2.9.RELEASE] at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) [junit-4.12.jar:4.12] at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:251) [spring-test-5.2.9.RELEASE.jar:5.2.9.RELEASE] at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97) [spring-test-5.2.9.RELEASE.jar:5.2.9.RELEASE] at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) [junit-4.12.jar:4.12] at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) [junit-4.12.jar:4.12] at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) [junit-4.12.jar:4.12] at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) [junit-4.12.jar:4.12] at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) [junit-4.12.jar:4.12] at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) [spring-test-5.2.9.RELEASE.jar:5.2.9.RELEASE] at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) [spring-test-5.2.9.RELEASE.jar:5.2.9.RELEASE] at org.junit.runners.ParentRunner.run(ParentRunner.java:363) [junit-4.12.jar:4.12] at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190) [spring-test-5.2.9.RELEASE.jar:5.2.9.RELEASE] at org.junit.runner.JUnitCore.run(JUnitCore.java:137) [junit-4.12.jar:4.12] at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69) [junit-rt.jar:?] at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38) [junit-rt.jar:?] at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11) [idea_rt.jar:?] at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35) [junit-rt.jar:?] at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:231) [junit-rt.jar:?] at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:55) [junit-rt.jar:?] 11-03-2025 11:34:31.373 DEBUG [main] [TID: N/A] c.t.n.c.a.g.i.IdempotentHeaderClientInterceptor: [GRPC] Method: LastEventDevice/batchQueryLastEventDeviceInfo, NO_SIDE_EFFECTS 11-03-2025 11:34:31.373 DEBUG [main] [TID: N/A] c.t.n.c.a.c.i.GrpcClientInterceptor: headers: Metadata(serviceid=TAPOCARE_APP,requestdatabrand=TAPO,x-idempotency-level=1) 11-03-2025 11:34:31.428 DEBUG [main] [TID: N/A] c.t.n.c.a.c.i.GrpcClientInterceptor: request: account_id: "20112672" device_unique_ids: "000132D61EC76E9BCD3F83DD011F00C320011005" 11-03-2025 11:34:31.602 ERROR [main] [TID: N/A] c.t.n.c.a.s.i.StatServiceImpl: [STAT] {"service":"LastEventDevice","errorType":"UNAVAILABLE","path":"LastEventDevice/batchQueryLastEventDeviceInfo","errorMessage":"Unable to resolve host tapocare-index-aps1.app-ipc.svc.cluster.local","timestamp":1762140871600,"statKey":"@ThirdPartyApiError"} 11-03-2025 11:34:31.608 INFO [main] [TID: N/A] c.t.n.c.a.s.i.StatServiceImpl: [STAT] {"service":"IndexServerApiImpl$MockitoMock$1163662474","method":"batchQueryLastEventDeviceInfo","exception":1,"exeMs":374,"statKey":"@ThirdPartyApiStat"} 11-03-2025 11:34:31.854 ERROR [main] [TID: N/A] c.t.n.c.a.s.i.WeeklyReportServiceImpl: Failed to get alias for jtmUAPUDSkGAlfkWmYt7DikobqpXXAbWUAfasGbPU8M5b3TaVDhShUXPFHQMXMaQ 11-03-2025 11:34:31.855 ERROR [main] [TID: N/A] c.t.n.c.a.s.i.WeeklyReportServiceImpl: Empty alias for jtmUAPUDSkGAlfkWmYt7DikobqpXXAbWUAfasGbPU8M5b3TaVDhShUXPFHQMXMaQ 11-03-2025 11:34:31.859 DEBUG [main] [TID: N/A] c.t.n.c.a.a.i.IndexServerApiImpl: BatchQueryLastEventDeviceInfoRequest accountId: 20112672, deviceUniqueIdList: [FF81E73D7F900BA3710CC3864247F8EA1D34FCB9] 11-03-2025 11:34:31.860 DEBUG [main] [TID: N/A] c.t.n.c.a.a.i.IndexServerApiImpl: can't extract brand from http request context because of the request not from web: null java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request. at org.springframework.web.context.request.RequestContextHolder.currentRequestAttributes(RequestContextHolder.java:131) ~[spring-web-5.2.9.RELEASE.jar:5.2.9.RELEASE] at com.tplink.nbu.cloudstorage.appserver.api.impl.IndexServerApiImpl.extractBrandFromContext(IndexServerApiImpl.java:407) ~[classes/:?] at com.tplink.nbu.cloudstorage.appserver.api.impl.IndexServerApiImpl.addHeaders(IndexServerApiImpl.java:363) ~[classes/:?] at com.tplink.nbu.cloudstorage.appserver.api.impl.IndexServerApiImpl.getLastEventDeviceBlockingStub(IndexServerApiImpl.java:321) ~[classes/:?] at com.tplink.nbu.cloudstorage.appserver.api.impl.IndexServerApiImpl.batchQueryLastEventDeviceInfo(IndexServerApiImpl.java:932) ~[classes/:?] at com.tplink.nbu.cloudstorage.appserver.api.impl.IndexServerApiImpl$MockitoMock$1163662474.batchQueryLastEventDeviceInfo$accessor$cLPa5k80(Unknown Source) ~[classes/:?] at com.tplink.nbu.cloudstorage.appserver.api.impl.IndexServerApiImpl$MockitoMock$1163662474$auxiliary$vt4wFwho.call(Unknown Source) ~[classes/:?] at org.mockito.internal.invocation.RealMethod$FromCallable$1.call(RealMethod.java:40) ~[mockito-core-3.1.0.jar:?] at org.mockito.internal.invocation.RealMethod$FromBehavior.invoke(RealMethod.java:62) ~[mockito-core-3.1.0.jar:?] at org.mockito.internal.invocation.InterceptedInvocation.callRealMethod(InterceptedInvocation.java:152) ~[mockito-core-3.1.0.jar:?] at org.mockito.internal.stubbing.answers.CallsRealMethods.answer(CallsRealMethods.java:43) ~[mockito-core-3.1.0.jar:?] at org.mockito.Answers.answer(Answers.java:100) ~[mockito-core-3.1.0.jar:?] at org.mockito.internal.handler.MockHandlerImpl.handle(MockHandlerImpl.java:103) ~[mockito-core-3.1.0.jar:?] at org.mockito.internal.handler.NullResultGuardian.handle(NullResultGuardian.java:29) ~[mockito-core-3.1.0.jar:?] at org.mockito.internal.handler.InvocationNotifierHandler.handle(InvocationNotifierHandler.java:35) ~[mockito-core-3.1.0.jar:?] at org.mockito.internal.creation.bytebuddy.MockMethodInterceptor.doIntercept(MockMethodInterceptor.java:61) ~[mockito-core-3.1.0.jar:?] at org.mockito.internal.creation.bytebuddy.MockMethodInterceptor.doIntercept(MockMethodInterceptor.java:49) ~[mockito-core-3.1.0.jar:?] at org.mockito.internal.creation.bytebuddy.MockMethodInterceptor$DispatcherDefaultingToRealMethod.interceptSuperCallable(MockMethodInterceptor.java:108) ~[mockito-core-3.1.0.jar:?] at com.tplink.nbu.cloudstorage.appserver.api.impl.IndexServerApiImpl$MockitoMock$1163662474.batchQueryLastEventDeviceInfo(Unknown Source) ~[classes/:?] at com.tplink.nbu.cloudstorage.appserver.api.impl.IndexServerApiImpl$MockitoMock$1163662474$$FastClassBySpringCGLIB$$af0f867b.invoke(<generated>) ~[classes/:?] at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) ~[spring-core-5.2.9.RELEASE.jar:5.2.9.RELEASE] at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:771) ~[spring-aop-5.2.9.RELEASE.jar:5.2.9.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) ~[spring-aop-5.2.9.RELEASE.jar:5.2.9.RELEASE] at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:749) ~[spring-aop-5.2.9.RELEASE.jar:5.2.9.RELEASE] at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:88) ~[spring-aop-5.2.9.RELEASE.jar:5.2.9.RELEASE] at com.tplink.nbu.cloudstorage.appserver.aop.ThirdPartyApiLogAspect.logApiExeTime(ThirdPartyApiLogAspect.java:52) ~[classes/:?] at jdk.internal.reflect.GeneratedMethodAccessor245.invoke(Unknown Source) ~[?:?] at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?] at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:644) ~[spring-aop-5.2.9.RELEASE.jar:5.2.9.RELEASE] at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:633) ~[spring-aop-5.2.9.RELEASE.jar:5.2.9.RELEASE] at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70) ~[spring-aop-5.2.9.RELEASE.jar:5.2.9.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:175) ~[spring-aop-5.2.9.RELEASE.jar:5.2.9.RELEASE] at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:749) ~[spring-aop-5.2.9.RELEASE.jar:5.2.9.RELEASE] at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:95) ~[spring-aop-5.2.9.RELEASE.jar:5.2.9.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.2.9.RELEASE.jar:5.2.9.RELEASE] at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:749) ~[spring-aop-5.2.9.RELEASE.jar:5.2.9.RELEASE] at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:691) ~[spring-aop-5.2.9.RELEASE.jar:5.2.9.RELEASE] at com.tplink.nbu.cloudstorage.appserver.api.impl.IndexServerApiImpl$MockitoMock$1163662474$$EnhancerBySpringCGLIB$$81a9df8b.batchQueryLastEventDeviceInfo(<generated>) ~[classes/:?] at com.tplink.nbu.cloudstorage.appserver.service.impl.WeeklyReportServiceImpl.tryFillAliasAndGetAgentNvrChannelDeviceId(WeeklyReportServiceImpl.java:966) ~[classes/:?] at com.tplink.nbu.cloudstorage.appserver.service.impl.WeeklyReportServiceImpl.lambda$getUsefulDeviceReportsAndSum$14(WeeklyReportServiceImpl.java:884) ~[classes/:?] at java.util.ArrayList.forEach(ArrayList.java:1541) ~[?:?] at com.tplink.nbu.cloudstorage.appserver.service.impl.WeeklyReportServiceImpl.getUsefulDeviceReportsAndSum(WeeklyReportServiceImpl.java:874) ~[classes/:?] at com.tplink.nbu.cloudstorage.appserver.service.impl.WeeklyReportServiceImpl.checkAndCalculate(WeeklyReportServiceImpl.java:831) ~[classes/:?] at com.tplink.nbu.cloudstorage.appserver.service.impl.WeeklyReportServiceImpl.parseAndProcessReports(WeeklyReportServiceImpl.java:500) ~[classes/:?] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?] at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?] at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344) ~[spring-aop-5.2.9.RELEASE.jar:5.2.9.RELEASE] at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:205) ~[spring-aop-5.2.9.RELEASE.jar:5.2.9.RELEASE] at com.sun.proxy.$Proxy272.parseAndProcessReports(Unknown Source) ~[?:?] at com.tplink.nbu.cloudstorage.appserver.service.impl.WeeklyReportServiceImplTest.lambda$testCalculate$7(WeeklyReportServiceImplTest.java:272) ~[test-classes/:?] at org.junit.jupiter.api.AssertDoesNotThrow.assertDoesNotThrow(AssertDoesNotThrow.java:72) [junit-jupiter-api-5.5.2.jar:5.5.2] at org.junit.jupiter.api.AssertDoesNotThrow.assertDoesNotThrow(AssertDoesNotThrow.java:59) [junit-jupiter-api-5.5.2.jar:5.5.2] at org.junit.jupiter.api.Assertions.assertDoesNotThrow(Assertions.java:3065) [junit-jupiter-api-5.5.2.jar:5.5.2] at com.tplink.nbu.cloudstorage.appserver.service.impl.WeeklyReportServiceImplTest.testCalculate(WeeklyReportServiceImplTest.java:272) [test-classes/:?] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?] at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?] at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) [junit-4.12.jar:4.12] at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) [junit-4.12.jar:4.12] at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) [junit-4.12.jar:4.12] at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) [junit-4.12.jar:4.12] at org.springframework.test.context.junit4.statements.RunBeforeTestExecutionCallbacks.evaluate(RunBeforeTestExecutionCallbacks.java:74) [spring-test-5.2.9.RELEASE.jar:5.2.9.RELEASE] at org.springframework.test.context.junit4.statements.RunAfterTestExecutionCallbacks.evaluate(RunAfterTestExecutionCallbacks.java:84) [spring-test-5.2.9.RELEASE.jar:5.2.9.RELEASE] at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) [junit-4.12.jar:4.12] at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75) [spring-test-5.2.9.RELEASE.jar:5.2.9.RELEASE] at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86) [spring-test-5.2.9.RELEASE.jar:5.2.9.RELEASE] at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84) [spring-test-5.2.9.RELEASE.jar:5.2.9.RELEASE] at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) [junit-4.12.jar:4.12] at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:251) [spring-test-5.2.9.RELEASE.jar:5.2.9.RELEASE] at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97) [spring-test-5.2.9.RELEASE.jar:5.2.9.RELEASE] at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) [junit-4.12.jar:4.12] at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) [junit-4.12.jar:4.12] at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) [junit-4.12.jar:4.12] at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) [junit-4.12.jar:4.12] at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) [junit-4.12.jar:4.12] at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) [spring-test-5.2.9.RELEASE.jar:5.2.9.RELEASE] at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) [spring-test-5.2.9.RELEASE.jar:5.2.9.RELEASE] at org.junit.runners.ParentRunner.run(ParentRunner.java:363) [junit-4.12.jar:4.12] at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190) [spring-test-5.2.9.RELEASE.jar:5.2.9.RELEASE] at org.junit.runner.JUnitCore.run(JUnitCore.java:137) [junit-4.12.jar:4.12] at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69) [junit-rt.jar:?] at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38) [junit-rt.jar:?] at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11) [idea_rt.jar:?] at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35) [junit-rt.jar:?] at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:231) [junit-rt.jar:?] at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:55) [junit-rt.jar:?] 11-03-2025 11:34:31.868 DEBUG [main] [TID: N/A] c.t.n.c.a.g.i.IdempotentHeaderClientInterceptor: [GRPC] Method: LastEventDevice/batchQueryLastEventDeviceInfo, NO_SIDE_EFFECTS 11-03-2025 11:34:31.868 DEBUG [main] [TID: N/A] c.t.n.c.a.c.i.GrpcClientInterceptor: headers: Metadata(serviceid=TAPOCARE_APP,requestdatabrand=TAPO,x-idempotency-level=1) 11-03-2025 11:34:31.869 DEBUG [main] [TID: N/A] c.t.n.c.a.c.i.GrpcClientInterceptor: request: account_id: "20112672" device_unique_ids: "FF81E73D7F900BA3710CC3864247F8EA1D34FCB9" 11-03-2025 11:34:31.869 ERROR [main] [TID: N/A] c.t.n.c.a.s.i.StatServiceImpl: [STAT] {"service":"LastEventDevice","errorType":"UNAVAILABLE","path":"LastEventDevice/batchQueryLastEventDeviceInfo","errorMessage":"Unable to resolve host tapocare-index-aps1.app-ipc.svc.cluster.local","timestamp":1762140871869,"statKey":"@ThirdPartyApiError"} 11-03-2025 11:34:31.871 INFO [main] [TID: N/A] c.t.n.c.a.s.i.StatServiceImpl: [STAT] {"service":"IndexServerApiImpl$MockitoMock$1163662474","method":"batchQueryLastEventDeviceInfo","exception":1,"exeMs":12,"statKey":"@ThirdPartyApiStat"} 11-03-2025 11:34:31.872 ERROR [main] [TID: N/A] c.t.n.c.a.s.i.WeeklyReportServiceImpl: Failed to get alias for ykby1YtyW/I/uyf93jAH1ufG5cTWE2gxNTlXy6+PZt8PvCobWulQWi0lxzBKmOSr 11-03-2025 11:34:31.872 ERROR [main] [TID: N/A] c.t.n.c.a.s.i.WeeklyReportServiceImpl: Empty alias for ykby1YtyW/I/uyf93jAH1ufG5cTWE2gxNTlXy6+PZt8PvCobWulQWi0lxzBKmOSr 11-03-2025 11:34:32.054 INFO [main] [TID: N/A] c.t.n.c.a.s.i.StatServiceImpl: [STAT] {"accountId":"20112672","weeklyReportMessage":"receive data from bigdata","tspSupported":true,"statKey":"@WeeklyReportStat"} 11-03-2025 11:34:32.211 INFO [main] [TID: N/A] c.t.n.c.a.s.i.StatServiceImpl: [STAT] {"service":"IndexServerApiImpl$MockitoMock$1163662474","method":"toString","exception":0,"exeMs":0,"statKey":"@ThirdPartyApiStat"} 11-03-2025 11:34:50.776 INFO [main] [TID: N/A] c.t.n.c.a.s.i.StatServiceImpl: [STAT] {"service":"IndexServerApiImpl$MockitoMock$1163662474","method":"toString","exception":0,"exeMs":1,"statKey":"@ThirdPartyApiStat"} Hibernate: insert into user_report (ctime, mtime, account_id, content, device_id, device_report, expired_time, order_service_type, report_date, status, timezone, type, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) Hibernate: insert into user_report (ctime, mtime, account_id, content, device_id, device_report, expired_time, order_service_type, report_date, status, timezone, type, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) 11-03-2025 11:34:53.601 WARN [main] [TID: N/A] o.h.e.j.s.SqlExceptionHelper: SQL Error: 1062, SQLState: 23000 11-03-2025 11:34:53.601 ERROR [main] [TID: N/A] o.h.e.j.s.SqlExceptionHelper: Duplicate entry '20112672-WEEKLY-6824-04-14' for key 'user_report.account_id_type_report_date_index' 11-03-2025 11:34:53.609 INFO [main] [TID: N/A] c.t.n.c.a.s.i.StatServiceImpl: [STAT] {"service":"IndexServerApiImpl$MockitoMock$1163662474","method":"getMockitoInterceptor","exception":0,"exeMs":0,"statKey":"@ThirdPartyApiStat"} 11-03-2025 11:34:53.610 INFO [main] [TID: N/A] c.t.n.c.a.s.i.StatServiceImpl: [STAT] {"service":"IndexServerApiImpl$MockitoMock$1163662474","method":"getMockitoInterceptor","exception":0,"exeMs":0,"statKey":"@ThirdPartyApiStat"} 11-03-2025 11:34:53.610 INFO [main] [TID: N/A] c.t.n.c.a.s.i.StatServiceImpl: [STAT] {"service":"IndexServerApiImpl$MockitoMock$1163662474","method":"getMockitoInterceptor","exception":0,"exeMs":0,"statKey":"@ThirdPartyApiStat"} 11-03-2025 11:34:53.610 INFO [main] [TID: N/A] c.t.n.c.a.s.i.StatServiceImpl: [STAT] {"service":"IndexServerApiImpl$MockitoMock$1163662474","method":"getMockitoInterceptor","exception":0,"exeMs":0,"statKey":"@ThirdPartyApiStat"} 11-03-2025 11:34:53.610 INFO [main] [TID: N/A] c.t.n.c.a.s.i.StatServiceImpl: [STAT] {"service":"IndexServerApiImpl$MockitoMock$1163662474","method":"getMockitoInterceptor","exception":0,"exeMs":0,"statKey":"@ThirdPartyApiStat"} 11-03-2025 11:34:53.610 INFO [main] [TID: N/A] c.t.n.c.a.s.i.StatServiceImpl: [STAT] {"service":"IndexServerApiImpl$MockitoMock$1163662474","method":"getMockitoInterceptor","exception":0,"exeMs":0,"statKey":"@ThirdPartyApiStat"} 11-03-2025 11:34:53.610 INFO [main] [TID: N/A] c.t.n.c.a.s.i.StatServiceImpl: [STAT] {"service":"IndexServerApiImpl$MockitoMock$1163662474","method":"setMockitoInterceptor","exception":0,"exeMs":0,"statKey":"@ThirdPartyApiStat"} org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; constraint [user_report.account_id_type_report_date_index]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement at org.springframework.orm.jpa.vendor.HibernateJpaDialect.convertHibernateAccessException(HibernateJpaDialect.java:298) at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:255) at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.translateExceptionIfPossible(AbstractEntityManagerFactoryBean.java:528) at org.springframework.dao.support.ChainedPersistenceExceptionTranslator.translateExceptionIfPossible(ChainedPersistenceExceptionTranslator.java:61) at org.springframework.dao.support.DataAccessUtils.translateIfNecessary(DataAccessUtils.java:242) at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:154) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(CrudMethodMetadataPostProcessor.java:149) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:95) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212) at com.sun.proxy.$Proxy275.pageFindByAccountIdAndTypeAndReportDate(Unknown Source) at com.tplink.nbu.cloudstorage.appserver.service.impl.WeeklyReportServiceImpl.getUserReportByDeviceIds(WeeklyReportServiceImpl.java:321) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:205) at com.sun.proxy.$Proxy272.getUserReportByDeviceIds(Unknown Source) at com.tplink.nbu.cloudstorage.appserver.service.impl.WeeklyReportServiceImplTest.testCalculate(WeeklyReportServiceImplTest.java:273) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.springframework.test.context.junit4.statements.RunBeforeTestExecutionCallbacks.evaluate(RunBeforeTestExecutionCallbacks.java:74) at org.springframework.test.context.junit4.statements.RunAfterTestExecutionCallbacks.evaluate(RunAfterTestExecutionCallbacks.java:84) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75) at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86) at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:251) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69) at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38) at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11) at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35) at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:231) at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:55) Caused by: org.hibernate.exception.ConstraintViolationException: could not execute statement at org.hibernate.exception.internal.SQLExceptionTypeDelegate.convert(SQLExceptionTypeDelegate.java:59) at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:42) at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:113) at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:99) at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:200) at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3255) at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3782) at org.hibernate.action.internal.EntityInsertAction.execute(EntityInsertAction.java:107) at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:604) at org.hibernate.engine.spi.ActionQueue.lambda$executeActions$1(ActionQueue.java:478) at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:684) at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:475) at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:348) at org.hibernate.event.internal.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:57) at org.hibernate.event.service.internal.EventListenerGroupImpl.fireEventOnEachListener(EventListenerGroupImpl.java:102) at org.hibernate.internal.SessionImpl.autoFlushIfRequired(SessionImpl.java:1328) at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1408) at org.hibernate.query.internal.AbstractProducedQuery.doList(AbstractProducedQuery.java:1565) at org.hibernate.query.internal.AbstractProducedQuery.list(AbstractProducedQuery.java:1533) at org.hibernate.query.Query.getResultList(Query.java:165) at org.springframework.data.jpa.repository.query.JpaQueryExecution$CollectionExecution.doExecute(JpaQueryExecution.java:126) at org.springframework.data.jpa.repository.query.JpaQueryExecution.execute(JpaQueryExecution.java:88) at org.springframework.data.jpa.repository.query.AbstractJpaQuery.doExecute(AbstractJpaQuery.java:154) at org.springframework.data.jpa.repository.query.AbstractJpaQuery.execute(AbstractJpaQuery.java:142) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:618) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:605) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:80) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:367) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:118) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:139) ... 49 more Caused by: java.sql.SQLIntegrityConstraintViolationException: Duplicate entry '20112672-WEEKLY-6824-04-14' for key 'user_report.account_id_type_report_date_index' at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:117) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97) at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122) at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:953) at com.mysql.cj.jdbc.ClientPreparedStatement.executeUpdateInternal(ClientPreparedStatement.java:1092) at com.mysql.cj.jdbc.ClientPreparedStatement.executeUpdateInternal(ClientPreparedStatement.java:1040) at com.mysql.cj.jdbc.ClientPreparedStatement.executeLargeUpdate(ClientPreparedStatement.java:1347) at com.mysql.cj.jdbc.ClientPreparedStatement.executeUpdate(ClientPreparedStatement.java:1025) at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeUpdate(ProxyPreparedStatement.java:61) at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeUpdate(HikariProxyPreparedStatement.java) at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:197) ... 77 more 11-03-2025 11:34:54.279 WARN [Apollo-RemoteConfigLongPollService-1] [TID: N/A] c.c.f.a.i.RemoteConfigLongPollService: Long polling failed, will retry in 120 seconds. appId: tapocare_app, cluster: dev-aps1, namespaces: networkAcceleration__application.yaml, long polling url: null, reason: Get config services failed from https://apollo-configservice-alpha.i.tplinknbu.com/services/config?appId=tapocare_app&ip=192.168.131.1 [Cause: Could not complete get operation [Cause: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target [Cause: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target [Cause: unable to find valid certification path to requested target]]]] 11-03-2025 11:35:04.221 WARN [Thread-4] [TID: N/A] c.t.n.c.c.m.i.RegionUrlMonitorImpl: MonitorThread Thread-4 is interrupted 11-03-2025 11:35:04.221 ERROR [Thread-4] [TID: N/A] c.t.n.c.c.m.i.RegionUrlMonitorImpl: MonitorThread Thread-4 stopped 11-03-2025 11:35:06.306 WARN [SpringContextShutdownHook] [TID: N/A] c.t.n.c.h.r.s.SyncHttpClientImpl: Destroy the SyncHttpClient!! 11-03-2025 11:35:06.307 DEBUG [SpringContextShutdownHook] [TID: N/A] c.t.n.c.h.r.a.AsyncHttpClientImpl: Destroy the AsyncHttpClient!! 11-03-2025 11:35:07.113 INFO [SpringContextShutdownHook] [TID: N/A] c.z.h.HikariDataSource: HikariCP-TapoCare - Shutdown initiated... 11-03-2025 11:35:07.114 INFO [SpringContextShutdownHook] [TID: N/A] c.z.h.HikariDataSource: HikariCP-TapoCare - Shutdown completed. 已与地址为 ''127.0.0.1:56903',传输: '套接字'' 的目标虚拟机断开连接
11-04
18:04:57.394 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating CacheAwareContextLoaderDelegate from class [org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate] 18:04:57.400 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating BootstrapContext using constructor [public org.springframework.test.context.support.DefaultBootstrapContext(java.lang.Class,org.springframework.test.context.CacheAwareContextLoaderDelegate)] 18:04:57.424 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating TestContextBootstrapper for test class [com.itheima.SpringTalis01ApplicationTests] from class [org.springframework.boot.test.context.SpringBootTestContextBootstrapper] 18:04:57.433 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Neither @ContextConfiguration nor @ContextHierarchy found for test class [com.itheima.SpringTalis01ApplicationTests], using SpringBootContextLoader 18:04:57.436 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [com.itheima.SpringTalis01ApplicationTests]: class path resource [com/itheima/SpringTalis01ApplicationTests-context.xml] does not exist 18:04:57.436 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [com.itheima.SpringTalis01ApplicationTests]: class path resource [com/itheima/SpringTalis01ApplicationTestsContext.groovy] does not exist 18:04:57.436 [main] INFO org.springframework.test.context.support.AbstractContextLoader - Could not detect default resource locations for test class [com.itheima.SpringTalis01ApplicationTests]: no resource found for suffixes {-context.xml, Context.groovy}. 18:04:57.437 [main] INFO org.springframework.test.context.support.AnnotationConfigContextLoaderUtils - Could not detect default configuration classes for test class [com.itheima.SpringTalis01ApplicationTests]: SpringTalis01ApplicationTests does not declare any static, non-private, non-final, nested classes annotated with @Configuration. 18:04:57.467 [main] DEBUG org.springframework.test.context.support.ActiveProfilesUtils - Could not find an 'annotation declaring class' for annotation type [org.springframework.test.context.ActiveProfiles] and class [com.itheima.SpringTalis01ApplicationTests] 18:04:57.504 [main] DEBUG org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider - Identified candidate component class: file [E:\event\spring-talis01\target\classes\com\itheima\SpringTalis01Application.class] 18:04:57.505 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Found @SpringBootConfiguration com.itheima.SpringTalis01Application for test class com.itheima.SpringTalis01ApplicationTests 18:04:57.582 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - @TestExecutionListeners is not present for class [com.itheima.SpringTalis01ApplicationTests]: using defaults. 18:04:57.583 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener, org.springframework.boot.test.autoconfigure.webservices.client.MockWebServiceServerTestExecutionListener, org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.context.event.ApplicationEventsTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener, org.springframework.test.context.event.EventPublishingTestExecutionListener] 18:04:57.590 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Skipping candidate TestExecutionListener [org.springframework.test.context.web.ServletTestExecutionListener] due to a missing dependency. Specify custom listener classes or make the default listener classes and their required dependencies available. Offending class: [javax/servlet/ServletContext] 18:04:57.596 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Using TestExecutionListeners: [org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@e19bb76, org.springframework.test.context.event.ApplicationEventsTestExecutionListener@512535ff, org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener@71529963, org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener@61a88b8c, org.springframework.test.context.support.DirtiesContextTestExecutionListener@22295ec4, org.springframework.test.context.transaction.TransactionalTestExecutionListener@5adb0db3, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener@3f270e0a, org.springframework.test.context.event.EventPublishingTestExecutionListener@1a760689, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener@7241a47d, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener@70f59913, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener@77258e59, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener@5dcd8c7a, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener@2250b9f2, org.springframework.boot.test.autoconfigure.webservices.client.MockWebServiceServerTestExecutionListener@7e3181aa] 18:04:57.599 [main] DEBUG org.springframework.test.context.support.AbstractDirtiesContextTestExecutionListener - Before test class: context [DefaultTestContext@32f232a5 testClass = SpringTalis01ApplicationTests, testInstance = [null], testMethod = [null], testException = [null], mergedContextConfiguration = [MergedContextConfiguration@43f82e78 testClass = SpringTalis01ApplicationTests, locations = '{}', classes = '{class com.itheima.SpringTalis01Application}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true}', contextCustomizers = set[org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@57a78e3, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@2767e23c, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@70ed52de, org.springframework.boot.test.autoconfigure.actuate.metrics.MetricsExportContextCustomizerFactory$DisableMetricExportContextCustomizer@4082ba93, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer@536f2a7e, org.springframework.boot.test.context.SpringBootTestArgs@1, org.springframework.boot.test.context.SpringBootTestWebEnvironment@6ee12bac], contextLoader = 'org.springframework.boot.test.context.SpringBootContextLoader', parent = [null]], attributes = map[[empty]]], class annotated with @DirtiesContext [false] with mode [null]. 18:04:57.612 [main] DEBUG org.springframework.test.context.support.DependencyInjectionTestExecutionListener - Performing dependency injection for test context [[DefaultTestContext@32f232a5 testClass = SpringTalis01ApplicationTests, testInstance = com.itheima.SpringTalis01ApplicationTests@4b6690c0, testMethod = [null], testException = [null], mergedContextConfiguration = [MergedContextConfiguration@43f82e78 testClass = SpringTalis01ApplicationTests, locations = '{}', classes = '{class com.itheima.SpringTalis01Application}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true}', contextCustomizers = set[org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@57a78e3, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@2767e23c, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@70ed52de, org.springframework.boot.test.autoconfigure.actuate.metrics.MetricsExportContextCustomizerFactory$DisableMetricExportContextCustomizer@4082ba93, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer@536f2a7e, org.springframework.boot.test.context.SpringBootTestArgs@1, org.springframework.boot.test.context.SpringBootTestWebEnvironment@6ee12bac], contextLoader = 'org.springframework.boot.test.context.SpringBootContextLoader', parent = [null]], attributes = map['org.springframework.test.context.event.ApplicationEventsTestExecutionListener.recordApplicationEvents' -> false]]]. . ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v2.6.13) 2025-07-23 18:04:57.812 INFO 8884 --- [ main] c.itheima.SpringTalis01ApplicationTests : Starting SpringTalis01ApplicationTests using Java 11.0.15.1 on DESKTOP-QL50GBE with PID 8884 (started by 91076 in E:\event\spring-talis01) 2025-07-23 18:04:57.813 INFO 8884 --- [ main] c.itheima.SpringTalis01ApplicationTests : No active profile set, falling back to 1 default profile: "default" 2025-07-23 18:04:58.342 INFO 8884 --- [ main] c.itheima.SpringTalis01ApplicationTests : Started SpringTalis01ApplicationTests in 0.706 seconds (JVM running for 1.328) 2025-07-23 18:04:58.535 INFO 8884 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting... 2025-07-23 18:04:58.753 INFO 8884 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed. org.springframework.jdbc.BadSqlGrammarException: ### Error updating database. Cause: java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ',dept_id=1,update_time='2025-07-23 18:04:58.525767' where id = 18' at line 1 ### The error may exist in com/itheima/Mapper/EmpMapper.java (best guess) ### The error may involve com.itheima.Mapper.EmpMapper.updateEmp-Inline ### The error occurred while setting parameters ### SQL: update emp set username = ?,name = ?,gender=?,image=?,job=?,entrydate=?,,dept_id=?,update_time=? where id = ? ### Cause: java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ',dept_id=1,update_time='2025-07-23 18:04:58.525767' where id = 18' at line 1 ; bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ',dept_id=1,update_time='2025-07-23 18:04:58.525767' where id = 18' at line 1 at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:239) at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70) at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91) at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441) at com.sun.proxy.$Proxy53.update(Unknown Source) at org.mybatis.spring.SqlSessionTemplate.update(SqlSessionTemplate.java:288) at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:67) at org.apache.ibatis.binding.MapperProxy$PlainMethodInvoker.invoke(MapperProxy.java:145) at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:86) at com.sun.proxy.$Proxy64.updateEmp(Unknown Source) at com.itheima.SpringTalis01ApplicationTests.testUpdateEmp(SpringTalis01ApplicationTests.java:65) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:725) at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60) at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131) at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:149) at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:140) at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:84) at org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(ExecutableInvoker.java:115) at org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105) at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106) at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64) at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45) at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37) at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:104) at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:98) at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$7(TestMethodTestDescriptor.java:214) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:210) at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:135) at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:66) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:151) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141) at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138) at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95) at java.base/java.util.ArrayList.forEach(ArrayList.java:1541) at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141) at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138) at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95) at java.base/java.util.ArrayList.forEach(ArrayList.java:1541) at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141) at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138) at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95) at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35) at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57) at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:107) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:88) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:54) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:67) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:52) at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114) at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86) at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86) at org.junit.platform.launcher.core.SessionPerRequestLauncher.execute(SessionPerRequestLauncher.java:53) at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:57) at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38) at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11) at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35) at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:232) at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:55) Caused by: java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ',dept_id=1,update_time='2025-07-23 18:04:58.525767' where id = 18' at line 1 at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120) at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122) at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:916) at com.mysql.cj.jdbc.ClientPreparedStatement.execute(ClientPreparedStatement.java:354) at com.zaxxer.hikari.pool.ProxyPreparedStatement.execute(ProxyPreparedStatement.java:44) at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.execute(HikariProxyPreparedStatement.java) at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:47) at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:74) at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:50) at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:117) at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:76) at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:194) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:427) ... 76 more 2025-07-23 18:04:58.888 INFO 8884 --- [ionShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated... 2025-07-23 18:04:58.896 INFO 8884 --- [ionShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed.
07-24
The University of Birmingham School of Computer Science Assignment 1 – Text Based Game Deadline: 16:00, Nov 10, 2025 Author: Pieter Joubert Reviewers: Jon Rowe Ahmad Ibrahim Wendy Yanez Sergey Goncharov Version 2.5 An Assignment submitted for the UoB: Object Oriented Programming October 20, 2025 Start of the revision history table Revision History Revision Date Author(s) Description 1.0 19/10/2025 PJ Initial version. 1.1 23/10/2025 PJ Minor updates and corrections 1 Contents 1 Introduction 4 2 Mark allocations 4 2.1 2.2 Minimum expected commands . . . . . . . . . . . . . . . . . . . . . . 4 Additional commands . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 2.3 Minimum game requirements . . . . . . . . . . . . . . . . . . . . . . . 5 3 Task 1 - Position.java 5 4 Task 2 - Room.java 6 5 Task 3 - Map.java 6 6 Task 4 - Inventory.java 6 7 Task 5 - Score.java 7 8 Task 6 - Game.java 7 9 Submission Procedure 8 10 Rubric 8 11 Sample Output 9 2 *Rules* 1. For each class refer to its corresponding test to verify field and method naming conventions. 2. Although there are many ways to construct an application, you are required to adhere to the rules stipulated below (to achieve marks). 3. If variable names are not stipulated, you can use your own names for variables. This shows that you have written the application (we will check for plagiarism). 4. Inclusion of extra imports is strictly prohibited and will lead to a substantial penalty. You are restricted from using external libraries or any libraries that are not pre-included in the provided skeleton code. 5. Do NOT change or modify files included in the "test", "lib" or "out" folders. 6. Do NOT modify the template code. However, you are allowed to create your own methods if they are needed. 7. You MUST complete this assignment independently, producing your own code – Do NOT discuss or share your code with others. Any use of external generative- AI or code source is prohibited. Any cheating behaviour will result in a zero score for this module and will be subject to punishment by the University. 8. It is *STRONGLY ADVISED AGAINST* utilizing any translation software (such as Google Translate) for the translation of this document. 9. The jUnit tests included in the skeleton code are basic and only scratch the surface in evaluating your code. Passing these tests does not guarantee a full mark. 10. Wrong file structure leads to a substantial penalty. Make sure you have followed the Submission Instructions on the Assignment 1 Canvas page. 11. Make sure you complete all the required sections. 12. Make sure you have pushed the version of your code that you want marked to gitlab. 3 1 Introduction In this assignment, you are tasked with creating a basic text-based game in the style of Zork (https://en.wikipedia.org/wiki/Zork) The game is played by the user entering in various commands (e.g. "move south", "look", "search chest", "get key"), to which the game responds with text based output (e.g. "You pick up the rusty key"). You need to create your own narrative or story for the game. This narrative can be of any genre: science-fiction, cosy cooking game, fantasy, detective noir, etc. The game consists of "rooms" or "areas" which the player can travel to and perform actions in. Your game also needs to present puzzles to the player. Puzzles involve the player using an item in their inventory. The game will also provide the player with a score based on how many "rooms" they have visited and how many puzzles they have solved. Finally, the game also needs to display a text-based map of the game world as the player is exploring. 2 Mark allocations You will receive marks based on two aspects of the game: Firstly, the results of running the test.sh command. We will run our own version of these tests once you have submit- ted. This command will test each class and method (detailed as Task 1 - 6). You need to implement all the classes and methods shown in the Task sections. Secondly, you will need to submit a screen recording showing you playing the game and discussing the code. Your screen recording needs to have the following: • Show your face and your student card or any other valid proof of identity (e.g. Passport or drivers license). • Play through the game once showing all the rooms, puzzles and an example of each of the expected commands. Do this in the order given in Section 2.1 • Show and briefly explain the code in your Game.java file. • Show and briefly explain anything additional, innovative, or interesting you did in the game. The screen recording must be shorter than 5 minutes. You can use a text-to-speech app if you do not want to record your own voice. 2.1 Minimum expected commands The following is a minimum list of commands the game must be able to parse (values in angle brackets refer to arguments given to a command): 4 • "move <direction>" - (<direction> can be "north", "south", "east", "west"). The player moves to a new room based on the direction. • "look" - Displays a description of the room the player is in. • "look <feature>" - Displays a more detailed description of a feature in a room. A feature is a fixed object in the room. • "look <item>" - Displays a description of an item. This should only work if the item is in the player’s inventory. • "inventory" - Displays a list of all items the player has obtained. • "score" - Displays the user’s current score. • "map" - Displays a text-based map of the current explored game world. • "help" - Displays a help message. • "quit" - Quits the game. 2.2 Additional commands You need to add additional commands of your choice for the puzzles you will create. For example, "open toolbox" will open a toolbox. Then "take crowbar" will take the crowbar out of the toolbox and put it into the user’s inventory. You can create any other additional commands you want so long as they make log- ical sense in your game. You need to use these additional commands to create your puzzles. 2.3 Minimum game requirements The following are the minimum requirements for the game. You are welcome to add more if you want to: • At least ten (10) unique rooms or areas. • At least two (2) puzzles. • At least four (4) items. 3 Task 1 - Position.java The Position class stores an position in terms of an x and y value. The required methods are: • public Position(int x, int y) The x and y fields need to be declared as public so that other classes can access them directly. 5 4 Task 2 - Room.java The Room class stores information about a Room, including a name, description, a symbol and a Position. The required methods are: • public Room(String name, String description, char symbol, Position position) • public String getName() • public String getDescription() • public char getSymbol() • public Position getPosition() The symbol is used when displaying the room on the map. 5 Task 3 - Map.java The Map class stores information about the game Map, including the map array, a width and height, and the value used for empty map areas. The required methods are: • public Map(int width, int height) (this represents the rows and columns starting at the top left of the map) • public void placeRoom(Position pos, char symbol) • public String display() Declare the empty area value as follows: final private char EMPTY =' . '; 6 Task 4 - Inventory.java The Inventory class stores the player’s inventory, and is essentially a wrapper around an array. It includes the maximum items you can store, the current number of items stored and an array to store the items in. The required methods are: • public Inventory() • public void addItem(String item) Adds an item to the array if there is space. • public int hasItem(String item) Returns the position of the item in the array if it is in the array. Otherwise it returns -1 6 • public void removeItem(String item) Removes a specified item while ensuring there are no empty elements in the array. • public String displayInventory() Returns a String of all items sepa- rated by spaces (note that there is a space after the last item as well). Declare the maximum size as follows: final int MAX_ITEMS = 10; 7 Task 5 - Score.java The Score class stores and calculates the player’s score. It includes the starting score, the current score, the number of rooms visited, the number of puzzles solved and the score per puzzle. The required methods are: • public Score(int startingScore) • public void visitRoom() • public void solvePuzzle() • public double getScore() Calculates and returns the current score. The score is calculated as the starting score minus the number of rooms visited plus the number of solved puzzles times the score per puzzle. Declare the score per puzzle as follows: private final int PUZZLE_VALUE = 10; 8 Task 6 - Game.java The Game class runs the main game loop. You can create any methods you feel you require but you need to use all the other classes to make the game work. The only required method is: • public static void main(String[] args) You can write this code in any way you want to but here is a hint for a possible approach: • Create some Room objects to store information about each Room in your game. • Create Inventory and Score objects. • Use a while loop for the main game loop. • Inside this loop use an if statement to check what commands the user has typed. Based on the command, the Room the user is in and what items the user has in their inventory output a different response and update the Inventory, Score and Map information if appropriate. 7 9 Submission Procedure The general steps to take to complete the project are as follows: • Set up your gitlab ssh access using the setup-git command on vlab. • Copy your ssh key to your gitlab profile. • Clone the template repository from your gitlab.Do not change any of the code in the template but you may add to it. • Work on your code, testing it regularly. Use the run.sh script to run the code as this builds the code correctly as well. • Use the test.sh script to test your code. This will give you an output similar to what we will use to mark the code. • Make sure you commit and push regularly as well. • Make sure to add comments to your code to clearly explain what each method is doing. • Once you have completed the code, record a short video using MS Stream. Refer to Section 2 for more information. • Submit the video to canvas. • Submit the latest commit hash to canvas. • You will receive an automated message indicating whether we are able to mark your code. • If there are no problems you are done with the assignment. • If there are problems with your submission, update it accordingly and resubmit the latest commit hash. 10 Rubric Task Submission Type Mark Position.java Room.java Map.java Inventory Score Game playthrough Game.java Additional features gitlab 5 gitlab gitlab gitlab gitlab Canvas video submission Canvas video submission Canvas video submission 10 10 15 10 20 15 15 Total 100 Table 2: Mark Rubric 8 11 Sample Output Your empty cell in the brig. The only notable feature is the half open cell door to the south. >> move south You follow the hallway south >> move south You follow the hallway towards the control room >> look You are standing in the control room of the brig. There is a control panel with a number of large button with ’locked’ written on it. >> press button You press the button marked ’locked’ . >> look You are standing in the control room of the brig. There is a control panel with a number of large button with ’unlocked’ now written on it. The lock on the door to the east is open. >> move east You go east. >> look You are standing in a dark and dusty storage room. You notice a closed toolbox standing on a crate. There is a metal grate in the corner of the room. >> inventory You have: >> map .......... .c........ .h........ .bs....... .......... .......... .......... .......... .......... .......... >> open toolbox You open the toolbox. Inside you find a crowbar. >> take crowbar You take the crowbar. >> inventory You have: crowbar >> use crowbar on grate You lift the grate up. A ladder leads down into darkness. >> look You are standing in a dark and dusty storage room. You notice a open and empty toolbox standing on a crate. There is a open metal grate in the corner of the room. >> help 9 Valid commands are: <look>, <move> <direction>, <look feature>, <look item>, <help>, <inventory>, <map>, <score> and <quit> >> score SCORE: 106.0 >> quit Game over 10 能帮我生成一个符合上面要求的代码吗
11-08
源码地址: https://pan.quark.cn/s/a4b39357ea24 欧姆龙触摸屏编程软件MPTST 5.02是专门为欧姆龙品牌的工业触摸屏而研发的编程解决方案,它赋予用户在直观界面上构建、修改以及排错触摸屏应用程序的能力。 该软件在工业自动化领域具有不可替代的地位,特别是在生产线监视、设备操控以及人机互动系统中发挥着核心作用。 欧姆龙MPTST(Machine Process Terminal Software Touch)5.02版本配备了多样化的功能,旨在应对不同种类的触摸屏项目要求。 以下列举了若干核心特性:1. **图形化编程**:MPTST 5.02采用图形化的编程模式,允许用户借助拖拽动作来设计屏幕布局,设定按钮、滑块、指示灯等组件,显著简化了编程流程,并提升了工作效率。 2. **兼容性**:该软件能够适配欧姆龙的多个触摸屏产品线,包括CX-One、NS系列、NJ/NX系列等,使用户可以在同一个平台上完成对不同硬件的编程任务。 3. **数据通信**:MPTST 5.02具备与PLC(可编程逻辑控制器)进行数据交互的能力,通过将触摸屏作为操作界面,实现生产数据的显示与输入,以及设备状态的监控。 4. **报警与事件管理**:软件中集成了报警和事件管理机制,可以设定多种报警标准,一旦达到预设条件,触摸屏便会展示对应的报警提示,助力操作人员迅速做出响应。 5. **模拟测试**:在设备实际连接之前,MPTST 5.02支持用户进行脱机模拟测试,以此验证程序的正确性与稳定性。 6. **项目备份与恢复**:为了防止数据遗失,MPTST 5.02提供了项目文件的备份及还原功能,对于多版本控制与团队协作具有显著价值。 7. **多语言支持**:针对全球化的应...
本资源包为流体力学与化学传质交叉领域的研究提供了一套完整的数值模拟解决方案,重点针对湍流条件下通道内溶解物质的输运与分布规律进行定量分析。该工具集专为高等院校理工科专业的教育与科研需求设计,尤其适合计算机科学、电子工程及数学等相关学科的本科生在完成课程项目、综合设计或学位论文时使用。 软件环境兼容多个版本的MatLAB平台,包括2014a、2019b及后续的2024b发行版,确保了在不同实验室或个人计算环境中的可移植性。资源包内预置了经过验证的示例数据集,用户可直接调用主程序执行计算,显著降低了初始学习成本,使初学者能够迅速掌握基本操作流程。 代码架构采用模块化与参数驱动设计。所有关键物理参数(如流速、扩散系数、边界条件等)均集中于独立的配置模块,用户无需深入底层算法即可灵活调整计算条件,从而高效模拟多种湍流溶解场景。程序逻辑结构清晰,各功能段均配有详尽的说明注释,既阐述了数值方法的理论依据,也解释了关键步骤的实现意图,便于使用者理解模型构建过程并进行针对性修改。 在学术训练方面,本工具能够帮助学生将抽象的流体动力学与传质理论转化为可视化的数值实验结果,深化对湍流混合、浓度边界层等概念的理解。对于毕业设计或专题研究,其参数化框架支持用户嵌入自定义模型,开展创新性数值实验,为深入研究复杂流动中的溶解机制提供可靠的技术支撑。 总体而言,该MATLAB分析工具集通过结构化的代码设计、完备的案例支持与广泛的版本兼容性,为流体溶解现象的数值研究提供了一个高效、可扩展的计算平台,兼具教学示范与科研探索的双重价值。 资源来源于网络分享,仅用于学习交流使用,请勿用于商业,如有侵权请联系我删除!
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值