Compare commits
2 Commits
b6afa8355f
...
79bbcca648
Author | SHA1 | Date | |
---|---|---|---|
|
79bbcca648 | ||
|
7526d3fd8b |
BIN
data.mv.db
BIN
data.mv.db
Binary file not shown.
374
data.trace.db
Normal file
374
data.trace.db
Normal file
@ -0,0 +1,374 @@
|
|||||||
|
2024-04-20 21:36:59.377754+04:00 database: flush
|
||||||
|
org.h2.message.DbException: Внутренняя ошибка: "org.h2.mvstore.MVStoreException: The file is locked: C:/4 semestr/IP/IP-Labs-4-semestr/data.mv.db [2.2.224/7]"
|
||||||
|
General error: "org.h2.mvstore.MVStoreException: The file is locked: C:/4 semestr/IP/IP-Labs-4-semestr/data.mv.db [2.2.224/7]" [50000-224]
|
||||||
|
at org.h2.message.DbException.get(DbException.java:212)
|
||||||
|
at org.h2.message.DbException.convert(DbException.java:407)
|
||||||
|
at org.h2.mvstore.db.Store.lambda$new$0(Store.java:122)
|
||||||
|
at org.h2.mvstore.MVStore.handleException(MVStore.java:1546)
|
||||||
|
at org.h2.mvstore.MVStore.panic(MVStore.java:371)
|
||||||
|
at org.h2.mvstore.MVStore.<init>(MVStore.java:291)
|
||||||
|
at org.h2.mvstore.MVStore$Builder.open(MVStore.java:2035)
|
||||||
|
at org.h2.mvstore.db.Store.<init>(Store.java:133)
|
||||||
|
at org.h2.engine.Database.<init>(Database.java:326)
|
||||||
|
at org.h2.engine.Engine.openSession(Engine.java:92)
|
||||||
|
at org.h2.engine.Engine.openSession(Engine.java:222)
|
||||||
|
at org.h2.engine.Engine.createSession(Engine.java:201)
|
||||||
|
at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:343)
|
||||||
|
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:125)
|
||||||
|
at org.h2.Driver.connect(Driver.java:59)
|
||||||
|
at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138)
|
||||||
|
at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:359)
|
||||||
|
at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:201)
|
||||||
|
at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:470)
|
||||||
|
at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:561)
|
||||||
|
at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:100)
|
||||||
|
at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112)
|
||||||
|
at org.springframework.boot.autoconfigure.h2.H2ConsoleAutoConfiguration.getConnectionUrl(H2ConsoleAutoConfiguration.java:94)
|
||||||
|
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
|
||||||
|
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
|
||||||
|
at java.base/java.util.stream.SortedOps$RefSortingSink.end(SortedOps.java:395)
|
||||||
|
at java.base/java.util.stream.Sink$ChainedReference.end(Sink.java:261)
|
||||||
|
at java.base/java.util.stream.Sink$ChainedReference.end(Sink.java:261)
|
||||||
|
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:510)
|
||||||
|
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
|
||||||
|
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:575)
|
||||||
|
at java.base/java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260)
|
||||||
|
at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:616)
|
||||||
|
at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:622)
|
||||||
|
at java.base/java.util.stream.ReferencePipeline.toList(ReferencePipeline.java:627)
|
||||||
|
at org.springframework.boot.autoconfigure.h2.H2ConsoleAutoConfiguration.logDataSources(H2ConsoleAutoConfiguration.java:86)
|
||||||
|
at org.springframework.boot.autoconfigure.h2.H2ConsoleAutoConfiguration.lambda$h2Console$0(H2ConsoleAutoConfiguration.java:69)
|
||||||
|
at org.springframework.boot.autoconfigure.h2.H2ConsoleAutoConfiguration.withThreadContextClassLoader(H2ConsoleAutoConfiguration.java:78)
|
||||||
|
at org.springframework.boot.autoconfigure.h2.H2ConsoleAutoConfiguration.h2Console(H2ConsoleAutoConfiguration.java:69)
|
||||||
|
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
|
||||||
|
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
|
||||||
|
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:140)
|
||||||
|
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:644)
|
||||||
|
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:636)
|
||||||
|
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1335)
|
||||||
|
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1165)
|
||||||
|
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:562)
|
||||||
|
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:522)
|
||||||
|
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326)
|
||||||
|
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
|
||||||
|
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324)
|
||||||
|
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:205)
|
||||||
|
at org.springframework.boot.web.servlet.ServletContextInitializerBeans.getOrderedBeansOfType(ServletContextInitializerBeans.java:210)
|
||||||
|
at org.springframework.boot.web.servlet.ServletContextInitializerBeans.getOrderedBeansOfType(ServletContextInitializerBeans.java:201)
|
||||||
|
at org.springframework.boot.web.servlet.ServletContextInitializerBeans.addServletContextInitializerBeans(ServletContextInitializerBeans.java:96)
|
||||||
|
at org.springframework.boot.web.servlet.ServletContextInitializerBeans.<init>(ServletContextInitializerBeans.java:85)
|
||||||
|
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.getServletContextInitializerBeans(ServletWebServerApplicationContext.java:266)
|
||||||
|
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.selfInitialize(ServletWebServerApplicationContext.java:240)
|
||||||
|
at org.springframework.boot.web.embedded.tomcat.TomcatStarter.onStartup(TomcatStarter.java:52)
|
||||||
|
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4880)
|
||||||
|
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:171)
|
||||||
|
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1332)
|
||||||
|
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1322)
|
||||||
|
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
|
||||||
|
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
|
||||||
|
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:145)
|
||||||
|
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:866)
|
||||||
|
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:845)
|
||||||
|
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:171)
|
||||||
|
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1332)
|
||||||
|
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1322)
|
||||||
|
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
|
||||||
|
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
|
||||||
|
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:145)
|
||||||
|
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:866)
|
||||||
|
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:240)
|
||||||
|
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:171)
|
||||||
|
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:433)
|
||||||
|
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:171)
|
||||||
|
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:921)
|
||||||
|
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:171)
|
||||||
|
at org.apache.catalina.startup.Tomcat.start(Tomcat.java:437)
|
||||||
|
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:126)
|
||||||
|
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.<init>(TomcatWebServer.java:105)
|
||||||
|
at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getTomcatWebServer(TomcatServletWebServerFactory.java:499)
|
||||||
|
at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:218)
|
||||||
|
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:188)
|
||||||
|
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:162)
|
||||||
|
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:618)
|
||||||
|
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146)
|
||||||
|
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754)
|
||||||
|
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:456)
|
||||||
|
at org.springframework.boot.SpringApplication.run(SpringApplication.java:334)
|
||||||
|
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1354)
|
||||||
|
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1343)
|
||||||
|
at com.example.demo.DemoApplication.main(DemoApplication.java:39)
|
||||||
|
Caused by: org.h2.jdbc.JdbcSQLNonTransientException: Внутренняя ошибка: "org.h2.mvstore.MVStoreException: The file is locked: C:/4 semestr/IP/IP-Labs-4-semestr/data.mv.db [2.2.224/7]"
|
||||||
|
General error: "org.h2.mvstore.MVStoreException: The file is locked: C:/4 semestr/IP/IP-Labs-4-semestr/data.mv.db [2.2.224/7]" [50000-224]
|
||||||
|
at org.h2.message.DbException.getJdbcSQLException(DbException.java:566)
|
||||||
|
at org.h2.message.DbException.getJdbcSQLException(DbException.java:489)
|
||||||
|
... 96 more
|
||||||
|
Caused by: org.h2.mvstore.MVStoreException: The file is locked: C:/4 semestr/IP/IP-Labs-4-semestr/data.mv.db [2.2.224/7]
|
||||||
|
at org.h2.mvstore.DataUtils.newMVStoreException(DataUtils.java:996)
|
||||||
|
at org.h2.mvstore.SingleFileStore.lockFileChannel(SingleFileStore.java:143)
|
||||||
|
at org.h2.mvstore.SingleFileStore.open(SingleFileStore.java:117)
|
||||||
|
at org.h2.mvstore.SingleFileStore.open(SingleFileStore.java:81)
|
||||||
|
at org.h2.mvstore.MVStore.<init>(MVStore.java:286)
|
||||||
|
... 90 more
|
||||||
|
2024-04-20 21:37:00.680147+04:00 database: flush
|
||||||
|
org.h2.message.DbException: Внутренняя ошибка: "org.h2.mvstore.MVStoreException: The file is locked: C:/4 semestr/IP/IP-Labs-4-semestr/data.mv.db [2.2.224/7]"
|
||||||
|
General error: "org.h2.mvstore.MVStoreException: The file is locked: C:/4 semestr/IP/IP-Labs-4-semestr/data.mv.db [2.2.224/7]" [50000-224]
|
||||||
|
at org.h2.message.DbException.get(DbException.java:212)
|
||||||
|
at org.h2.message.DbException.convert(DbException.java:407)
|
||||||
|
at org.h2.mvstore.db.Store.lambda$new$0(Store.java:122)
|
||||||
|
at org.h2.mvstore.MVStore.handleException(MVStore.java:1546)
|
||||||
|
at org.h2.mvstore.MVStore.panic(MVStore.java:371)
|
||||||
|
at org.h2.mvstore.MVStore.<init>(MVStore.java:291)
|
||||||
|
at org.h2.mvstore.MVStore$Builder.open(MVStore.java:2035)
|
||||||
|
at org.h2.mvstore.db.Store.<init>(Store.java:133)
|
||||||
|
at org.h2.engine.Database.<init>(Database.java:326)
|
||||||
|
at org.h2.engine.Engine.openSession(Engine.java:92)
|
||||||
|
at org.h2.engine.Engine.openSession(Engine.java:222)
|
||||||
|
at org.h2.engine.Engine.createSession(Engine.java:201)
|
||||||
|
at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:343)
|
||||||
|
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:125)
|
||||||
|
at org.h2.Driver.connect(Driver.java:59)
|
||||||
|
at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138)
|
||||||
|
at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:359)
|
||||||
|
at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:201)
|
||||||
|
at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:470)
|
||||||
|
at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:561)
|
||||||
|
at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:100)
|
||||||
|
at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112)
|
||||||
|
at org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:122)
|
||||||
|
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess.obtainConnection(JdbcEnvironmentInitiator.java:428)
|
||||||
|
at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcIsolationDelegate.delegateWork(JdbcIsolationDelegate.java:61)
|
||||||
|
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.getJdbcEnvironmentUsingJdbcMetadata(JdbcEnvironmentInitiator.java:276)
|
||||||
|
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:107)
|
||||||
|
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:68)
|
||||||
|
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:130)
|
||||||
|
at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:263)
|
||||||
|
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:238)
|
||||||
|
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:215)
|
||||||
|
at org.hibernate.boot.model.relational.Database.<init>(Database.java:45)
|
||||||
|
at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.getDatabase(InFlightMetadataCollectorImpl.java:223)
|
||||||
|
at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.<init>(InFlightMetadataCollectorImpl.java:191)
|
||||||
|
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:170)
|
||||||
|
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:1432)
|
||||||
|
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1503)
|
||||||
|
at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:75)
|
||||||
|
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:390)
|
||||||
|
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:409)
|
||||||
|
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:396)
|
||||||
|
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:366)
|
||||||
|
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1833)
|
||||||
|
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1782)
|
||||||
|
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:600)
|
||||||
|
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:522)
|
||||||
|
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326)
|
||||||
|
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
|
||||||
|
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324)
|
||||||
|
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200)
|
||||||
|
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1234)
|
||||||
|
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:952)
|
||||||
|
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:624)
|
||||||
|
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146)
|
||||||
|
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754)
|
||||||
|
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:456)
|
||||||
|
at org.springframework.boot.SpringApplication.run(SpringApplication.java:334)
|
||||||
|
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1354)
|
||||||
|
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1343)
|
||||||
|
at com.example.demo.DemoApplication.main(DemoApplication.java:39)
|
||||||
|
Caused by: org.h2.jdbc.JdbcSQLNonTransientException: Внутренняя ошибка: "org.h2.mvstore.MVStoreException: The file is locked: C:/4 semestr/IP/IP-Labs-4-semestr/data.mv.db [2.2.224/7]"
|
||||||
|
General error: "org.h2.mvstore.MVStoreException: The file is locked: C:/4 semestr/IP/IP-Labs-4-semestr/data.mv.db [2.2.224/7]" [50000-224]
|
||||||
|
at org.h2.message.DbException.getJdbcSQLException(DbException.java:566)
|
||||||
|
at org.h2.message.DbException.getJdbcSQLException(DbException.java:489)
|
||||||
|
... 61 more
|
||||||
|
Caused by: org.h2.mvstore.MVStoreException: The file is locked: C:/4 semestr/IP/IP-Labs-4-semestr/data.mv.db [2.2.224/7]
|
||||||
|
at org.h2.mvstore.DataUtils.newMVStoreException(DataUtils.java:996)
|
||||||
|
at org.h2.mvstore.SingleFileStore.lockFileChannel(SingleFileStore.java:143)
|
||||||
|
at org.h2.mvstore.SingleFileStore.open(SingleFileStore.java:117)
|
||||||
|
at org.h2.mvstore.SingleFileStore.open(SingleFileStore.java:81)
|
||||||
|
at org.h2.mvstore.MVStore.<init>(MVStore.java:286)
|
||||||
|
... 55 more
|
||||||
|
2024-04-20 21:37:35.622227+04:00 database: flush
|
||||||
|
org.h2.message.DbException: Внутренняя ошибка: "org.h2.mvstore.MVStoreException: The file is locked: C:/4 semestr/IP/IP-Labs-4-semestr/data.mv.db [2.2.224/7]"
|
||||||
|
General error: "org.h2.mvstore.MVStoreException: The file is locked: C:/4 semestr/IP/IP-Labs-4-semestr/data.mv.db [2.2.224/7]" [50000-224]
|
||||||
|
at org.h2.message.DbException.get(DbException.java:212)
|
||||||
|
at org.h2.message.DbException.convert(DbException.java:407)
|
||||||
|
at org.h2.mvstore.db.Store.lambda$new$0(Store.java:122)
|
||||||
|
at org.h2.mvstore.MVStore.handleException(MVStore.java:1546)
|
||||||
|
at org.h2.mvstore.MVStore.panic(MVStore.java:371)
|
||||||
|
at org.h2.mvstore.MVStore.<init>(MVStore.java:291)
|
||||||
|
at org.h2.mvstore.MVStore$Builder.open(MVStore.java:2035)
|
||||||
|
at org.h2.mvstore.db.Store.<init>(Store.java:133)
|
||||||
|
at org.h2.engine.Database.<init>(Database.java:326)
|
||||||
|
at org.h2.engine.Engine.openSession(Engine.java:92)
|
||||||
|
at org.h2.engine.Engine.openSession(Engine.java:222)
|
||||||
|
at org.h2.engine.Engine.createSession(Engine.java:201)
|
||||||
|
at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:343)
|
||||||
|
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:125)
|
||||||
|
at org.h2.Driver.connect(Driver.java:59)
|
||||||
|
at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138)
|
||||||
|
at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:359)
|
||||||
|
at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:201)
|
||||||
|
at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:470)
|
||||||
|
at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:561)
|
||||||
|
at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:100)
|
||||||
|
at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112)
|
||||||
|
at org.springframework.boot.autoconfigure.h2.H2ConsoleAutoConfiguration.getConnectionUrl(H2ConsoleAutoConfiguration.java:94)
|
||||||
|
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
|
||||||
|
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
|
||||||
|
at java.base/java.util.stream.SortedOps$RefSortingSink.end(SortedOps.java:395)
|
||||||
|
at java.base/java.util.stream.Sink$ChainedReference.end(Sink.java:261)
|
||||||
|
at java.base/java.util.stream.Sink$ChainedReference.end(Sink.java:261)
|
||||||
|
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:510)
|
||||||
|
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
|
||||||
|
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:575)
|
||||||
|
at java.base/java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260)
|
||||||
|
at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:616)
|
||||||
|
at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:622)
|
||||||
|
at java.base/java.util.stream.ReferencePipeline.toList(ReferencePipeline.java:627)
|
||||||
|
at org.springframework.boot.autoconfigure.h2.H2ConsoleAutoConfiguration.logDataSources(H2ConsoleAutoConfiguration.java:86)
|
||||||
|
at org.springframework.boot.autoconfigure.h2.H2ConsoleAutoConfiguration.lambda$h2Console$0(H2ConsoleAutoConfiguration.java:69)
|
||||||
|
at org.springframework.boot.autoconfigure.h2.H2ConsoleAutoConfiguration.withThreadContextClassLoader(H2ConsoleAutoConfiguration.java:78)
|
||||||
|
at org.springframework.boot.autoconfigure.h2.H2ConsoleAutoConfiguration.h2Console(H2ConsoleAutoConfiguration.java:69)
|
||||||
|
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
|
||||||
|
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
|
||||||
|
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:140)
|
||||||
|
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:644)
|
||||||
|
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:636)
|
||||||
|
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1335)
|
||||||
|
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1165)
|
||||||
|
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:562)
|
||||||
|
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:522)
|
||||||
|
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326)
|
||||||
|
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
|
||||||
|
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324)
|
||||||
|
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:205)
|
||||||
|
at org.springframework.boot.web.servlet.ServletContextInitializerBeans.getOrderedBeansOfType(ServletContextInitializerBeans.java:210)
|
||||||
|
at org.springframework.boot.web.servlet.ServletContextInitializerBeans.getOrderedBeansOfType(ServletContextInitializerBeans.java:201)
|
||||||
|
at org.springframework.boot.web.servlet.ServletContextInitializerBeans.addServletContextInitializerBeans(ServletContextInitializerBeans.java:96)
|
||||||
|
at org.springframework.boot.web.servlet.ServletContextInitializerBeans.<init>(ServletContextInitializerBeans.java:85)
|
||||||
|
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.getServletContextInitializerBeans(ServletWebServerApplicationContext.java:266)
|
||||||
|
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.selfInitialize(ServletWebServerApplicationContext.java:240)
|
||||||
|
at org.springframework.boot.web.embedded.tomcat.TomcatStarter.onStartup(TomcatStarter.java:52)
|
||||||
|
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4880)
|
||||||
|
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:171)
|
||||||
|
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1332)
|
||||||
|
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1322)
|
||||||
|
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
|
||||||
|
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
|
||||||
|
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:145)
|
||||||
|
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:866)
|
||||||
|
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:845)
|
||||||
|
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:171)
|
||||||
|
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1332)
|
||||||
|
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1322)
|
||||||
|
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
|
||||||
|
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
|
||||||
|
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:145)
|
||||||
|
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:866)
|
||||||
|
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:240)
|
||||||
|
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:171)
|
||||||
|
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:433)
|
||||||
|
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:171)
|
||||||
|
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:921)
|
||||||
|
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:171)
|
||||||
|
at org.apache.catalina.startup.Tomcat.start(Tomcat.java:437)
|
||||||
|
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:126)
|
||||||
|
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.<init>(TomcatWebServer.java:105)
|
||||||
|
at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getTomcatWebServer(TomcatServletWebServerFactory.java:499)
|
||||||
|
at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:218)
|
||||||
|
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:188)
|
||||||
|
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:162)
|
||||||
|
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:618)
|
||||||
|
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146)
|
||||||
|
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754)
|
||||||
|
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:456)
|
||||||
|
at org.springframework.boot.SpringApplication.run(SpringApplication.java:334)
|
||||||
|
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1354)
|
||||||
|
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1343)
|
||||||
|
at com.example.demo.DemoApplication.main(DemoApplication.java:39)
|
||||||
|
Caused by: org.h2.jdbc.JdbcSQLNonTransientException: Внутренняя ошибка: "org.h2.mvstore.MVStoreException: The file is locked: C:/4 semestr/IP/IP-Labs-4-semestr/data.mv.db [2.2.224/7]"
|
||||||
|
General error: "org.h2.mvstore.MVStoreException: The file is locked: C:/4 semestr/IP/IP-Labs-4-semestr/data.mv.db [2.2.224/7]" [50000-224]
|
||||||
|
at org.h2.message.DbException.getJdbcSQLException(DbException.java:566)
|
||||||
|
at org.h2.message.DbException.getJdbcSQLException(DbException.java:489)
|
||||||
|
... 96 more
|
||||||
|
Caused by: org.h2.mvstore.MVStoreException: The file is locked: C:/4 semestr/IP/IP-Labs-4-semestr/data.mv.db [2.2.224/7]
|
||||||
|
at org.h2.mvstore.DataUtils.newMVStoreException(DataUtils.java:996)
|
||||||
|
at org.h2.mvstore.SingleFileStore.lockFileChannel(SingleFileStore.java:143)
|
||||||
|
at org.h2.mvstore.SingleFileStore.open(SingleFileStore.java:117)
|
||||||
|
at org.h2.mvstore.SingleFileStore.open(SingleFileStore.java:81)
|
||||||
|
at org.h2.mvstore.MVStore.<init>(MVStore.java:286)
|
||||||
|
... 90 more
|
||||||
|
2024-04-20 21:37:36.939049+04:00 database: flush
|
||||||
|
org.h2.message.DbException: Внутренняя ошибка: "org.h2.mvstore.MVStoreException: The file is locked: C:/4 semestr/IP/IP-Labs-4-semestr/data.mv.db [2.2.224/7]"
|
||||||
|
General error: "org.h2.mvstore.MVStoreException: The file is locked: C:/4 semestr/IP/IP-Labs-4-semestr/data.mv.db [2.2.224/7]" [50000-224]
|
||||||
|
at org.h2.message.DbException.get(DbException.java:212)
|
||||||
|
at org.h2.message.DbException.convert(DbException.java:407)
|
||||||
|
at org.h2.mvstore.db.Store.lambda$new$0(Store.java:122)
|
||||||
|
at org.h2.mvstore.MVStore.handleException(MVStore.java:1546)
|
||||||
|
at org.h2.mvstore.MVStore.panic(MVStore.java:371)
|
||||||
|
at org.h2.mvstore.MVStore.<init>(MVStore.java:291)
|
||||||
|
at org.h2.mvstore.MVStore$Builder.open(MVStore.java:2035)
|
||||||
|
at org.h2.mvstore.db.Store.<init>(Store.java:133)
|
||||||
|
at org.h2.engine.Database.<init>(Database.java:326)
|
||||||
|
at org.h2.engine.Engine.openSession(Engine.java:92)
|
||||||
|
at org.h2.engine.Engine.openSession(Engine.java:222)
|
||||||
|
at org.h2.engine.Engine.createSession(Engine.java:201)
|
||||||
|
at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:343)
|
||||||
|
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:125)
|
||||||
|
at org.h2.Driver.connect(Driver.java:59)
|
||||||
|
at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138)
|
||||||
|
at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:359)
|
||||||
|
at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:201)
|
||||||
|
at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:470)
|
||||||
|
at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:561)
|
||||||
|
at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:100)
|
||||||
|
at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112)
|
||||||
|
at org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:122)
|
||||||
|
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess.obtainConnection(JdbcEnvironmentInitiator.java:428)
|
||||||
|
at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcIsolationDelegate.delegateWork(JdbcIsolationDelegate.java:61)
|
||||||
|
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.getJdbcEnvironmentUsingJdbcMetadata(JdbcEnvironmentInitiator.java:276)
|
||||||
|
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:107)
|
||||||
|
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:68)
|
||||||
|
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:130)
|
||||||
|
at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:263)
|
||||||
|
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:238)
|
||||||
|
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:215)
|
||||||
|
at org.hibernate.boot.model.relational.Database.<init>(Database.java:45)
|
||||||
|
at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.getDatabase(InFlightMetadataCollectorImpl.java:223)
|
||||||
|
at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.<init>(InFlightMetadataCollectorImpl.java:191)
|
||||||
|
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:170)
|
||||||
|
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:1432)
|
||||||
|
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1503)
|
||||||
|
at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:75)
|
||||||
|
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:390)
|
||||||
|
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:409)
|
||||||
|
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:396)
|
||||||
|
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:366)
|
||||||
|
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1833)
|
||||||
|
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1782)
|
||||||
|
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:600)
|
||||||
|
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:522)
|
||||||
|
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326)
|
||||||
|
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
|
||||||
|
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324)
|
||||||
|
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200)
|
||||||
|
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1234)
|
||||||
|
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:952)
|
||||||
|
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:624)
|
||||||
|
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146)
|
||||||
|
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754)
|
||||||
|
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:456)
|
||||||
|
at org.springframework.boot.SpringApplication.run(SpringApplication.java:334)
|
||||||
|
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1354)
|
||||||
|
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1343)
|
||||||
|
at com.example.demo.DemoApplication.main(DemoApplication.java:39)
|
||||||
|
Caused by: org.h2.jdbc.JdbcSQLNonTransientException: Внутренняя ошибка: "org.h2.mvstore.MVStoreException: The file is locked: C:/4 semestr/IP/IP-Labs-4-semestr/data.mv.db [2.2.224/7]"
|
||||||
|
General error: "org.h2.mvstore.MVStoreException: The file is locked: C:/4 semestr/IP/IP-Labs-4-semestr/data.mv.db [2.2.224/7]" [50000-224]
|
||||||
|
at org.h2.message.DbException.getJdbcSQLException(DbException.java:566)
|
||||||
|
at org.h2.message.DbException.getJdbcSQLException(DbException.java:489)
|
||||||
|
... 61 more
|
||||||
|
Caused by: org.h2.mvstore.MVStoreException: The file is locked: C:/4 semestr/IP/IP-Labs-4-semestr/data.mv.db [2.2.224/7]
|
||||||
|
at org.h2.mvstore.DataUtils.newMVStoreException(DataUtils.java:996)
|
||||||
|
at org.h2.mvstore.SingleFileStore.lockFileChannel(SingleFileStore.java:143)
|
||||||
|
at org.h2.mvstore.SingleFileStore.open(SingleFileStore.java:117)
|
||||||
|
at org.h2.mvstore.SingleFileStore.open(SingleFileStore.java:81)
|
||||||
|
at org.h2.mvstore.MVStore.<init>(MVStore.java:286)
|
||||||
|
... 55 more
|
@ -1,6 +1,6 @@
|
|||||||
package com.example.demo;
|
package com.example.demo;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@ -27,7 +27,7 @@ public class DemoApplication implements CommandLineRunner {
|
|||||||
private final ProductsService productsService;
|
private final ProductsService productsService;
|
||||||
private final OrdersService ordersService;
|
private final OrdersService ordersService;
|
||||||
|
|
||||||
public DemoApplication(UsersService userService, CategoriesService categoriesService, ProductsService productsService, OrdersService ordersService) {
|
public DemoApplication(CategoriesService categoriesService, ProductsService productsService, UsersService userService, OrdersService ordersService) {
|
||||||
|
|
||||||
this.userService = userService;
|
this.userService = userService;
|
||||||
this.categoriesService = categoriesService;
|
this.categoriesService = categoriesService;
|
||||||
@ -44,23 +44,27 @@ public class DemoApplication implements CommandLineRunner {
|
|||||||
if (args.length > 0 && Objects.equals("--populate", args[0])) {
|
if (args.length > 0 && Objects.equals("--populate", args[0])) {
|
||||||
|
|
||||||
log.info("Создание пользователей");
|
log.info("Создание пользователей");
|
||||||
final var user1 = userService.create(new UsersEntity(null, "Natalia", "1234"));
|
final var user1 = userService.create(new UsersEntity("Natalia", "1234"));
|
||||||
final var user2 =userService.create(new UsersEntity(null, "Revengel", "4567"));
|
userService.create(new UsersEntity("Revengel", "4567"));
|
||||||
|
|
||||||
log.info("Создание категорий");
|
log.info("Создание категорий");
|
||||||
final var category1 = categoriesService.create(new CategoriesEntity(null, "Ноутбуки"));
|
final var category1 = categoriesService.create(new CategoriesEntity("Ноутбуки"));
|
||||||
final var category2 = categoriesService.create(new CategoriesEntity(null, "Телефоны"));
|
final var category2 = categoriesService.create(new CategoriesEntity("Телефоны"));
|
||||||
|
|
||||||
log.info("Создание продуктов");
|
log.info("Создание продуктов");
|
||||||
final var product1 = productsService.create(new ProductsEntity(null, category1, "Lenovo IDEA PAD 13", 15232.00));
|
final var product1 = productsService.create(new ProductsEntity(category1, "Lenovo IDEA PAD 13", 15232.00));
|
||||||
final var product2 = productsService.create(new ProductsEntity(null, category1, "Acer", 20300.00));
|
final var product2 = productsService.create(new ProductsEntity(category1, "Acer", 20300.00));
|
||||||
final var product3 = productsService.create(new ProductsEntity(null, category2, "Iphone 13", 150000.00));
|
final var product3 = productsService.create(new ProductsEntity(category2, "Iphone 13", 150000.00));
|
||||||
|
|
||||||
log.info("Создание заказов");
|
log.info("Создание заказов");
|
||||||
ordersService.create(user1.getId(), new OrdersEntity(null, product1, 3, new SimpleDateFormat("09/04/2024")));
|
|
||||||
ordersService.create(user1.getId(), new OrdersEntity(null, product2, 2, new SimpleDateFormat("09/04/2024")));
|
final var orders = List.of(
|
||||||
ordersService.create(user2.getId(), new OrdersEntity(null, product3, 1, new SimpleDateFormat("07/04/2024")));
|
new OrdersEntity(product1, 3),
|
||||||
ordersService.create(user2.getId(), new OrdersEntity(null, product1, 4, new SimpleDateFormat("07/04/2024")));
|
new OrdersEntity(product2, 2),
|
||||||
|
new OrdersEntity(product3, 1),
|
||||||
|
new OrdersEntity(product1, 4));
|
||||||
|
orders.forEach(order -> ordersService.create(user1.getId(), order));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ import jakarta.persistence.Table;
|
|||||||
|
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "сategories")
|
@Table(name = "categories")
|
||||||
public class CategoriesEntity extends BaseEntity {
|
public class CategoriesEntity extends BaseEntity {
|
||||||
@Column(nullable = false, unique = true, length = 50)
|
@Column(nullable = false, unique = true, length = 50)
|
||||||
private String name;
|
private String name;
|
||||||
@ -17,8 +17,7 @@ public class CategoriesEntity extends BaseEntity {
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public CategoriesEntity(Long id, String name) {
|
public CategoriesEntity(String name) {
|
||||||
super(id);
|
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
public String getName() {
|
public String getName() {
|
||||||
|
@ -45,7 +45,7 @@ public class OrdersController {
|
|||||||
|
|
||||||
@GetMapping
|
@GetMapping
|
||||||
public List<OrdersDto> getAll(@PathVariable(name = "user") Long userId, @RequestParam(name = "productId", defaultValue = "0") ProductsEntity product) {
|
public List<OrdersDto> getAll(@PathVariable(name = "user") Long userId, @RequestParam(name = "productId", defaultValue = "0") ProductsEntity product) {
|
||||||
return ordersService.getAll(userId, product.getId()).stream().map(this::toDto).toList();
|
return ordersService.getAll(userId).stream().map(this::toDto).toList();
|
||||||
}
|
}
|
||||||
@GetMapping("/{id}")
|
@GetMapping("/{id}")
|
||||||
public OrdersDto get(@PathVariable(name = "user") Long userId, @PathVariable(name = "id") Long id) {
|
public OrdersDto get(@PathVariable(name = "user") Long userId, @PathVariable(name = "id") Long id) {
|
||||||
|
@ -1,32 +0,0 @@
|
|||||||
package com.example.demo.itemOrders.api;
|
|
||||||
|
|
||||||
public class OrdersGroupedDto {
|
|
||||||
private Long userId;
|
|
||||||
private Long totalSum;
|
|
||||||
private Integer totalCount;
|
|
||||||
|
|
||||||
public Long getUserId() {
|
|
||||||
return userId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUserId(Long userId) {
|
|
||||||
this.userId = userId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getTotalSum() {
|
|
||||||
return totalSum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTotalSum(Long totalSum) {
|
|
||||||
this.totalSum = totalSum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getTotalCount() {
|
|
||||||
return totalCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTotalCount(Integer totalCount) {
|
|
||||||
this.totalCount = totalCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,5 +1,4 @@
|
|||||||
package com.example.demo.itemOrders.model;
|
package com.example.demo.itemOrders.model;
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import com.example.demo.core.model.BaseEntity;
|
import com.example.demo.core.model.BaseEntity;
|
||||||
import com.example.demo.itemProducts.model.ProductsEntity;
|
import com.example.demo.itemProducts.model.ProductsEntity;
|
||||||
@ -10,8 +9,6 @@ import jakarta.persistence.Entity;
|
|||||||
import jakarta.persistence.JoinColumn;
|
import jakarta.persistence.JoinColumn;
|
||||||
import jakarta.persistence.ManyToOne;
|
import jakarta.persistence.ManyToOne;
|
||||||
import jakarta.persistence.Table;
|
import jakarta.persistence.Table;
|
||||||
import jakarta.persistence.Temporal;
|
|
||||||
import jakarta.persistence.TemporalType;
|
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "orders")
|
@Table(name = "orders")
|
||||||
@ -27,20 +24,15 @@ public class OrdersEntity extends BaseEntity {
|
|||||||
@Column(nullable = false)
|
@Column(nullable = false)
|
||||||
private Integer count;
|
private Integer count;
|
||||||
|
|
||||||
@Temporal(TemporalType.DATE)
|
|
||||||
private SimpleDateFormat date;
|
|
||||||
|
|
||||||
@Column(nullable = false)
|
//@Column(nullable = false)
|
||||||
private Double sum;
|
//private Double sum = getSum();
|
||||||
|
|
||||||
public OrdersEntity() {
|
public OrdersEntity() {
|
||||||
super();
|
|
||||||
}
|
}
|
||||||
public OrdersEntity(Long id, ProductsEntity product, Integer count, SimpleDateFormat date) {
|
public OrdersEntity(ProductsEntity product, Integer count) {
|
||||||
super(id);
|
|
||||||
this.product = product;
|
this.product = product;
|
||||||
this.count = count;
|
this.count = count;
|
||||||
this.date = date;
|
|
||||||
}
|
}
|
||||||
public ProductsEntity getProduct() {
|
public ProductsEntity getProduct() {
|
||||||
return product;
|
return product;
|
||||||
@ -58,25 +50,20 @@ public class OrdersEntity extends BaseEntity {
|
|||||||
user.getOrders().add(this);
|
user.getOrders().add(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public Double getSum() {
|
|
||||||
sum = count * product.getPrice();
|
// public Double getSum() {
|
||||||
return sum;
|
// sum = count * product.getPrice();
|
||||||
}
|
// return sum;
|
||||||
|
// }
|
||||||
public Integer getCount() {
|
public Integer getCount() {
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
public void setCount(Integer count) {
|
public void setCount(Integer count) {
|
||||||
this.count = count;
|
this.count = count;
|
||||||
}
|
}
|
||||||
public SimpleDateFormat getDate() {
|
|
||||||
return date;
|
|
||||||
}
|
|
||||||
public void setDate(SimpleDateFormat date) {
|
|
||||||
this.date = date;
|
|
||||||
}
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(id, product, count, date);
|
return Objects.hash(id, product, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -88,7 +75,7 @@ public class OrdersEntity extends BaseEntity {
|
|||||||
final OrdersEntity other = (OrdersEntity) obj;
|
final OrdersEntity other = (OrdersEntity) obj;
|
||||||
return Objects.equals(other.getId(), id)
|
return Objects.equals(other.getId(), id)
|
||||||
&& Objects.equals(other.getProduct(), product)
|
&& Objects.equals(other.getProduct(), product)
|
||||||
&& Objects.equals(other.getCount(), count)
|
&& Objects.equals(other.getUser().getId(), user.getId())
|
||||||
&& Objects.equals(other.getDate(), date);
|
&& Objects.equals(other.getCount(), count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
package com.example.demo.itemOrders.model;
|
|
||||||
|
|
||||||
import com.example.demo.itemUsers.model.UsersEntity;
|
|
||||||
|
|
||||||
public interface OrdersGrouped {
|
|
||||||
UsersEntity getUser();
|
|
||||||
|
|
||||||
double getTotalSum();
|
|
||||||
|
|
||||||
int getTotalCount();
|
|
||||||
}
|
|
@ -2,18 +2,15 @@ package com.example.demo.itemOrders.repository;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
import org.springframework.data.jpa.repository.Query;
|
|
||||||
import org.springframework.data.repository.CrudRepository;
|
import org.springframework.data.repository.CrudRepository;
|
||||||
import com.example.demo.itemOrders.model.OrdersEntity;
|
import com.example.demo.itemOrders.model.OrdersEntity;
|
||||||
import com.example.demo.itemOrders.model.OrdersGrouped;
|
//import com.example.demo.itemOrders.model.OrdersGrouped;
|
||||||
|
|
||||||
public interface OrdersRepository extends CrudRepository<OrdersEntity, Long> {
|
public interface OrdersRepository extends CrudRepository<OrdersEntity, Long> {
|
||||||
Optional<OrdersEntity> findOneByUserIdAndId(long userId, long id);
|
Optional<OrdersEntity> findOneByUserIdAndId(long userId, long id);
|
||||||
|
|
||||||
List<OrdersEntity> findByUserId(long userId);
|
List<OrdersEntity> findByUserId(long userId);
|
||||||
|
|
||||||
List<OrdersEntity> findByUserIdAndProductId(long userId, long productId);
|
|
||||||
|
|
||||||
// select
|
// select
|
||||||
// tpe.name,
|
// tpe.name,
|
||||||
// coalesce(sum(order.price), 0),
|
// coalesce(sum(order.price), 0),
|
||||||
@ -21,11 +18,12 @@ public interface OrdersRepository extends CrudRepository<OrdersEntity, Long> {
|
|||||||
// from types as tpe
|
// from types as tpe
|
||||||
// left join orders as order on tpe.id = order.type_id and order.user_id = ?
|
// left join orders as order on tpe.id = order.type_id and order.user_id = ?
|
||||||
// group by tpe.name order by tpe.id
|
// group by tpe.name order by tpe.id
|
||||||
@Query("select "
|
// @Query("select "
|
||||||
+ "u as user, "
|
// + "u as user, "
|
||||||
+ "coalesce(sum(o.sum), 0) as totalSum, "
|
// + "coalesce(sum(o.sum), 0) as totalSum, "
|
||||||
+ "coalesce(sum(o.count), 0) as totalCount "
|
// + "coalesce(sum(o.count), 0) as totalCount "
|
||||||
+ "from UsersEntity u left join OrderEntity o on o.user = u and o.user.id = ?1 "
|
// + "from UsersEntity u left join OrderEntity o on o.user = u and o.user.id = ?1 "
|
||||||
+ "group by u order by u.id")
|
// + "group by u order by u.id")
|
||||||
List<OrdersGrouped> getOrdersTotalByUser(long userId);
|
// List<OrdersGrouped> getOrdersTotalByUser(long userId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
|
|
||||||
import com.example.demo.core.error.NotFoundException;
|
import com.example.demo.core.error.NotFoundException;
|
||||||
import com.example.demo.itemOrders.model.OrdersEntity;
|
import com.example.demo.itemOrders.model.OrdersEntity;
|
||||||
import com.example.demo.itemOrders.model.OrdersGrouped;
|
//import com.example.demo.itemOrders.model.OrdersGrouped;
|
||||||
import com.example.demo.itemOrders.repository.OrdersRepository;
|
import com.example.demo.itemOrders.repository.OrdersRepository;
|
||||||
import com.example.demo.itemUsers.model.UsersEntity;
|
import com.example.demo.itemUsers.model.UsersEntity;
|
||||||
import com.example.demo.itemUsers.service.UsersService;
|
import com.example.demo.itemUsers.service.UsersService;
|
||||||
@ -23,20 +23,16 @@ public class OrdersService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
public List<OrdersEntity> getAll(long userId, Long productId) {
|
public List<OrdersEntity> getAll(long userId) {
|
||||||
userService.get(userId);
|
userService.get(userId);
|
||||||
if (productId <= 0L) {
|
|
||||||
return repository.findByUserId(userId);
|
return repository.findByUserId(userId);
|
||||||
} else {
|
|
||||||
return repository.findByUserIdAndProductId(userId, productId);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
public OrdersEntity get(long userId, Long id) {
|
public OrdersEntity get(long userId, Long id) {
|
||||||
userService.get(userId);
|
userService.get(userId);
|
||||||
return repository.findOneByUserIdAndId(userId, id).orElseThrow(() -> new NotFoundException(OrdersEntity.class, id));
|
return repository.findOneByUserIdAndId(userId, id).orElseThrow(() -> new NotFoundException(OrdersEntity.class, id));
|
||||||
}
|
}
|
||||||
|
@Transactional
|
||||||
public OrdersEntity create(long userId, OrdersEntity entity) {
|
public OrdersEntity create(long userId, OrdersEntity entity) {
|
||||||
if (entity == null) {
|
if (entity == null) {
|
||||||
throw new IllegalArgumentException("Entity is null");
|
throw new IllegalArgumentException("Entity is null");
|
||||||
@ -45,16 +41,15 @@ public class OrdersService {
|
|||||||
entity.setUser(existsUser);
|
entity.setUser(existsUser);
|
||||||
return repository.save(entity);
|
return repository.save(entity);
|
||||||
}
|
}
|
||||||
|
@Transactional
|
||||||
public OrdersEntity update(long userId, Long id, OrdersEntity entity) {
|
public OrdersEntity update(long userId, Long id, OrdersEntity entity) {
|
||||||
userService.get(userId);
|
userService.get(userId);
|
||||||
final OrdersEntity existsEntity = get(userId, id);
|
final OrdersEntity existsEntity = get(userId, id);
|
||||||
existsEntity.setProduct(entity.getProduct());
|
existsEntity.setProduct(entity.getProduct());
|
||||||
existsEntity.setCount(entity.getCount());
|
existsEntity.setCount(entity.getCount());
|
||||||
existsEntity.setDate(entity.getDate());
|
|
||||||
return repository.save(existsEntity);
|
return repository.save(existsEntity);
|
||||||
}
|
}
|
||||||
|
@Transactional
|
||||||
public OrdersEntity delete(long userId, Long id) {
|
public OrdersEntity delete(long userId, Long id) {
|
||||||
userService.get(userId);
|
userService.get(userId);
|
||||||
final OrdersEntity existsEntity = get(userId, id);
|
final OrdersEntity existsEntity = get(userId, id);
|
||||||
@ -62,9 +57,10 @@ public class OrdersService {
|
|||||||
return existsEntity;
|
return existsEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(readOnly = true)
|
// @Transactional(readOnly = true)
|
||||||
public List<OrdersGrouped> getTotal(long userId) {
|
// public List<OrdersGrouped> getTotal(long userId) {
|
||||||
userService.get(userId);
|
// //userService.get(userId);
|
||||||
return repository.getOrdersTotalByUser(userId);
|
// return repository.getOrdersTotalByUser(userId);
|
||||||
}
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ public class ProductsDto {
|
|||||||
private String name;
|
private String name;
|
||||||
@NotNull
|
@NotNull
|
||||||
@Min(1)
|
@Min(1)
|
||||||
private Long typeId;
|
private Long categoryId;
|
||||||
@NotNull
|
@NotNull
|
||||||
@Min(1)
|
@Min(1)
|
||||||
private Double price;
|
private Double price;
|
||||||
@ -27,11 +27,11 @@ public class ProductsDto {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Long getTypeId() {
|
public Long getTypeId() {
|
||||||
return typeId;
|
return categoryId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTypeId(Long typeId) {
|
public void setTypeId(Long categoryId) {
|
||||||
this.typeId = typeId;
|
this.categoryId = categoryId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Double getPrice() {
|
public Double getPrice() {
|
||||||
|
@ -16,29 +16,27 @@ import jakarta.persistence.Table;
|
|||||||
public class ProductsEntity extends BaseEntity{
|
public class ProductsEntity extends BaseEntity{
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name = "categoryId", nullable = false)
|
@JoinColumn(name = "categoryId", nullable = false)
|
||||||
private CategoriesEntity type;
|
private CategoriesEntity category;
|
||||||
@Column(nullable = false)
|
@Column(nullable = false)
|
||||||
private String name;
|
private String name;
|
||||||
@Column(nullable = false)
|
@Column(nullable = false)
|
||||||
private Double price;
|
private Double price;
|
||||||
|
|
||||||
public ProductsEntity(Object object, String string) {
|
public ProductsEntity() {
|
||||||
super();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProductsEntity(Long id, CategoriesEntity type, String name, Double price) {
|
public ProductsEntity(CategoriesEntity category, String name, Double price) {
|
||||||
super(id);
|
this.category = category;
|
||||||
this.type = type;
|
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.price = price;
|
this.price = price;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CategoriesEntity getType() {
|
public CategoriesEntity getType() {
|
||||||
return type;
|
return category;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setType(CategoriesEntity type) {
|
public void setType(CategoriesEntity category) {
|
||||||
this.type = type;
|
this.category = category;
|
||||||
}
|
}
|
||||||
public Double getPrice() {
|
public Double getPrice() {
|
||||||
return price;
|
return price;
|
||||||
@ -55,7 +53,7 @@ public class ProductsEntity extends BaseEntity{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(id, type, name, price);
|
return Objects.hash(id, category, name, price);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -66,7 +64,7 @@ public class ProductsEntity extends BaseEntity{
|
|||||||
return false;
|
return false;
|
||||||
final ProductsEntity other = (ProductsEntity) obj;
|
final ProductsEntity other = (ProductsEntity) obj;
|
||||||
return Objects.equals(other.getId(), id)
|
return Objects.equals(other.getId(), id)
|
||||||
&& Objects.equals(other.getType(), type)
|
&& Objects.equals(other.getType(), category)
|
||||||
&& Objects.equals(other.getName(), name)
|
&& Objects.equals(other.getName(), name)
|
||||||
&& Objects.equals(other.getPrice(), price);
|
&& Objects.equals(other.getPrice(), price);
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ import java.util.Objects;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import com.example.demo.core.model.BaseEntity;
|
import com.example.demo.core.model.BaseEntity;
|
||||||
|
//import com.example.demo.itemOrders.model.OrdersEntity;
|
||||||
import com.example.demo.itemOrders.model.OrdersEntity;
|
import com.example.demo.itemOrders.model.OrdersEntity;
|
||||||
|
|
||||||
import jakarta.persistence.CascadeType;
|
import jakarta.persistence.CascadeType;
|
||||||
@ -26,11 +27,9 @@ public class UsersEntity extends BaseEntity {
|
|||||||
private Set<OrdersEntity> orders = new HashSet<>();
|
private Set<OrdersEntity> orders = new HashSet<>();
|
||||||
|
|
||||||
public UsersEntity() {
|
public UsersEntity() {
|
||||||
super();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public UsersEntity(Long id, String login, String password) {
|
public UsersEntity(String login, String password) {
|
||||||
super(id);
|
|
||||||
this.login = login;
|
this.login = login;
|
||||||
this.password = password;
|
this.password = password;
|
||||||
}
|
}
|
||||||
@ -38,7 +37,7 @@ public class UsersEntity extends BaseEntity {
|
|||||||
return orders;
|
return orders;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addOrder(OrdersEntity order) {
|
public void setOrder(OrdersEntity order) {
|
||||||
if (order.getUser() != this) {
|
if (order.getUser() != this) {
|
||||||
order.setUser(this);
|
order.setUser(this);
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,8 @@ public class UsersService {
|
|||||||
final UsersEntity existsEntity = get(id);
|
final UsersEntity existsEntity = get(id);
|
||||||
existsEntity.setLogin(entity.getLogin());
|
existsEntity.setLogin(entity.getLogin());
|
||||||
existsEntity.setPassword(entity.getPassword());
|
existsEntity.setPassword(entity.getPassword());
|
||||||
return repository.save(existsEntity);
|
repository.save(existsEntity);
|
||||||
|
return existsEntity;
|
||||||
}
|
}
|
||||||
@Transactional
|
@Transactional
|
||||||
public UsersEntity delete(Long id) {
|
public UsersEntity delete(Long id) {
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
package com.example.demo;
|
package com.example.demo;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.AfterEach;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.MethodOrderer.OrderAnnotation;
|
import org.junit.jupiter.api.MethodOrderer.OrderAnnotation;
|
||||||
import org.junit.jupiter.api.Order;
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.jupiter.api.TestMethodOrder;
|
import org.junit.jupiter.api.TestMethodOrder;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -17,44 +18,52 @@ import com.example.demo.itemCategories.model.CategoriesEntity;
|
|||||||
class CategoriesServiceTests {
|
class CategoriesServiceTests {
|
||||||
@Autowired
|
@Autowired
|
||||||
private CategoriesService categoriesService;
|
private CategoriesService categoriesService;
|
||||||
|
|
||||||
|
private CategoriesEntity category;
|
||||||
|
|
||||||
|
@BeforeEach
|
||||||
|
void createData() {
|
||||||
|
removeData();
|
||||||
|
category = categoriesService.create(new CategoriesEntity("Ноутбук"));
|
||||||
|
categoriesService.create(new CategoriesEntity("Телефон"));
|
||||||
|
categoriesService.create(new CategoriesEntity("Игровая приставка"));
|
||||||
|
}
|
||||||
|
@AfterEach
|
||||||
|
void removeData() {
|
||||||
|
categoriesService.getAll().forEach(item -> categoriesService.delete(item.getId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void getTest() {
|
void getTest() {
|
||||||
Assertions.assertThrows(NotFoundException.class, () -> categoriesService.get(0L));
|
Assertions.assertThrows(NotFoundException.class, () -> categoriesService.get(0L));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Order(1)
|
|
||||||
void createTest() {
|
void createTest() {
|
||||||
categoriesService.create(new CategoriesEntity(null, "Ноутбук"));
|
|
||||||
categoriesService.create(new CategoriesEntity(null, "Телефон"));
|
|
||||||
final CategoriesEntity last = categoriesService.create(new CategoriesEntity(null, "Игровая приставка"));
|
|
||||||
Assertions.assertEquals(3, categoriesService.getAll().size());
|
Assertions.assertEquals(3, categoriesService.getAll().size());
|
||||||
Assertions.assertEquals(last, categoriesService.get(3L));
|
Assertions.assertEquals(category, categoriesService.get(category.getId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Order(2)
|
|
||||||
void updateTest() {
|
void updateTest() {
|
||||||
final String test = "TEST";
|
final String test = "TEST";
|
||||||
final CategoriesEntity entity = categoriesService.get(3L);
|
final CategoriesEntity entity = categoriesService.get(category.getId());
|
||||||
final String oldName = entity.getName();
|
final String oldName = entity.getName();
|
||||||
final CategoriesEntity newEntity = categoriesService.update(3L, new CategoriesEntity(1L, test));
|
final CategoriesEntity newEntity = categoriesService.update(category.getId(), new CategoriesEntity(test));
|
||||||
Assertions.assertEquals(3, categoriesService.getAll().size());
|
Assertions.assertEquals(3, categoriesService.getAll().size());
|
||||||
Assertions.assertEquals(newEntity, categoriesService.get(3L));
|
Assertions.assertEquals(newEntity, categoriesService.get(newEntity.getId()));
|
||||||
Assertions.assertEquals(test, newEntity.getName());
|
Assertions.assertEquals(test, newEntity.getName());
|
||||||
Assertions.assertNotEquals(oldName, newEntity.getName());
|
Assertions.assertNotEquals(oldName, newEntity.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Order(3)
|
|
||||||
void deleteTest() {
|
void deleteTest() {
|
||||||
categoriesService.delete(3L);
|
categoriesService.delete(category.getId());
|
||||||
Assertions.assertEquals(2, categoriesService.getAll().size());
|
Assertions.assertEquals(2, categoriesService.getAll().size());
|
||||||
final CategoriesEntity last = categoriesService.get(2L);
|
|
||||||
Assertions.assertEquals(2L, last.getId());
|
|
||||||
|
|
||||||
final CategoriesEntity newEntity = categoriesService.create(new CategoriesEntity(null, "Игровая приставка"));
|
final CategoriesEntity newEntity = categoriesService.create(new CategoriesEntity("Ноутбук"));
|
||||||
Assertions.assertEquals(3, categoriesService.getAll().size());
|
Assertions.assertEquals(3, categoriesService.getAll().size());
|
||||||
Assertions.assertEquals(4L, newEntity.getId());
|
Assertions.assertNotEquals(category.getId(), newEntity.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package com.example.demo;
|
package com.example.demo;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import org.junit.jupiter.api.AfterEach;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.MethodOrderer.OrderAnnotation;
|
import org.junit.jupiter.api.MethodOrderer.OrderAnnotation;
|
||||||
import org.junit.jupiter.api.Order;
|
import org.junit.jupiter.api.Order;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
@ -27,66 +27,57 @@ class OrdersServiceTests {
|
|||||||
private OrdersService ordersService;
|
private OrdersService ordersService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private UsersService usersService;
|
private UsersService usersService;
|
||||||
private UsersEntity user1;
|
|
||||||
private UsersEntity user2;
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private CategoriesService categoriesService;
|
private CategoriesService categoriesService;
|
||||||
private CategoriesEntity category1;
|
|
||||||
private CategoriesEntity category2;
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ProductsService productsService;
|
private ProductsService productsService;
|
||||||
private ProductsEntity product1;
|
|
||||||
private ProductsEntity product2;
|
|
||||||
private ProductsEntity product3;
|
|
||||||
|
|
||||||
@Test
|
private OrdersEntity order;
|
||||||
void getTest() {
|
private UsersEntity user;
|
||||||
Assertions.assertThrows(NotFoundException.class, () -> ordersService.get(1,0L));
|
private CategoriesEntity category;
|
||||||
}
|
private ProductsEntity product;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Order(1)
|
@Order(1)
|
||||||
void createTest() {
|
void createData() {
|
||||||
|
user = usersService.create(new UsersEntity("Natalia", "1234"));
|
||||||
|
category = categoriesService.create(new CategoriesEntity("Телефон"));
|
||||||
|
product = productsService.create(new ProductsEntity(category, "Iphone 13", 150000.00));
|
||||||
|
|
||||||
user1 = usersService.create(new UsersEntity(null, "Natalia", "1234"));
|
order = ordersService.create(user.getId(), new OrdersEntity(product, 3));
|
||||||
user2 = usersService.create(new UsersEntity(null, "Revengel", "4567"));
|
ordersService.create(user.getId(), new OrdersEntity(product, 2));
|
||||||
|
ordersService.create(user.getId(), new OrdersEntity(product, 1));
|
||||||
category1 = categoriesService.create(new CategoriesEntity(null, "Телефон"));
|
ordersService.create(user.getId(), new OrdersEntity(product, 4));
|
||||||
category2 = categoriesService.create(new CategoriesEntity(null, "Игровая приставка"));
|
|
||||||
|
|
||||||
product1 = productsService.create(new ProductsEntity(null, category1, "Lenovo IDEA PAD 13", 15232.00));
|
|
||||||
product2 = productsService.create(new ProductsEntity(null, category1, "Acer", 20300.00));
|
|
||||||
product3 = productsService.create(new ProductsEntity(null, category2, "Iphone 13", 150000.00));
|
|
||||||
|
|
||||||
ordersService.create(user1.getId(), new OrdersEntity(null, product1, 3, new SimpleDateFormat("09/04/2024")));
|
|
||||||
ordersService.create(user1.getId(), new OrdersEntity(null, product2, 2, new SimpleDateFormat("09/04/2024")));
|
|
||||||
ordersService.create(user2.getId(),new OrdersEntity(null, product3, 1, new SimpleDateFormat("07/04/2024")));
|
|
||||||
final OrdersEntity last = ordersService.create(user2.getId(), new OrdersEntity(null, product1, 4, new SimpleDateFormat("07/04/2024")));
|
|
||||||
Assertions.assertEquals(4, ordersService.getAll(1,0L).size());
|
|
||||||
Assertions.assertEquals(0, ordersService.getAll(1,-1L).size());
|
|
||||||
Assertions.assertEquals(last, ordersService.get(1,last.getId()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Order(2)
|
@Order(2)
|
||||||
void updateTest() {
|
void createTest() {
|
||||||
final Integer newCount = 5;
|
Assertions.assertEquals(4, ordersService.getAll(user.getId()).size());
|
||||||
final OrdersEntity entity = ordersService.get(1,1L);
|
Assertions.assertEquals(order, ordersService.get(user.getId(), order.getId()));
|
||||||
final Integer oldCount = entity.getCount();
|
|
||||||
final OrdersEntity newEntity = ordersService.update(1,1L,
|
|
||||||
new OrdersEntity(null, product1, newCount, new SimpleDateFormat("09/04/2024")));
|
|
||||||
Assertions.assertEquals(4, ordersService.getAll(1,0L).size());
|
|
||||||
Assertions.assertEquals(newEntity, ordersService.get(1,1L));
|
|
||||||
Assertions.assertEquals(newCount, newEntity.getCount());
|
|
||||||
Assertions.assertNotEquals(oldCount, newEntity.getCount());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
// @Test
|
||||||
@Order(3)
|
// @Order(3)
|
||||||
void deleteTest() {
|
// void updateTest() {
|
||||||
ordersService.delete(2,3L);
|
// final Integer newCount = 5;
|
||||||
Assertions.assertEquals(3, ordersService.getAll(1,0L).size());
|
// final OrdersEntity entity = ordersService.get(user.getId(),order.getId());
|
||||||
final OrdersEntity last = ordersService.get(1,2L);
|
// final Integer oldCount = entity.getCount();
|
||||||
Assertions.assertEquals(2L, last.getId());
|
// final OrdersEntity newEntity = ordersService.update(user.getId(),order.getId(), new OrdersEntity(product, newCount));
|
||||||
}
|
// Assertions.assertEquals(4, ordersService.getAll(user.getId()).size());
|
||||||
|
// Assertions.assertEquals(newEntity, ordersService.get(user.getId(),newEntity.getId()));
|
||||||
|
// Assertions.assertEquals(newCount, newEntity.getCount());
|
||||||
|
// Assertions.assertNotEquals(oldCount, newEntity.getCount());
|
||||||
|
// }
|
||||||
|
|
||||||
|
// @Test
|
||||||
|
// @Order(4)
|
||||||
|
// void deleteTest() {
|
||||||
|
// ordersService.delete(user.getId(),order.getId());
|
||||||
|
// Assertions.assertEquals(3, ordersService.getAll(user.getId()).size());
|
||||||
|
|
||||||
|
// final OrdersEntity newEntity = ordersService.create(user.getId(), new OrdersEntity(product, 3));
|
||||||
|
// Assertions.assertEquals(3, ordersService.getAll(user.getId()).size());
|
||||||
|
// Assertions.assertNotEquals(order.getId(), newEntity.getId());
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package com.example.demo;
|
package com.example.demo;
|
||||||
|
import org.junit.jupiter.api.AfterEach;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.MethodOrderer.OrderAnnotation;
|
import org.junit.jupiter.api.MethodOrderer.OrderAnnotation;
|
||||||
import org.junit.jupiter.api.Order;
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.jupiter.api.TestMethodOrder;
|
import org.junit.jupiter.api.TestMethodOrder;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -21,47 +21,57 @@ class ProductsServiceTests {
|
|||||||
private ProductsService productsService;
|
private ProductsService productsService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private CategoriesService categoriesService;
|
private CategoriesService categoriesService;
|
||||||
|
|
||||||
|
private ProductsEntity product;
|
||||||
|
|
||||||
private CategoriesEntity category1;
|
private CategoriesEntity category1;
|
||||||
private CategoriesEntity category2;
|
private CategoriesEntity category2;
|
||||||
|
|
||||||
|
@BeforeEach
|
||||||
|
void createData() {
|
||||||
|
removeData();
|
||||||
|
category1 = categoriesService.create(new CategoriesEntity("Телефон"));
|
||||||
|
category2 = categoriesService.create(new CategoriesEntity("Игровая приставка"));
|
||||||
|
product = productsService.create(new ProductsEntity(category1, "Lenovo IDEA PAD 13", 15232.00));
|
||||||
|
productsService.create(new ProductsEntity(category1, "Acer", 20300.00));
|
||||||
|
productsService.create(new ProductsEntity(category2, "Iphone 13", 150000.00));
|
||||||
|
}
|
||||||
|
@AfterEach
|
||||||
|
void removeData() {
|
||||||
|
productsService.getAll().forEach(item -> productsService.delete(item.getId()));
|
||||||
|
categoriesService.getAll().forEach(item -> categoriesService.delete(item.getId()));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void getTest() {
|
void getTest() {
|
||||||
Assertions.assertThrows(NotFoundException.class, () -> productsService.get(0L));
|
Assertions.assertThrows(NotFoundException.class, () -> productsService.get(0L));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Order(1)
|
|
||||||
void createTest() {
|
void createTest() {
|
||||||
category1 = categoriesService.create(new CategoriesEntity(null, "Телефон"));
|
|
||||||
category2 = categoriesService.create(new CategoriesEntity(null, "Игровая приставка"));
|
|
||||||
productsService.create(new ProductsEntity(null, category1, "Lenovo IDEA PAD 13", 15232.00));
|
|
||||||
productsService.create(new ProductsEntity(null, category1, "Acer", 20300.00));
|
|
||||||
final ProductsEntity last = productsService.create(new ProductsEntity(null, category2, "Iphone 13", 150000.00));
|
|
||||||
|
|
||||||
Assertions.assertEquals(3, productsService.getAll().size());
|
Assertions.assertEquals(3, productsService.getAll().size());
|
||||||
Assertions.assertEquals(last, productsService.get(3L));
|
Assertions.assertEquals(product, productsService.get(product.getId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Order(2)
|
|
||||||
void updateTest() {
|
void updateTest() {
|
||||||
final Double newPrice = 20000.00;
|
final Double newPrice = 20000.00;
|
||||||
final ProductsEntity entity = productsService.get(1L);
|
final ProductsEntity entity = productsService.get(product.getId());
|
||||||
final Double oldPrice = entity.getPrice();
|
final Double oldPrice = entity.getPrice();
|
||||||
final ProductsEntity newEntity = productsService.update(1L,
|
final ProductsEntity newEntity = productsService.update(product.getId(), new ProductsEntity(category1, "Lenovo IDEA PAD 13", newPrice));
|
||||||
new ProductsEntity(1L, category1, "Lenovo IDEA PAD 13", newPrice));
|
|
||||||
Assertions.assertEquals(3, productsService.getAll().size());
|
Assertions.assertEquals(3, productsService.getAll().size());
|
||||||
Assertions.assertEquals(newEntity, productsService.get(1L));
|
Assertions.assertEquals(newEntity, productsService.get(newEntity.getId()));
|
||||||
Assertions.assertEquals(newPrice, newEntity.getPrice());
|
Assertions.assertEquals(newPrice, newEntity.getPrice());
|
||||||
Assertions.assertNotEquals(oldPrice, newEntity.getPrice());
|
Assertions.assertNotEquals(oldPrice, newEntity.getPrice());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Order(3)
|
|
||||||
void deleteTest() {
|
void deleteTest() {
|
||||||
productsService.delete(3L);
|
productsService.delete(product.getId());
|
||||||
Assertions.assertEquals(2, productsService.getAll().size());
|
Assertions.assertEquals(2, productsService.getAll().size());
|
||||||
final ProductsEntity last = productsService.get(2L);
|
|
||||||
Assertions.assertEquals(2L, last.getId());
|
final ProductsEntity newEntity = productsService.create(new ProductsEntity(category1, "Lenovo IDEA PAD 13", 15232.00));
|
||||||
|
Assertions.assertEquals(3, productsService.getAll().size());
|
||||||
|
Assertions.assertNotEquals(product.getId(), newEntity.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,23 @@
|
|||||||
package com.example.demo;
|
package com.example.demo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.AfterEach;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.MethodOrderer.OrderAnnotation;
|
import org.junit.jupiter.api.MethodOrderer.OrderAnnotation;
|
||||||
import org.junit.jupiter.api.Order;
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.jupiter.api.TestMethodOrder;
|
import org.junit.jupiter.api.TestMethodOrder;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
|
||||||
import com.example.demo.core.error.NotFoundException;
|
import com.example.demo.core.error.NotFoundException;
|
||||||
|
import com.example.demo.itemCategories.model.CategoriesEntity;
|
||||||
|
import com.example.demo.itemCategories.service.CategoriesService;
|
||||||
|
import com.example.demo.itemOrders.model.OrdersEntity;
|
||||||
|
import com.example.demo.itemOrders.service.OrdersService;
|
||||||
|
import com.example.demo.itemProducts.model.ProductsEntity;
|
||||||
|
import com.example.demo.itemProducts.service.ProductsService;
|
||||||
import com.example.demo.itemUsers.service.UsersService;
|
import com.example.demo.itemUsers.service.UsersService;
|
||||||
import com.example.demo.itemUsers.model.UsersEntity;
|
import com.example.demo.itemUsers.model.UsersEntity;
|
||||||
|
|
||||||
@ -17,6 +26,42 @@ import com.example.demo.itemUsers.model.UsersEntity;
|
|||||||
class UsersServiceTests {
|
class UsersServiceTests {
|
||||||
@Autowired
|
@Autowired
|
||||||
private UsersService usersService;
|
private UsersService usersService;
|
||||||
|
@Autowired
|
||||||
|
private OrdersService ordersService;
|
||||||
|
@Autowired
|
||||||
|
private ProductsService productsService;
|
||||||
|
@Autowired
|
||||||
|
private CategoriesService categoriesService;
|
||||||
|
|
||||||
|
private UsersEntity user;
|
||||||
|
|
||||||
|
private ProductsEntity product;
|
||||||
|
private CategoriesEntity category;
|
||||||
|
|
||||||
|
@BeforeEach
|
||||||
|
void createData() {
|
||||||
|
removeData();
|
||||||
|
|
||||||
|
category = categoriesService.create(new CategoriesEntity("Телефон"));
|
||||||
|
|
||||||
|
product = productsService.create(new ProductsEntity(category, "Iphone 13", 150000.00));
|
||||||
|
|
||||||
|
user = usersService.create(new UsersEntity("Natalia", "1234"));
|
||||||
|
usersService.create(new UsersEntity("Revengel", "4567"));
|
||||||
|
|
||||||
|
final var orders = List.of(
|
||||||
|
new OrdersEntity(product, 3),
|
||||||
|
new OrdersEntity(product, 2),
|
||||||
|
new OrdersEntity(product, 1),
|
||||||
|
new OrdersEntity(product, 4));
|
||||||
|
orders.forEach(order -> ordersService.create(user.getId(), order));
|
||||||
|
}
|
||||||
|
@AfterEach
|
||||||
|
void removeData() {
|
||||||
|
usersService.getAll().forEach(item -> usersService.delete(item.getId()));
|
||||||
|
productsService.getAll().forEach(item -> productsService.delete(item.getId()));
|
||||||
|
categoriesService.getAll().forEach(item -> categoriesService.delete(item.getId()));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void getTest() {
|
void getTest() {
|
||||||
@ -24,34 +69,32 @@ class UsersServiceTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Order(1)
|
|
||||||
void createTest() {
|
void createTest() {
|
||||||
usersService.create(new UsersEntity(null, "Natalia", "1234"));
|
|
||||||
final UsersEntity last = usersService.create(new UsersEntity(null, "Revengel", "4567"));
|
|
||||||
Assertions.assertEquals(2, usersService.getAll().size());
|
Assertions.assertEquals(2, usersService.getAll().size());
|
||||||
Assertions.assertEquals(last, usersService.get(2L));
|
Assertions.assertEquals(user, usersService.get(user.getId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Order(2)
|
|
||||||
void updateTest() {
|
void updateTest() {
|
||||||
final String newPassword = "0000";
|
final String newPassword = "0000";
|
||||||
final UsersEntity entity = usersService.get(2L);
|
final UsersEntity entity = usersService.get(user.getId());
|
||||||
final String login = entity.getLogin();
|
final String login = entity.getLogin();
|
||||||
final String oldPassword = entity.getPassword();
|
final String oldPassword = entity.getPassword();
|
||||||
final UsersEntity newEntity = usersService.update(2L, new UsersEntity(1L, login, newPassword));
|
final UsersEntity newEntity = usersService.update(user.getId(), new UsersEntity(login, newPassword));
|
||||||
Assertions.assertEquals(2, usersService.getAll().size());
|
Assertions.assertEquals(2, usersService.getAll().size());
|
||||||
Assertions.assertEquals(newEntity, usersService.get(2L));
|
Assertions.assertEquals(newEntity, usersService.get(newEntity.getId()));
|
||||||
Assertions.assertEquals(newPassword, newEntity.getPassword());
|
Assertions.assertEquals(newPassword, newEntity.getPassword());
|
||||||
Assertions.assertNotEquals(oldPassword, newEntity.getPassword());
|
Assertions.assertNotEquals(oldPassword, newEntity.getPassword());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Order(3)
|
|
||||||
void deleteTest() {
|
void deleteTest() {
|
||||||
usersService.delete(2L);
|
usersService.delete(user.getId());
|
||||||
Assertions.assertEquals(1, usersService.getAll().size());
|
Assertions.assertEquals(1, usersService.getAll().size());
|
||||||
final UsersEntity last = usersService.get(1L);
|
|
||||||
Assertions.assertEquals(1L, last.getId());
|
final UsersEntity newEntity = usersService.create(new UsersEntity("Natalia", "1234"));
|
||||||
|
Assertions.assertEquals(2, usersService.getAll().size());
|
||||||
|
Assertions.assertNotEquals(user.getId(), newEntity.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user