Compare commits

..

1 Commits
lab2 ... main

Author SHA1 Message Date
parap
462d7f73e9 useless commit 2023-05-16 17:44:29 +04:00
25 changed files with 51 additions and 1817 deletions

1
.gitignore vendored
View File

@ -9,7 +9,6 @@ build/
.apt_generated .apt_generated
.classpath .classpath
.factorypath .factorypath
.project .project
.settings .settings
.springBeans .springBeans

View File

@ -6,7 +6,7 @@ plugins {
group = 'ru.ip.labs' group = 'ru.ip.labs'
version = '0.0.1-SNAPSHOT' version = '0.0.1-SNAPSHOT'
sourceCompatibility = '17' sourceCompatibility = '11'
repositories { repositories {
mavenCentral() mavenCentral()
@ -14,12 +14,6 @@ repositories {
dependencies { dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'com.h2database:h2:2.1.210'
implementation group: 'org.springdoc', name: 'springdoc-openapi-ui', version: '1.6.5'
testImplementation 'org.springframework.boot:spring-boot-starter-test' testImplementation 'org.springframework.boot:spring-boot-starter-test'
} }

View File

@ -13,7 +13,7 @@
<div class="container row"> <div class="container row">
<div class="form-group col-3"> <div class="form-group col-3">
<label for="formGroupExampleInput">X</label> <label for="formGroupExampleInput">X</label>
<input name="x" class="form-control col-3" placeholder="Первый аргумент"> <input name="x" type="number" class="form-control col-3" placeholder="Первый аргумент">
</div> </div>
<div class="form-group col-3"> <div class="form-group col-3">
<label for="formGroupExampleInput">Оператор</label> <label for="formGroupExampleInput">Оператор</label>
@ -21,13 +21,9 @@
<option selected>+</option> <option selected>+</option>
<option>-</option> <option>-</option>
<option>*</option> <option>*</option>
<option>**</option>
<option>/</option> <option>/</option>
</select> </select>
<select name="type" id="inputState" class="form-control">
<option selected>Int</option>
<option>String</option>
<option>Array</option>
</select>
</div> </div>
<div class="form-group col-3"> <div class="form-group col-3">

View File

@ -9,29 +9,33 @@ form.onsubmit = async (e) => {
if(form.y.value === "") return; if(form.y.value === "") return;
let index = form.selected.selectedIndex; let index = form.selected.selectedIndex;
let indexType = form.type.selectedIndex;
let op = form.selected.options[index].textContent; let op = form.selected.options[index].textContent;
let type = form.type.options[indexType].textContent;
let res = ""; let res = "";
switch(op) { switch(op) {
case "+": case "+":
res = await fetch(`http://localhost:8080/sum${type}?x=${form.x.value}&y=${form.y.value}`) res = await fetch(`http://localhost:8080/sum?x=${form.x.value}&y=${form.y.value}`)
res = await res.text(); res = await res.text();
break; break;
case "-": case "-":
res = await fetch(`http://localhost:8080/diff${type}?x=${form.x.value}&y=${form.y.value}`) res = await fetch(`http://localhost:8080/diff?x=${form.x.value}&y=${form.y.value}`)
res = await res.text(); res = await res.text();
break; break;
case "*": case "*":
res = await fetch(`http://localhost:8080/multiple${type}?x=${form.x.value}&y=${form.y.value}`) res = await fetch(`http://localhost:8080/multiply?x=${form.x.value}&y=${form.y.value}`)
res = await res.text(); res = await res.text();
break; break;
case "**":
res = await fetch(`http://localhost:8080/degree?x=${form.x.value}&y=${form.y.value}`)
res = await res.text();
break;
case "/": case "/":
if(form.y.value == 0) return; if(form.y.value == 0) return;
res = await fetch(`http://localhost:8080/divide${type}?x=${form.x.value}&y=${form.y.value}`) res = await fetch(`http://localhost:8080/divide?x=${form.x.value}&y=${form.y.value}`)
res = await res.text(); res = await res.text();
break; break;
} }

View File

@ -1,571 +0,0 @@
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 65536 bytes for Failed to commit metaspace.
# Possible reasons:
# The system is out of physical RAM or swap space
# The process is running with CompressedOops enabled, and the Java Heap may be blocking the growth of the native heap
# Possible solutions:
# Reduce memory load on the system
# Increase physical memory or swap space
# Check if swap backing store is full
# Decrease Java heap size (-Xmx/-Xms)
# Decrease number of Java threads
# Decrease Java thread stack sizes (-Xss)
# Set larger code cache with -XX:ReservedCodeCacheSize=
# JVM is running with Zero Based Compressed Oops mode in which the Java heap is
# placed in the first 32GB address space. The Java Heap base address is the
# maximum limit for the native heap growth. Please use -XX:HeapBaseMinAddress
# to set the Java Heap base and to place the Java Heap above 32GB virtual address.
# This output file may be truncated or incomplete.
#
# Out of Memory Error (virtualSpaceNode.cpp:110), pid=8264, tid=4592
#
# JRE version: Java(TM) SE Runtime Environment (17.0.2+8) (build 17.0.2+8-LTS-86)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (17.0.2+8-LTS-86, mixed mode, emulated-client, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, windows-amd64)
# No core dump will be written. Minidumps are not enabled by default on client versions of Windows
#
--------------- S U M M A R Y ------------
Command Line: -XX:TieredStopAtLevel=1 -Dfile.encoding=windows-1251 -Duser.country=RU -Duser.language=ru -Duser.variant ru.ip.labs.labs.LabsApplication
Host: Intel(R) Core(TM) i3-8145U CPU @ 2.10GHz, 4 cores, 15G, Windows 10 , 64 bit Build 19041 (10.0.19041.2364)
Time: Mon Feb 20 15:05:21 2023 RTZ 2 (s 10 , 64 bit Build 19041 (10.0.19041.2364) elapsed time: 0.435306 seconds (0d 0h 0m 0s)
--------------- T H R E A D ---------------
Current thread (0x000001fe285b63d0): JavaThread "main" [_thread_in_vm, id=4592, stack(0x000000b0e1100000,0x000000b0e1200000)]
Stack: [0x000000b0e1100000,0x000000b0e1200000]
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V [jvm.dll+0x670baa]
V [jvm.dll+0x7cfcb4]
V [jvm.dll+0x7d145e]
V [jvm.dll+0x7d1ac3]
V [jvm.dll+0x242bc5]
V [jvm.dll+0x7cbc5b]
V [jvm.dll+0x616966]
V [jvm.dll+0x1be3ee]
V [jvm.dll+0x6192a1]
V [jvm.dll+0x617306]
V [jvm.dll+0x2385a0]
V [jvm.dll+0x1e880d]
V [jvm.dll+0x1de251]
V [jvm.dll+0x537c30]
V [jvm.dll+0x74ad28]
V [jvm.dll+0x74ae14]
V [jvm.dll+0x408cc5]
V [jvm.dll+0x40ed18]
C [java.dll+0x17ec]
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
J 826 java.lang.ClassLoader.defineClass1(Ljava/lang/ClassLoader;Ljava/lang/String;[BIILjava/security/ProtectionDomain;Ljava/lang/String;)Ljava/lang/Class; java.base@17.0.2 (0 bytes) @ 0x000001fe30176763 [0x000001fe301766a0+0x00000000000000c3]
J 840 c1 java.lang.ClassLoader.defineClass(Ljava/lang/String;[BIILjava/security/ProtectionDomain;)Ljava/lang/Class; java.base@17.0.2 (43 bytes) @ 0x000001fe3017bcec [0x000001fe3017bbe0+0x000000000000010c]
J 678 c1 jdk.internal.loader.BuiltinClassLoader.defineClass(Ljava/lang/String;Ljdk/internal/loader/Resource;)Ljava/lang/Class; java.base@17.0.2 (121 bytes) @ 0x000001fe30140c74 [0x000001fe301407a0+0x00000000000004d4]
J 666 c1 jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(Ljava/lang/String;)Ljava/lang/Class; java.base@17.0.2 (64 bytes) @ 0x000001fe30138944 [0x000001fe30138680+0x00000000000002c4]
J 360 c1 jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(Ljava/lang/String;Z)Ljava/lang/Class; java.base@17.0.2 (143 bytes) @ 0x000001fe3002b584 [0x000001fe3002b100+0x0000000000000484]
J 548 c1 jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Ljava/lang/String;Z)Ljava/lang/Class; java.base@17.0.2 (40 bytes) @ 0x000001fe30106eac [0x000001fe30106d60+0x000000000000014c]
J 538 c1 java.lang.ClassLoader.loadClass(Ljava/lang/String;)Ljava/lang/Class; java.base@17.0.2 (7 bytes) @ 0x000001fe30103864 [0x000001fe30103820+0x0000000000000044]
v ~StubRoutines::call_stub
j org.springframework.core.convert.support.StreamConverter.<clinit>()V+2
v ~StubRoutines::call_stub
j org.springframework.core.convert.support.DefaultConversionService.addCollectionConverters(Lorg/springframework/core/convert/converter/ConverterRegistry;)V+188
j org.springframework.core.convert.support.DefaultConversionService.addDefaultConverters(Lorg/springframework/core/convert/converter/ConverterRegistry;)V+5
j org.springframework.boot.convert.ApplicationConversionService.configure(Lorg/springframework/format/FormatterRegistry;)V+1
j org.springframework.boot.convert.ApplicationConversionService.<init>(Lorg/springframework/util/StringValueResolver;Z)V+14
j org.springframework.boot.convert.ApplicationConversionService.<init>(Lorg/springframework/util/StringValueResolver;)V+3
j org.springframework.boot.convert.ApplicationConversionService.<init>()V+2
j org.springframework.boot.SpringApplication.configureEnvironment(Lorg/springframework/core/env/ConfigurableEnvironment;[Ljava/lang/String;)V+12
j org.springframework.boot.SpringApplication.prepareEnvironment(Lorg/springframework/boot/SpringApplicationRunListeners;Lorg/springframework/boot/DefaultBootstrapContext;Lorg/springframework/boot/ApplicationArguments;)Lorg/springframework/core/env/ConfigurableEnvironment;+15
j org.springframework.boot.SpringApplication.run([Ljava/lang/String;)Lorg/springframework/context/ConfigurableApplicationContext;+52
j org.springframework.boot.SpringApplication.run([Ljava/lang/Class;[Ljava/lang/String;)Lorg/springframework/context/ConfigurableApplicationContext;+9
j org.springframework.boot.SpringApplication.run(Ljava/lang/Class;[Ljava/lang/String;)Lorg/springframework/context/ConfigurableApplicationContext;+9
j ru.ip.labs.labs.LabsApplication.main([Ljava/lang/String;)V+3
v ~StubRoutines::call_stub
--------------- P R O C E S S ---------------
Threads class SMR info:
_java_thread_list=0x000001fe3f97be80, length=13, elements={
0x000001fe285b63d0, 0x000001fe3e83c990, 0x000001fe3e83d710, 0x000001fe3e854410,
0x000001fe3e856ce0, 0x000001fe3e8595b0, 0x000001fe3e87ae90, 0x000001fe3e8844a0,
0x000001fe3e88cdb0, 0x000001fe3f4e9870, 0x000001fe3f4f8e30, 0x000001fe3f4f62e0,
0x000001fe3f712060
}
Java Threads: ( => current thread )
=>0x000001fe285b63d0 JavaThread "main" [_thread_in_vm, id=4592, stack(0x000000b0e1100000,0x000000b0e1200000)]
0x000001fe3e83c990 JavaThread "Reference Handler" daemon [_thread_blocked, id=17388, stack(0x000000b0e1800000,0x000000b0e1900000)]
0x000001fe3e83d710 JavaThread "Finalizer" daemon [_thread_blocked, id=9572, stack(0x000000b0e1900000,0x000000b0e1a00000)]
0x000001fe3e854410 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=16104, stack(0x000000b0e1a00000,0x000000b0e1b00000)]
0x000001fe3e856ce0 JavaThread "Attach Listener" daemon [_thread_blocked, id=13168, stack(0x000000b0e1b00000,0x000000b0e1c00000)]
0x000001fe3e8595b0 JavaThread "Service Thread" daemon [_thread_blocked, id=2332, stack(0x000000b0e1c00000,0x000000b0e1d00000)]
0x000001fe3e87ae90 JavaThread "Monitor Deflation Thread" daemon [_thread_blocked, id=9668, stack(0x000000b0e1d00000,0x000000b0e1e00000)]
0x000001fe3e8844a0 JavaThread "C1 CompilerThread0" daemon [_thread_blocked, id=9472, stack(0x000000b0e1e00000,0x000000b0e1f00000)]
0x000001fe3e88cdb0 JavaThread "Sweeper thread" daemon [_thread_blocked, id=13320, stack(0x000000b0e1f00000,0x000000b0e2000000)]
0x000001fe3f4e9870 JavaThread "C1 CompilerThread1" daemon [_thread_blocked, id=4224, stack(0x000000b0e2000000,0x000000b0e2100000)]
0x000001fe3f4f8e30 JavaThread "Notification Thread" daemon [_thread_blocked, id=15036, stack(0x000000b0e2100000,0x000000b0e2200000)]
0x000001fe3f4f62e0 JavaThread "Common-Cleaner" daemon [_thread_blocked, id=12920, stack(0x000000b0e2300000,0x000000b0e2400000)]
0x000001fe3f712060 JavaThread "C1 CompilerThread2" daemon [_thread_blocked, id=17120, stack(0x000000b0e2400000,0x000000b0e2500000)]
Other Threads:
0x000001fe3e837e80 VMThread "VM Thread" [stack: 0x000000b0e1700000,0x000000b0e1800000] [id=10700]
0x000001fe2861e850 WatcherThread [stack: 0x000000b0e2200000,0x000000b0e2300000] [id=7428]
0x000001fe28603750 GCTaskThread "GC Thread#0" [stack: 0x000000b0e1200000,0x000000b0e1300000] [id=3184]
0x000001fe3fa47ba0 GCTaskThread "GC Thread#1" [stack: 0x000000b0e2500000,0x000000b0e2600000] [id=10876]
0x000001fe3fa4fea0 GCTaskThread "GC Thread#2" [stack: 0x000000b0e2600000,0x000000b0e2700000] [id=7940]
0x000001fe3fa50150 GCTaskThread "GC Thread#3" [stack: 0x000000b0e2700000,0x000000b0e2800000] [id=16468]
0x000001fe28616300 ConcurrentGCThread "G1 Main Marker" [stack: 0x000000b0e1300000,0x000000b0e1400000] [id=17368]
0x000001fe286173c0 ConcurrentGCThread "G1 Conc#0" [stack: 0x000000b0e1400000,0x000000b0e1500000] [id=14912]
0x000001fe3e7020c0 ConcurrentGCThread "G1 Refine#0" [stack: 0x000000b0e1500000,0x000000b0e1600000] [id=9096]
0x000001fe3fa31e10 ConcurrentGCThread "G1 Refine#1" [stack: 0x000000b0e2800000,0x000000b0e2900000] [id=16152]
0x000001fe3e7029f0 ConcurrentGCThread "G1 Service" [stack: 0x000000b0e1600000,0x000000b0e1700000] [id=12364]
Threads with active compile tasks:
VM state: not at safepoint (normal execution)
VM Mutex/Monitor currently owned by a thread: ([mutex/lock_event])
[0x000001fe285ae5d0] Metaspace_lock - owner thread: 0x000001fe285b63d0
Heap address: 0x0000000702c00000, size: 4052 MB, Compressed Oops mode: Zero based, Oop shift amount: 3
CDS archive(s) mapped at: [0x0000000800000000-0x0000000800bc0000-0x0000000800bc0000), size 12320768, SharedBaseAddress: 0x0000000800000000, ArchiveRelocationMode: 0.
Compressed class space mapped at: 0x0000000800c00000-0x0000000840c00000, reserved size: 1073741824
Narrow klass base: 0x0000000800000000, Narrow klass shift: 0, Narrow klass range: 0x100000000
GC Precious Log:
CPUs: 4 total, 4 available
Memory: 16205M
Large Page Support: Disabled
NUMA Support: Disabled
Compressed Oops: Enabled (Zero based)
Heap Region Size: 2M
Heap Min Capacity: 8M
Heap Initial Capacity: 254M
Heap Max Capacity: 4052M
Pre-touch: Disabled
Parallel Workers: 4
Concurrent Workers: 1
Concurrent Refinement Workers: 4
Periodic GC: Disabled
Heap:
garbage-first heap total 260096K, used 5595K [0x0000000702c00000, 0x0000000800000000)
region size 2048K, 3 young (6144K), 1 survivors (2048K)
Metaspace used 3793K, committed 3904K, reserved 1056768K
class space used 487K, committed 576K, reserved 1048576K
Heap Regions: E=young(eden), S=young(survivor), O=old, HS=humongous(starts), HC=humongous(continues), CS=collection set, F=free, OA=open archive, CA=closed archive, TAMS=top-at-mark-start (previous, next)
| 0|0x0000000702c00000, 0x0000000702d76e00, 0x0000000702e00000| 73%| O| |TAMS 0x0000000702c00000, 0x0000000702c00000| Untracked
| 1|0x0000000702e00000, 0x0000000702e00000, 0x0000000703000000| 0%| F| |TAMS 0x0000000702e00000, 0x0000000702e00000| Untracked
| 2|0x0000000703000000, 0x0000000703000000, 0x0000000703200000| 0%| F| |TAMS 0x0000000703000000, 0x0000000703000000| Untracked
| 3|0x0000000703200000, 0x0000000703200000, 0x0000000703400000| 0%| F| |TAMS 0x0000000703200000, 0x0000000703200000| Untracked
| 4|0x0000000703400000, 0x0000000703400000, 0x0000000703600000| 0%| F| |TAMS 0x0000000703400000, 0x0000000703400000| Untracked
| 5|0x0000000703600000, 0x0000000703600000, 0x0000000703800000| 0%| F| |TAMS 0x0000000703600000, 0x0000000703600000| Untracked
| 6|0x0000000703800000, 0x0000000703800000, 0x0000000703a00000| 0%| F| |TAMS 0x0000000703800000, 0x0000000703800000| Untracked
| 7|0x0000000703a00000, 0x0000000703a00000, 0x0000000703c00000| 0%| F| |TAMS 0x0000000703a00000, 0x0000000703a00000| Untracked
| 8|0x0000000703c00000, 0x0000000703c00000, 0x0000000703e00000| 0%| F| |TAMS 0x0000000703c00000, 0x0000000703c00000| Untracked
| 9|0x0000000703e00000, 0x0000000703e00000, 0x0000000704000000| 0%| F| |TAMS 0x0000000703e00000, 0x0000000703e00000| Untracked
| 10|0x0000000704000000, 0x0000000704000000, 0x0000000704200000| 0%| F| |TAMS 0x0000000704000000, 0x0000000704000000| Untracked
| 11|0x0000000704200000, 0x0000000704200000, 0x0000000704400000| 0%| F| |TAMS 0x0000000704200000, 0x0000000704200000| Untracked
| 12|0x0000000704400000, 0x0000000704400000, 0x0000000704600000| 0%| F| |TAMS 0x0000000704400000, 0x0000000704400000| Untracked
| 13|0x0000000704600000, 0x0000000704600000, 0x0000000704800000| 0%| F| |TAMS 0x0000000704600000, 0x0000000704600000| Untracked
| 14|0x0000000704800000, 0x0000000704800000, 0x0000000704a00000| 0%| F| |TAMS 0x0000000704800000, 0x0000000704800000| Untracked
| 15|0x0000000704a00000, 0x0000000704a00000, 0x0000000704c00000| 0%| F| |TAMS 0x0000000704a00000, 0x0000000704a00000| Untracked
| 16|0x0000000704c00000, 0x0000000704c00000, 0x0000000704e00000| 0%| F| |TAMS 0x0000000704c00000, 0x0000000704c00000| Untracked
| 17|0x0000000704e00000, 0x0000000704e00000, 0x0000000705000000| 0%| F| |TAMS 0x0000000704e00000, 0x0000000704e00000| Untracked
| 18|0x0000000705000000, 0x0000000705000000, 0x0000000705200000| 0%| F| |TAMS 0x0000000705000000, 0x0000000705000000| Untracked
| 19|0x0000000705200000, 0x0000000705200000, 0x0000000705400000| 0%| F| |TAMS 0x0000000705200000, 0x0000000705200000| Untracked
| 20|0x0000000705400000, 0x0000000705400000, 0x0000000705600000| 0%| F| |TAMS 0x0000000705400000, 0x0000000705400000| Untracked
| 21|0x0000000705600000, 0x0000000705600000, 0x0000000705800000| 0%| F| |TAMS 0x0000000705600000, 0x0000000705600000| Untracked
| 22|0x0000000705800000, 0x0000000705800000, 0x0000000705a00000| 0%| F| |TAMS 0x0000000705800000, 0x0000000705800000| Untracked
| 23|0x0000000705a00000, 0x0000000705a00000, 0x0000000705c00000| 0%| F| |TAMS 0x0000000705a00000, 0x0000000705a00000| Untracked
| 24|0x0000000705c00000, 0x0000000705c00000, 0x0000000705e00000| 0%| F| |TAMS 0x0000000705c00000, 0x0000000705c00000| Untracked
| 25|0x0000000705e00000, 0x0000000705e00000, 0x0000000706000000| 0%| F| |TAMS 0x0000000705e00000, 0x0000000705e00000| Untracked
| 26|0x0000000706000000, 0x0000000706000000, 0x0000000706200000| 0%| F| |TAMS 0x0000000706000000, 0x0000000706000000| Untracked
| 27|0x0000000706200000, 0x0000000706200000, 0x0000000706400000| 0%| F| |TAMS 0x0000000706200000, 0x0000000706200000| Untracked
| 28|0x0000000706400000, 0x0000000706400000, 0x0000000706600000| 0%| F| |TAMS 0x0000000706400000, 0x0000000706400000| Untracked
| 29|0x0000000706600000, 0x0000000706600000, 0x0000000706800000| 0%| F| |TAMS 0x0000000706600000, 0x0000000706600000| Untracked
| 30|0x0000000706800000, 0x0000000706800000, 0x0000000706a00000| 0%| F| |TAMS 0x0000000706800000, 0x0000000706800000| Untracked
| 31|0x0000000706a00000, 0x0000000706a00000, 0x0000000706c00000| 0%| F| |TAMS 0x0000000706a00000, 0x0000000706a00000| Untracked
| 32|0x0000000706c00000, 0x0000000706c00000, 0x0000000706e00000| 0%| F| |TAMS 0x0000000706c00000, 0x0000000706c00000| Untracked
| 33|0x0000000706e00000, 0x0000000706e00000, 0x0000000707000000| 0%| F| |TAMS 0x0000000706e00000, 0x0000000706e00000| Untracked
| 34|0x0000000707000000, 0x0000000707000000, 0x0000000707200000| 0%| F| |TAMS 0x0000000707000000, 0x0000000707000000| Untracked
| 35|0x0000000707200000, 0x0000000707200000, 0x0000000707400000| 0%| F| |TAMS 0x0000000707200000, 0x0000000707200000| Untracked
| 36|0x0000000707400000, 0x0000000707400000, 0x0000000707600000| 0%| F| |TAMS 0x0000000707400000, 0x0000000707400000| Untracked
| 37|0x0000000707600000, 0x0000000707600000, 0x0000000707800000| 0%| F| |TAMS 0x0000000707600000, 0x0000000707600000| Untracked
| 38|0x0000000707800000, 0x0000000707800000, 0x0000000707a00000| 0%| F| |TAMS 0x0000000707800000, 0x0000000707800000| Untracked
| 39|0x0000000707a00000, 0x0000000707a00000, 0x0000000707c00000| 0%| F| |TAMS 0x0000000707a00000, 0x0000000707a00000| Untracked
| 40|0x0000000707c00000, 0x0000000707c00000, 0x0000000707e00000| 0%| F| |TAMS 0x0000000707c00000, 0x0000000707c00000| Untracked
| 41|0x0000000707e00000, 0x0000000707e00000, 0x0000000708000000| 0%| F| |TAMS 0x0000000707e00000, 0x0000000707e00000| Untracked
| 42|0x0000000708000000, 0x0000000708000000, 0x0000000708200000| 0%| F| |TAMS 0x0000000708000000, 0x0000000708000000| Untracked
| 43|0x0000000708200000, 0x0000000708200000, 0x0000000708400000| 0%| F| |TAMS 0x0000000708200000, 0x0000000708200000| Untracked
| 44|0x0000000708400000, 0x0000000708400000, 0x0000000708600000| 0%| F| |TAMS 0x0000000708400000, 0x0000000708400000| Untracked
| 45|0x0000000708600000, 0x0000000708600000, 0x0000000708800000| 0%| F| |TAMS 0x0000000708600000, 0x0000000708600000| Untracked
| 46|0x0000000708800000, 0x0000000708800000, 0x0000000708a00000| 0%| F| |TAMS 0x0000000708800000, 0x0000000708800000| Untracked
| 47|0x0000000708a00000, 0x0000000708a00000, 0x0000000708c00000| 0%| F| |TAMS 0x0000000708a00000, 0x0000000708a00000| Untracked
| 48|0x0000000708c00000, 0x0000000708c00000, 0x0000000708e00000| 0%| F| |TAMS 0x0000000708c00000, 0x0000000708c00000| Untracked
| 49|0x0000000708e00000, 0x0000000708e00000, 0x0000000709000000| 0%| F| |TAMS 0x0000000708e00000, 0x0000000708e00000| Untracked
| 50|0x0000000709000000, 0x0000000709000000, 0x0000000709200000| 0%| F| |TAMS 0x0000000709000000, 0x0000000709000000| Untracked
| 51|0x0000000709200000, 0x0000000709200000, 0x0000000709400000| 0%| F| |TAMS 0x0000000709200000, 0x0000000709200000| Untracked
| 52|0x0000000709400000, 0x0000000709400000, 0x0000000709600000| 0%| F| |TAMS 0x0000000709400000, 0x0000000709400000| Untracked
| 53|0x0000000709600000, 0x0000000709600000, 0x0000000709800000| 0%| F| |TAMS 0x0000000709600000, 0x0000000709600000| Untracked
| 54|0x0000000709800000, 0x0000000709800000, 0x0000000709a00000| 0%| F| |TAMS 0x0000000709800000, 0x0000000709800000| Untracked
| 55|0x0000000709a00000, 0x0000000709a00000, 0x0000000709c00000| 0%| F| |TAMS 0x0000000709a00000, 0x0000000709a00000| Untracked
| 56|0x0000000709c00000, 0x0000000709c00000, 0x0000000709e00000| 0%| F| |TAMS 0x0000000709c00000, 0x0000000709c00000| Untracked
| 57|0x0000000709e00000, 0x0000000709e00000, 0x000000070a000000| 0%| F| |TAMS 0x0000000709e00000, 0x0000000709e00000| Untracked
| 58|0x000000070a000000, 0x000000070a000000, 0x000000070a200000| 0%| F| |TAMS 0x000000070a000000, 0x000000070a000000| Untracked
| 59|0x000000070a200000, 0x000000070a200000, 0x000000070a400000| 0%| F| |TAMS 0x000000070a200000, 0x000000070a200000| Untracked
| 60|0x000000070a400000, 0x000000070a400000, 0x000000070a600000| 0%| F| |TAMS 0x000000070a400000, 0x000000070a400000| Untracked
| 61|0x000000070a600000, 0x000000070a600000, 0x000000070a800000| 0%| F| |TAMS 0x000000070a600000, 0x000000070a600000| Untracked
| 62|0x000000070a800000, 0x000000070a800000, 0x000000070aa00000| 0%| F| |TAMS 0x000000070a800000, 0x000000070a800000| Untracked
| 63|0x000000070aa00000, 0x000000070aa00000, 0x000000070ac00000| 0%| F| |TAMS 0x000000070aa00000, 0x000000070aa00000| Untracked
| 64|0x000000070ac00000, 0x000000070ac00000, 0x000000070ae00000| 0%| F| |TAMS 0x000000070ac00000, 0x000000070ac00000| Untracked
| 65|0x000000070ae00000, 0x000000070ae00000, 0x000000070b000000| 0%| F| |TAMS 0x000000070ae00000, 0x000000070ae00000| Untracked
| 66|0x000000070b000000, 0x000000070b000000, 0x000000070b200000| 0%| F| |TAMS 0x000000070b000000, 0x000000070b000000| Untracked
| 67|0x000000070b200000, 0x000000070b200000, 0x000000070b400000| 0%| F| |TAMS 0x000000070b200000, 0x000000070b200000| Untracked
| 68|0x000000070b400000, 0x000000070b400000, 0x000000070b600000| 0%| F| |TAMS 0x000000070b400000, 0x000000070b400000| Untracked
| 69|0x000000070b600000, 0x000000070b600000, 0x000000070b800000| 0%| F| |TAMS 0x000000070b600000, 0x000000070b600000| Untracked
| 70|0x000000070b800000, 0x000000070b800000, 0x000000070ba00000| 0%| F| |TAMS 0x000000070b800000, 0x000000070b800000| Untracked
| 71|0x000000070ba00000, 0x000000070ba00000, 0x000000070bc00000| 0%| F| |TAMS 0x000000070ba00000, 0x000000070ba00000| Untracked
| 72|0x000000070bc00000, 0x000000070bc00000, 0x000000070be00000| 0%| F| |TAMS 0x000000070bc00000, 0x000000070bc00000| Untracked
| 73|0x000000070be00000, 0x000000070be00000, 0x000000070c000000| 0%| F| |TAMS 0x000000070be00000, 0x000000070be00000| Untracked
| 74|0x000000070c000000, 0x000000070c000000, 0x000000070c200000| 0%| F| |TAMS 0x000000070c000000, 0x000000070c000000| Untracked
| 75|0x000000070c200000, 0x000000070c200000, 0x000000070c400000| 0%| F| |TAMS 0x000000070c200000, 0x000000070c200000| Untracked
| 76|0x000000070c400000, 0x000000070c400000, 0x000000070c600000| 0%| F| |TAMS 0x000000070c400000, 0x000000070c400000| Untracked
| 77|0x000000070c600000, 0x000000070c600000, 0x000000070c800000| 0%| F| |TAMS 0x000000070c600000, 0x000000070c600000| Untracked
| 78|0x000000070c800000, 0x000000070c800000, 0x000000070ca00000| 0%| F| |TAMS 0x000000070c800000, 0x000000070c800000| Untracked
| 79|0x000000070ca00000, 0x000000070ca00000, 0x000000070cc00000| 0%| F| |TAMS 0x000000070ca00000, 0x000000070ca00000| Untracked
| 80|0x000000070cc00000, 0x000000070cc00000, 0x000000070ce00000| 0%| F| |TAMS 0x000000070cc00000, 0x000000070cc00000| Untracked
| 81|0x000000070ce00000, 0x000000070ce00000, 0x000000070d000000| 0%| F| |TAMS 0x000000070ce00000, 0x000000070ce00000| Untracked
| 82|0x000000070d000000, 0x000000070d000000, 0x000000070d200000| 0%| F| |TAMS 0x000000070d000000, 0x000000070d000000| Untracked
| 83|0x000000070d200000, 0x000000070d200000, 0x000000070d400000| 0%| F| |TAMS 0x000000070d200000, 0x000000070d200000| Untracked
| 84|0x000000070d400000, 0x000000070d400000, 0x000000070d600000| 0%| F| |TAMS 0x000000070d400000, 0x000000070d400000| Untracked
| 85|0x000000070d600000, 0x000000070d600000, 0x000000070d800000| 0%| F| |TAMS 0x000000070d600000, 0x000000070d600000| Untracked
| 86|0x000000070d800000, 0x000000070d800000, 0x000000070da00000| 0%| F| |TAMS 0x000000070d800000, 0x000000070d800000| Untracked
| 87|0x000000070da00000, 0x000000070da00000, 0x000000070dc00000| 0%| F| |TAMS 0x000000070da00000, 0x000000070da00000| Untracked
| 88|0x000000070dc00000, 0x000000070dc00000, 0x000000070de00000| 0%| F| |TAMS 0x000000070dc00000, 0x000000070dc00000| Untracked
| 89|0x000000070de00000, 0x000000070de00000, 0x000000070e000000| 0%| F| |TAMS 0x000000070de00000, 0x000000070de00000| Untracked
| 90|0x000000070e000000, 0x000000070e000000, 0x000000070e200000| 0%| F| |TAMS 0x000000070e000000, 0x000000070e000000| Untracked
| 91|0x000000070e200000, 0x000000070e200000, 0x000000070e400000| 0%| F| |TAMS 0x000000070e200000, 0x000000070e200000| Untracked
| 92|0x000000070e400000, 0x000000070e400000, 0x000000070e600000| 0%| F| |TAMS 0x000000070e400000, 0x000000070e400000| Untracked
| 93|0x000000070e600000, 0x000000070e600000, 0x000000070e800000| 0%| F| |TAMS 0x000000070e600000, 0x000000070e600000| Untracked
| 94|0x000000070e800000, 0x000000070e800000, 0x000000070ea00000| 0%| F| |TAMS 0x000000070e800000, 0x000000070e800000| Untracked
| 95|0x000000070ea00000, 0x000000070ea00000, 0x000000070ec00000| 0%| F| |TAMS 0x000000070ea00000, 0x000000070ea00000| Untracked
| 96|0x000000070ec00000, 0x000000070ec00000, 0x000000070ee00000| 0%| F| |TAMS 0x000000070ec00000, 0x000000070ec00000| Untracked
| 97|0x000000070ee00000, 0x000000070ee00000, 0x000000070f000000| 0%| F| |TAMS 0x000000070ee00000, 0x000000070ee00000| Untracked
| 98|0x000000070f000000, 0x000000070f000000, 0x000000070f200000| 0%| F| |TAMS 0x000000070f000000, 0x000000070f000000| Untracked
| 99|0x000000070f200000, 0x000000070f200000, 0x000000070f400000| 0%| F| |TAMS 0x000000070f200000, 0x000000070f200000| Untracked
| 100|0x000000070f400000, 0x000000070f400000, 0x000000070f600000| 0%| F| |TAMS 0x000000070f400000, 0x000000070f400000| Untracked
| 101|0x000000070f600000, 0x000000070f600000, 0x000000070f800000| 0%| F| |TAMS 0x000000070f600000, 0x000000070f600000| Untracked
| 102|0x000000070f800000, 0x000000070f800000, 0x000000070fa00000| 0%| F| |TAMS 0x000000070f800000, 0x000000070f800000| Untracked
| 103|0x000000070fa00000, 0x000000070fa00000, 0x000000070fc00000| 0%| F| |TAMS 0x000000070fa00000, 0x000000070fa00000| Untracked
| 104|0x000000070fc00000, 0x000000070fc00000, 0x000000070fe00000| 0%| F| |TAMS 0x000000070fc00000, 0x000000070fc00000| Untracked
| 105|0x000000070fe00000, 0x000000070fe00000, 0x0000000710000000| 0%| F| |TAMS 0x000000070fe00000, 0x000000070fe00000| Untracked
| 106|0x0000000710000000, 0x0000000710000000, 0x0000000710200000| 0%| F| |TAMS 0x0000000710000000, 0x0000000710000000| Untracked
| 107|0x0000000710200000, 0x0000000710200000, 0x0000000710400000| 0%| F| |TAMS 0x0000000710200000, 0x0000000710200000| Untracked
| 108|0x0000000710400000, 0x0000000710400000, 0x0000000710600000| 0%| F| |TAMS 0x0000000710400000, 0x0000000710400000| Untracked
| 109|0x0000000710600000, 0x0000000710600000, 0x0000000710800000| 0%| F| |TAMS 0x0000000710600000, 0x0000000710600000| Untracked
| 110|0x0000000710800000, 0x0000000710800000, 0x0000000710a00000| 0%| F| |TAMS 0x0000000710800000, 0x0000000710800000| Untracked
| 111|0x0000000710a00000, 0x0000000710a00000, 0x0000000710c00000| 0%| F| |TAMS 0x0000000710a00000, 0x0000000710a00000| Untracked
| 112|0x0000000710c00000, 0x0000000710c00000, 0x0000000710e00000| 0%| F| |TAMS 0x0000000710c00000, 0x0000000710c00000| Untracked
| 113|0x0000000710e00000, 0x0000000710e00000, 0x0000000711000000| 0%| F| |TAMS 0x0000000710e00000, 0x0000000710e00000| Untracked
| 114|0x0000000711000000, 0x0000000711000000, 0x0000000711200000| 0%| F| |TAMS 0x0000000711000000, 0x0000000711000000| Untracked
| 115|0x0000000711200000, 0x0000000711200000, 0x0000000711400000| 0%| F| |TAMS 0x0000000711200000, 0x0000000711200000| Untracked
| 116|0x0000000711400000, 0x0000000711400000, 0x0000000711600000| 0%| F| |TAMS 0x0000000711400000, 0x0000000711400000| Untracked
| 117|0x0000000711600000, 0x0000000711600000, 0x0000000711800000| 0%| F| |TAMS 0x0000000711600000, 0x0000000711600000| Untracked
| 118|0x0000000711800000, 0x0000000711800000, 0x0000000711a00000| 0%| F| |TAMS 0x0000000711800000, 0x0000000711800000| Untracked
| 119|0x0000000711a00000, 0x0000000711a00000, 0x0000000711c00000| 0%| F| |TAMS 0x0000000711a00000, 0x0000000711a00000| Untracked
| 120|0x0000000711c00000, 0x0000000711e00000, 0x0000000711e00000|100%| S|CS|TAMS 0x0000000711c00000, 0x0000000711c00000| Complete
| 121|0x0000000711e00000, 0x0000000711e00000, 0x0000000712000000| 0%| F| |TAMS 0x0000000711e00000, 0x0000000711e00000| Untracked
| 122|0x0000000712000000, 0x0000000712000000, 0x0000000712200000| 0%| F| |TAMS 0x0000000712000000, 0x0000000712000000| Untracked
| 123|0x0000000712200000, 0x0000000712200000, 0x0000000712400000| 0%| F| |TAMS 0x0000000712200000, 0x0000000712200000| Untracked
| 124|0x0000000712400000, 0x0000000712400000, 0x0000000712600000| 0%| F| |TAMS 0x0000000712400000, 0x0000000712400000| Untracked
| 125|0x0000000712600000, 0x00000007127f4368, 0x0000000712800000| 97%| E| |TAMS 0x0000000712600000, 0x0000000712600000| Complete
| 126|0x0000000712800000, 0x0000000712a00000, 0x0000000712a00000|100%| E|CS|TAMS 0x0000000712800000, 0x0000000712800000| Complete
Card table byte_map: [0x000001fe33600000,0x000001fe33df0000] _byte_map_base: 0x000001fe2fdea000
Marking Bits (Prev, Next): (CMBitMap*) 0x000001fe28605c90, (CMBitMap*) 0x000001fe28605cd0
Prev Bits: [0x000001fe345e0000, 0x000001fe38530000)
Next Bits: [0x000001fe38530000, 0x000001fe3c480000)
Polling page: 0x000001fe27d90000
Metaspace:
Usage:
Non-class: 3.23 MB used.
Class: 487.02 KB used.
Both: 3.70 MB used.
Virtual space:
Non-class space: 8.00 MB reserved, 3.25 MB ( 41%) committed, 1 nodes.
Class space: 1.00 GB reserved, 576.00 KB ( <1%) committed, 1 nodes.
Both: 1.01 GB reserved, 3.81 MB ( <1%) committed.
Chunk freelists:
Non-Class: 2.11 MB
Class: 3.45 MB
Both: 5.56 MB
MaxMetaspaceSize: unlimited
CompressedClassSpaceSize: 1.00 GB
Initial GC threshold: 21.00 MB
Current GC threshold: 21.00 MB
CDS: on
MetaspaceReclaimPolicy: balanced
- commit_granule_bytes: 65536.
- commit_granule_words: 8192.
- virtual_space_node_default_size: 1048576.
- enlarge_chunks_in_place: 1.
- new_chunks_are_fully_committed: 0.
- uncommit_free_chunks: 1.
- use_allocation_guard: 0.
- handle_deallocations: 1.
Internal statistics:
num_allocs_failed_limit: 0.
num_arena_births: 34.
num_arena_deaths: 0.
num_vsnodes_births: 2.
num_vsnodes_deaths: 0.
num_space_committed: 61.
num_space_uncommitted: 0.
num_chunks_returned_to_freelist: 0.
num_chunks_taken_from_freelist: 146.
num_chunk_merges: 0.
num_chunk_splits: 88.
num_chunks_enlarged: 67.
num_purges: 0.
num_inconsistent_stats: 0.
CodeCache: size=49152Kb used=3545Kb max_used=3545Kb free=45606Kb
bounds [0x000001fe2fe10000, 0x000001fe30190000, 0x000001fe32e10000]
total_blobs=1275 nmethods=866 adapters=335
compilation: enabled
stopped_count=0, restarted_count=0
full_count=0
Compilation events (20 events):
Event: 0.421 Thread 0x000001fe3e8844a0 nmethod 856 0x000001fe30182f90 code [0x000001fe30183120, 0x000001fe30183258]
Event: 0.421 Thread 0x000001fe3f712060 nmethod 855 0x000001fe30183310 code [0x000001fe301834a0, 0x000001fe30183638]
Event: 0.422 Thread 0x000001fe3f4e9870 857 1 java.util.Objects::hashCode (13 bytes)
Event: 0.423 Thread 0x000001fe3f4e9870 nmethod 857 0x000001fe30183710 code [0x000001fe301838a0, 0x000001fe301839a8]
Event: 0.423 Thread 0x000001fe3e8844a0 858 1 sun.reflect.generics.visitor.Reifier::getFactory (5 bytes)
Event: 0.423 Thread 0x000001fe3f4e9870 859 ! 1 org.springframework.util.ConcurrentReferenceHashMap$Segment::clear (69 bytes)
Event: 0.423 Thread 0x000001fe3e8844a0 nmethod 858 0x000001fe30183a10 code [0x000001fe30183ba0, 0x000001fe30183c78]
Event: 0.424 Thread 0x000001fe3e8844a0 860 1 org.springframework.core.ResolvableType::resolve (5 bytes)
Event: 0.424 Thread 0x000001fe3f712060 861 1 java.util.ArrayList::<init> (61 bytes)
Event: 0.424 Thread 0x000001fe3e8844a0 nmethod 860 0x000001fe30183d10 code [0x000001fe30183ea0, 0x000001fe30183f78]
Event: 0.424 Thread 0x000001fe3f4e9870 nmethod 859 0x000001fe30184010 code [0x000001fe30184220, 0x000001fe301846e8]
Event: 0.424 Thread 0x000001fe3e8844a0 862 1 java.util.concurrent.locks.AbstractOwnableSynchronizer::setExclusiveOwnerThread (6 bytes)
Event: 0.424 Thread 0x000001fe3f4e9870 863 1 java.lang.Class::cast (27 bytes)
Event: 0.424 Thread 0x000001fe3f712060 nmethod 861 0x000001fe30184a10 code [0x000001fe30184c00, 0x000001fe30185198]
Event: 0.424 Thread 0x000001fe3e8844a0 nmethod 862 0x000001fe30185390 code [0x000001fe30185520, 0x000001fe30185638]
Event: 0.424 Thread 0x000001fe3f4e9870 nmethod 863 0x000001fe30185a90 code [0x000001fe30185c40, 0x000001fe30185df8]
Event: 0.426 Thread 0x000001fe3e8844a0 865 1 sun.reflect.generics.tree.SimpleClassTypeSignature::getTypeArguments (5 bytes)
Event: 0.426 Thread 0x000001fe3e8844a0 nmethod 865 0x000001fe30185f10 code [0x000001fe301860a0, 0x000001fe30186178]
Event: 0.429 Thread 0x000001fe3e8844a0 866 1 java.util.Collections$1::hasNext (5 bytes)
Event: 0.430 Thread 0x000001fe3e8844a0 nmethod 866 0x000001fe30186210 code [0x000001fe301863a0, 0x000001fe30186478]
GC Heap History (2 events):
Event: 0.326 GC heap before
{Heap before GC invocations=0 (full 0):
garbage-first heap total 260096K, used 10240K [0x0000000702c00000, 0x0000000800000000)
region size 2048K, 6 young (12288K), 0 survivors (0K)
Metaspace used 2827K, committed 3008K, reserved 1056768K
class space used 347K, committed 448K, reserved 1048576K
}
Event: 0.329 GC heap after
{Heap after GC invocations=1 (full 0):
garbage-first heap total 260096K, used 3547K [0x0000000702c00000, 0x0000000800000000)
region size 2048K, 1 young (2048K), 1 survivors (2048K)
Metaspace used 2827K, committed 3008K, reserved 1056768K
class space used 347K, committed 448K, reserved 1048576K
}
Deoptimization events (2 events):
Event: 0.333 Thread 0x000001fe285b63d0 DEOPT PACKING pc=0x000001fe3014a801 sp=0x000000b0e11fd2c0
Event: 0.333 Thread 0x000001fe285b63d0 DEOPT UNPACKING pc=0x000001fe2fe62b43 sp=0x000000b0e11fc730 mode 3
Classes unloaded (0 events):
No events
Classes redefined (0 events):
No events
Internal exceptions (12 events):
Event: 0.174 Thread 0x000001fe285b63d0 Exception <a 'java/lang/ClassNotFoundException'{0x0000000712542060}: javax/smartcardio/CardPermission> (0x0000000712542060)
thrown [t:\workspace\open\src\hotspot\share\classfile\systemDictionary.cpp, line 256]
Event: 0.176 Thread 0x000001fe285b63d0 Exception <a 'java/io/FileNotFoundException'{0x0000000712550b48}> (0x0000000712550b48)
thrown [t:\workspace\open\src\hotspot\share\prims\jni.cpp, line 516]
Event: 0.261 Thread 0x000001fe285b63d0 Exception <a 'java/lang/NoSuchMethodError'{0x0000000712114910}: 'java.lang.Object java.lang.invoke.DirectMethodHandle$Holder.invokeSpecialIFC(java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object)'> (0x0000000712114910)
thrown [t:\workspace\open\src\hotspot\share\interpreter\linkResolver.cpp, line 766]
Event: 0.278 Thread 0x000001fe285b63d0 Exception <a 'java/lang/NoSuchMethodError'{0x00000007121c6f90}: 'int java.lang.invoke.DirectMethodHandle$Holder.invokeStaticInit(java.lang.Object, java.lang.Object)'> (0x00000007121c6f90)
thrown [t:\workspace\open\src\hotspot\share\interpreter\linkResolver.cpp, line 766]
Event: 0.322 Thread 0x000001fe285b63d0 Exception <a 'java/lang/NoSuchMethodError'{0x0000000711fcd8f0}: 'int java.lang.invoke.DirectMethodHandle$Holder.invokeStaticInit(java.lang.Object, java.lang.Object, java.lang.Object)'> (0x0000000711fcd8f0)
thrown [t:\workspace\open\src\hotspot\share\interpreter\linkResolver.cpp, line 766]
Event: 0.332 Thread 0x000001fe285b63d0 Exception <a 'java/lang/NoSuchMethodError'{0x0000000712828620}: 'java.lang.Object java.lang.invoke.DirectMethodHandle$Holder.newInvokeSpecial(java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object)'> (0x0000000712828620)
thrown [t:\workspace\open\src\hotspot\share\interpreter\linkResolver.cpp, line 766]
Event: 0.338 Thread 0x000001fe285b63d0 Exception <a 'java/lang/NoSuchMethodError'{0x00000007128666a8}: 'java.lang.Object java.lang.invoke.DirectMethodHandle$Holder.invokeStaticInit(java.lang.Object, java.lang.Object, java.lang.Object)'> (0x00000007128666a8)
thrown [t:\workspace\open\src\hotspot\share\interpreter\linkResolver.cpp, line 766]
Event: 0.342 Thread 0x000001fe285b63d0 Exception <a 'java/lang/NoSuchMethodError'{0x00000007128c9608}: 'void java.lang.invoke.DirectMethodHandle$Holder.invokeStatic(java.lang.Object, java.lang.Object, java.lang.Object)'> (0x00000007128c9608)
thrown [t:\workspace\open\src\hotspot\share\interpreter\linkResolver.cpp, line 766]
Event: 0.377 Thread 0x000001fe285b63d0 Exception <a 'java/lang/NoSuchMethodError'{0x0000000712642430}: 'java.lang.Object java.lang.invoke.DirectMethodHandle$Holder.invokeInterface(java.lang.Object, java.lang.Object, java.lang.Object)'> (0x0000000712642430)
thrown [t:\workspace\open\src\hotspot\share\interpreter\linkResolver.cpp, line 766]
Event: 0.378 Thread 0x000001fe285b63d0 Exception <a 'java/lang/IncompatibleClassChangeError'{0x0000000712645850}: Found class java.lang.Object, but interface was expected> (0x0000000712645850)
thrown [t:\workspace\open\src\hotspot\share\interpreter\linkResolver.cpp, line 833]
Event: 0.394 Thread 0x000001fe285b63d0 Exception <a 'java/lang/NoSuchMethodError'{0x00000007126bce58}: 'java.lang.Object java.lang.invoke.DirectMethodHandle$Holder.invokeStaticInit(java.lang.Object)'> (0x00000007126bce58)
thrown [t:\workspace\open\src\hotspot\share\interpreter\linkResolver.cpp, line 766]
Event: 0.400 Thread 0x000001fe285b63d0 Exception <a 'sun/nio/fs/WindowsException'{0x00000007126d1ca8}> (0x00000007126d1ca8)
thrown [t:\workspace\open\src\hotspot\share\prims\jni.cpp, line 516]
VM Operations (10 events):
Event: 0.083 Executing VM operation: HandshakeAllThreads
Event: 0.083 Executing VM operation: HandshakeAllThreads done
Event: 0.240 Executing VM operation: HandshakeAllThreads
Event: 0.240 Executing VM operation: HandshakeAllThreads done
Event: 0.254 Executing VM operation: HandshakeAllThreads
Event: 0.254 Executing VM operation: HandshakeAllThreads done
Event: 0.326 Executing VM operation: G1CollectForAllocation
Event: 0.329 Executing VM operation: G1CollectForAllocation done
Event: 0.401 Executing VM operation: HandshakeAllThreads
Event: 0.402 Executing VM operation: HandshakeAllThreads done
Events (20 events):
Event: 0.402 loading class java/lang/ProcessEnvironment$CheckedEntrySet$1
Event: 0.402 loading class java/lang/ProcessEnvironment$CheckedEntrySet$1 done
Event: 0.402 loading class java/lang/ProcessEnvironment$CheckedEntry
Event: 0.402 loading class java/lang/ProcessEnvironment$CheckedEntry done
Event: 0.412 loading class java/util/concurrent/CopyOnWriteArraySet
Event: 0.412 loading class java/util/concurrent/CopyOnWriteArraySet done
Event: 0.415 loading class java/util/concurrent/ConcurrentLinkedDeque
Event: 0.415 loading class java/util/concurrent/ConcurrentLinkedDeque done
Event: 0.415 loading class java/util/concurrent/ConcurrentLinkedDeque$Node
Event: 0.416 loading class java/util/concurrent/ConcurrentLinkedDeque$Node done
Event: 0.421 loading class sun/reflect/generics/tree/BottomSignature
Event: 0.421 loading class sun/reflect/generics/tree/BottomSignature done
Event: 0.421 loading class sun/reflect/generics/tree/Wildcard
Event: 0.421 loading class sun/reflect/generics/tree/Wildcard done
Event: 0.421 loading class sun/reflect/generics/reflectiveObjects/WildcardTypeImpl
Event: 0.421 loading class sun/reflect/generics/reflectiveObjects/WildcardTypeImpl done
Event: 0.424 loading class java/util/Currency
Event: 0.424 loading class java/util/Currency done
Event: 0.426 loading class java/util/UUID
Event: 0.426 loading class java/util/UUID done
Dynamic libraries:
0x00007ff7fdf40000 - 0x00007ff7fdf50000 C:\Program Files\Java\jdk-17.0.2\bin\java.exe
0x00007ff971070000 - 0x00007ff971268000 C:\WINDOWS\SYSTEM32\ntdll.dll
0x00007ff96f110000 - 0x00007ff96f1cf000 C:\WINDOWS\System32\KERNEL32.DLL
0x00007ff96eb70000 - 0x00007ff96ee42000 C:\WINDOWS\System32\KERNELBASE.dll
0x00007ff96e760000 - 0x00007ff96e860000 C:\WINDOWS\System32\ucrtbase.dll
0x00007ff957c40000 - 0x00007ff957c5a000 C:\Program Files\Java\jdk-17.0.2\bin\VCRUNTIME140.dll
0x00007ff950ea0000 - 0x00007ff950eb8000 C:\Program Files\Java\jdk-17.0.2\bin\jli.dll
0x00007ff96fa40000 - 0x00007ff96faee000 C:\WINDOWS\System32\ADVAPI32.dll
0x00007ff96fb30000 - 0x00007ff96fbce000 C:\WINDOWS\System32\msvcrt.dll
0x00007ff970f90000 - 0x00007ff97102c000 C:\WINDOWS\System32\sechost.dll
0x00007ff96fbd0000 - 0x00007ff96fcf5000 C:\WINDOWS\System32\RPCRT4.dll
0x00007ff96f7e0000 - 0x00007ff96f981000 C:\WINDOWS\System32\USER32.dll
0x00007ff96f080000 - 0x00007ff96f0a2000 C:\WINDOWS\System32\win32u.dll
0x00007ff96f1d0000 - 0x00007ff96f1fb000 C:\WINDOWS\System32\GDI32.dll
0x00007ff96e8f0000 - 0x00007ff96e9ff000 C:\WINDOWS\System32\gdi32full.dll
0x00007ff96ee50000 - 0x00007ff96eeed000 C:\WINDOWS\System32\msvcp_win.dll
0x00007ff93f090000 - 0x00007ff93f32a000 C:\WINDOWS\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.19041.1110_none_60b5254171f9507e\COMCTL32.dll
0x00007ff965030000 - 0x00007ff96503a000 C:\WINDOWS\SYSTEM32\VERSION.dll
0x00007ff96faf0000 - 0x00007ff96fb22000 C:\WINDOWS\System32\IMM32.DLL
0x00007ff968b30000 - 0x00007ff968b3c000 C:\Program Files\Java\jdk-17.0.2\bin\vcruntime140_1.dll
0x00007ff926df0000 - 0x00007ff926e7d000 C:\Program Files\Java\jdk-17.0.2\bin\msvcp140.dll
0x00007ff8fce60000 - 0x00007ff8fda21000 C:\Program Files\Java\jdk-17.0.2\bin\server\jvm.dll
0x00007ff96ffc0000 - 0x00007ff96ffc8000 C:\WINDOWS\System32\PSAPI.DLL
0x00007ff954050000 - 0x00007ff954059000 C:\WINDOWS\SYSTEM32\WSOCK32.dll
0x00007ff957ae0000 - 0x00007ff957b07000 C:\WINDOWS\SYSTEM32\WINMM.dll
0x00007ff96ffd0000 - 0x00007ff97003b000 C:\WINDOWS\System32\WS2_32.dll
0x00007ff96cfc0000 - 0x00007ff96cfd2000 C:\WINDOWS\SYSTEM32\kernel.appcore.dll
0x00007ff95c4a0000 - 0x00007ff95c4aa000 C:\Program Files\Java\jdk-17.0.2\bin\jimage.dll
0x00007ff96c4e0000 - 0x00007ff96c6c4000 C:\WINDOWS\SYSTEM32\DBGHELP.DLL
0x00007ff95bc50000 - 0x00007ff95bc85000 C:\WINDOWS\SYSTEM32\dbgcore.DLL
0x00007ff96e860000 - 0x00007ff96e8e2000 C:\WINDOWS\System32\bcryptPrimitives.dll
0x00007ff936340000 - 0x00007ff936365000 C:\Program Files\Java\jdk-17.0.2\bin\java.dll
0x00007ff90f000000 - 0x00007ff90f0d6000 C:\Program Files\Java\jdk-17.0.2\bin\jsvml.dll
0x00007ff970040000 - 0x00007ff970784000 C:\WINDOWS\System32\SHELL32.dll
0x00007ff96c7c0000 - 0x00007ff96cf52000 C:\WINDOWS\SYSTEM32\windows.storage.dll
0x00007ff96f480000 - 0x00007ff96f7d5000 C:\WINDOWS\System32\combase.dll
0x00007ff96e150000 - 0x00007ff96e180000 C:\WINDOWS\SYSTEM32\Wldp.dll
0x00007ff96f990000 - 0x00007ff96fa3d000 C:\WINDOWS\System32\SHCORE.dll
0x00007ff96f200000 - 0x00007ff96f255000 C:\WINDOWS\System32\shlwapi.dll
0x00007ff96e6a0000 - 0x00007ff96e6bf000 C:\WINDOWS\SYSTEM32\profapi.dll
0x00007ff950a50000 - 0x00007ff950a69000 C:\Program Files\Java\jdk-17.0.2\bin\net.dll
0x00007ff962870000 - 0x00007ff96297c000 C:\WINDOWS\SYSTEM32\WINHTTP.dll
0x00007ff96de40000 - 0x00007ff96deaa000 C:\WINDOWS\system32\mswsock.dll
0x00007ff935fb0000 - 0x00007ff935fc6000 C:\Program Files\Java\jdk-17.0.2\bin\nio.dll
0x00007ff934cf0000 - 0x00007ff934d08000 C:\Program Files\Java\jdk-17.0.2\bin\zip.dll
0x00007ff953be0000 - 0x00007ff953bf0000 C:\Program Files\Java\jdk-17.0.2\bin\verify.dll
dbghelp: loaded successfully - version: 4.0.5 - missing functions: none
symbol engine: initialized successfully - sym options: 0x614 - pdb path: .;C:\Program Files\Java\jdk-17.0.2\bin;C:\WINDOWS\SYSTEM32;C:\WINDOWS\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.19041.1110_none_60b5254171f9507e;C:\Program Files\Java\jdk-17.0.2\bin\server
VM Arguments:
jvm_args: -XX:TieredStopAtLevel=1 -Dfile.encoding=windows-1251 -Duser.country=RU -Duser.language=ru -Duser.variant
java_command: ru.ip.labs.labs.LabsApplication
java_class_path (initial): C:\Users\àäìèí\IdeaProjects\PIbd-22_Karamushko_M_K_IP_Labs\build\classes\java\main;C:\Users\àäìèí\IdeaProjects\PIbd-22_Karamushko_M_K_IP_Labs\build\resources\main;C:\Users\àäìèí\.gradle\caches\modules-2\files-2.1\org.springframework\spring-webmvc\5.3.25\62a8258bcc4f7a58dd69af5140481b64653c90\spring-webmvc-5.3.25.jar;C:\Users\àäìèí\.gradle\caches\modules-2\files-2.1\org.springframework\spring-web\5.3.25\c69815e7931cd3ce7f19cc8028fd1c36626120d6\spring-web-5.3.25.jar;C:\Users\àäìèí\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-autoconfigure\2.7.8\cb835d82d00116e907d341d11096c3476ab49721\spring-boot-autoconfigure-2.7.8.jar;C:\Users\àäìèí\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot\2.7.8\8db5af0f1171bb402c27a85fe97d741bddaa6fee\spring-boot-2.7.8.jar;C:\Users\àäìèí\.gradle\caches\modules-2\files-2.1\jakarta.annotation\jakarta.annotation-api\1.3.5\59eb84ee0d616332ff44aba065f3888cf002cd2d\jakarta.annotation-api-1.3.5.jar;C:\Users\àäìèí\.gradle\caches\modules-2\files-2.1\org.springframework\spring-context\5.3.25\268a70ce4f44333ce0f13304c5f8c53b3df5f5f4\spring-context-5.3.25.jar;C:\Users\àäìèí\.gradle\caches\modules-2\files-2.1\org.springframework\spring-expression\5.3.25\d681cdb86611f03d8ef29654edde219fe5afef1d\spring-expression-5.3.25.jar;C:\Users\àäìèí\.gradle\caches\modules-2\files-2.1\org.springframework\spring-aop\5.3.25\722e30759b29331726f9deed76f80b22345ee627\spring-aop-5.3.25.jar;C:\Users\àäìèí\.gradle\caches\modules-2\files-2.1\org.springframework\spring-beans\5.3.25\b3aeae036b4ea1abfa1f9604d452e19664efe5f6\spring-beans-5.3.25.jar;C:\Users\àäìèí\.gradle\caches\modules-2\files-2.1\org.springframework\spring-core\5.3.25\85382e86321227506bf7f97ed80e2ab88bce25f0\spring-core-5.3.25.jar;C:\Users\àäìèí\.gradle\caches\modules-2\files-2.1\org.yaml\snakeyaml\1.30\8fde7fe2586328ac3c68db92045e1c8759125000\snakeyaml-1.30.jar;C:\Users\àäìèí\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.d
Launcher Type: SUN_STANDARD
[Global flags]
intx CICompilerCount = 3 {product} {ergonomic}
uint ConcGCThreads = 1 {product} {ergonomic}
uint G1ConcRefinementThreads = 4 {product} {ergonomic}
size_t G1HeapRegionSize = 2097152 {product} {ergonomic}
uintx GCDrainStackTargetSize = 64 {product} {ergonomic}
size_t InitialHeapSize = 266338304 {product} {ergonomic}
size_t MarkStackSize = 4194304 {product} {ergonomic}
size_t MaxHeapSize = 4248829952 {product} {ergonomic}
size_t MaxNewSize = 2548039680 {product} {ergonomic}
size_t MinHeapDeltaBytes = 2097152 {product} {ergonomic}
size_t MinHeapSize = 8388608 {product} {ergonomic}
uintx NonProfiledCodeHeapSize = 0 {pd product} {ergonomic}
bool ProfileInterpreter = false {pd product} {command line}
uintx ProfiledCodeHeapSize = 0 {pd product} {ergonomic}
size_t SoftMaxHeapSize = 4248829952 {manageable} {ergonomic}
intx TieredStopAtLevel = 1 {product} {command line}
bool UseCompressedClassPointers = true {product lp64_product} {ergonomic}
bool UseCompressedOops = true {product lp64_product} {ergonomic}
bool UseG1GC = true {product} {ergonomic}
bool UseLargePagesIndividualAllocation = false {pd product} {ergonomic}
Logging:
Log output configuration:
#0: stdout all=warning uptime,level,tags
#1: stderr all=off uptime,level,tags
Environment Variables:
JAVA_HOME=C:\Program Files\Java\jdk-17.0.2
PATH=C:\Program Files\Common Files\Oracle\Java\javapath;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\windows\System32\OpenSSH\;C:\Program Files\Git\cmd;C:\ProgramData\chocolatey\bin;C:\Program Files (x86)\Yarn\bin\;C:\emacs\bin\;C:\Users\àäìèí\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\àäìèí\.dotnet\tools;C:\Users\àäìèí\AppData\Local\Yarn\bin;C:\Users\àäìèí\AppData\Roaming\npm;C:\Program Files\Java\jdk-11\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\apache-maven-3.8.5\bin;C:\Program Files\Microsoft SQL Server\150\Tools\Binn\;C:\Program Files\dotnet\;C:\Program Files\nodejs\;C:\Users\àäìèí\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\àäìèí\.dotnet\tools;C:\Users\àäìèí\AppData\Local\Yarn\bin;C:\Program Files\Java\jdk-11\bin;C:\Users\àäìèí\AppData\Local\Microsoft\WindowsApps;C:\Users\àäìèí\AppData\Local\GitHubDesktop\bin;C:\Users\àäìèí\.dotnet\tools;C:\Users\àäìèí\AppData\Roaming\npm;C:\Users\àäìèí\AppData\Local\Programs\Python\Python310\Scripts;C:\Users\àäìèí\Desktop\work\Óíèâåð\ÝÂÌ\assembler\fasm\INCLUDE;
USERNAME=àäìèí
OS=Windows_NT
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 142 Stepping 12, GenuineIntel
--------------- S Y S T E M ---------------
OS:
Windows 10 , 64 bit Build 19041 (10.0.19041.2364)
OS uptime: 2 days 22:39 hours
Hyper-V role detected
CPU: total 4 (initial active 4) (2 cores per cpu, 2 threads per core) family 6 model 142 stepping 12 microcode 0xb8, cx8, cmov, fxsr, ht, mmx, 3dnowpref, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, lzcnt, tsc, tscinvbit, avx, avx2, aes, erms, clmul, bmi1, bmi2, adx, fma, vzeroupper, clflush, clflushopt, hv
Memory: 4k page, system-wide physical 16205M (3237M free)
TotalPageFile size 18221M (AvailPageFile size 5M)
current process WorkingSet (physical memory assigned to process): 57M, peak: 57M
current process commit charge ("private bytes"): 338M, peak: 338M
vm_info: Java HotSpot(TM) 64-Bit Server VM (17.0.2+8-LTS-86) for windows-amd64 JRE (17.0.2+8-LTS-86), built on Dec 7 2021 21:51:03 by "mach5one" with MS VC++ 16.8 / 16.9 (VS2019)
END.

View File

@ -2,11 +2,47 @@ package ru.ip.labs.labs;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;
@SpringBootApplication @SpringBootApplication
@RestController
public class LabsApplication { public class LabsApplication {
public static void main(String[] args) { public static void main(String[] args) {
SpringApplication.run(LabsApplication.class, args); SpringApplication.run(LabsApplication.class, args);
} }
int getDegree(int x, int y) {
if(y == 1) return x;
int res = getDegree(x, y / 2);
res *= res;
if(y % 2 != 0) res *= x;
return res;
}
@GetMapping("/sum")
public int sum(@RequestParam int x, @RequestParam int y) {
return x + y;
}
@GetMapping("/diff")
public int diff(@RequestParam int x, @RequestParam int y) {
return x - y;
}
@GetMapping("/multiply")
public double multiply(@RequestParam double x, @RequestParam double y) {
return x * y;
}
@GetMapping("/divide")
public double divide(@RequestParam double x, @RequestParam double y) {
return x / y;
}
@GetMapping("/degree")
public int degree(@RequestParam int x, @RequestParam int y) {
return getDegree(x, y);
}
} }

View File

@ -1,82 +0,0 @@
package ru.ip.labs.labs.calculator.controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import ru.ip.labs.labs.calculator.service.CalculatorService;
@RestController
@RequestMapping("/test")
public class CalcController {
private final CalculatorService calculatorService;
public CalcController(CalculatorService calculatorService) {
this.calculatorService = calculatorService;
}
@GetMapping("/hello")
public String hello() {
return "Hi man";
}
@GetMapping("/sumInt")
public int sumInt(@RequestParam int x, @RequestParam int y) {
return calculatorService.getSum(x, y, "int");
}
@GetMapping("/sumString")
public String sumString(@RequestParam String x, @RequestParam int y) {
return calculatorService.getSum(x, y, "string");
}
@GetMapping("/sumArray")
public String sumArray(@RequestParam String x, int y) {
return calculatorService.getSum(x, y, "array");
}
@GetMapping("/diffInt")
public int diffInt(@RequestParam int x, @RequestParam int y) {
return calculatorService.getDiff(x, y, "int");
}
@GetMapping("/diffString")
public String diffString(@RequestParam String x, @RequestParam int y) {
return calculatorService.getDiff(x, y, "string");
}
@GetMapping("/diffArray")
public String diffArray(@RequestParam String x, int y) {
return calculatorService.getDiff(x, y, "array");
}
@GetMapping("/multipleInt")
public int multipleInt(@RequestParam int x, @RequestParam int y) {
return calculatorService.getMultiple(x, y, "int");
}
@GetMapping("/multipleString")
public String multipleString(@RequestParam String x, @RequestParam int y) {
return calculatorService.getMultiple(x, y, "string");
}
@GetMapping("/multipleArray")
public String multipleArray(@RequestParam String x, int y) {
return calculatorService.getMultiple(x, y, "array");
}
@GetMapping("/divideInt")
public int divideInt(@RequestParam int x, @RequestParam int y) {
return calculatorService.getDivide(x, y, "int");
}
@GetMapping("/divideString")
public String divideString(@RequestParam String x, @RequestParam int y) {
return calculatorService.getDivide(x, y, "string");
}
@GetMapping("/divideArray")
public String divideArray(@RequestParam String x, int y) {
return calculatorService.getDivide(x, y, "array");
}
}

View File

@ -1,8 +0,0 @@
package ru.ip.labs.labs.calculator.domain;
public interface Calculator<T> {
public T sum(T x, int y);
public T diff(T x, int y);
public T multiple(T x, int y);
public T divide(T x, int y);
}

View File

@ -1,66 +0,0 @@
package ru.ip.labs.labs.calculator.domain;
import org.springframework.stereotype.Component;
@Component(value = "testDatabase")
public class CalculatorArray implements Calculator<String> {
@Override
public String sum(String x, int y) {
String arr[] = x.split(",");
for(int i = 0; i < arr.length; ++i) {
try {
Integer first = Integer.parseInt(arr[i]);
arr[i] = (first + y) + "";
} catch (Exception err) {
arr[i] = "NaN";
}
}
return String.join(",", arr);
}
@Override
public String diff(String x, int y) {
String arr[] = x.split(",");
for(int i = 0; i < arr.length; ++i) {
try {
Integer first = Integer.parseInt(arr[i]);
arr[i] = (first - y) + "";
} catch (Exception err) {
arr[i] = "NaN";
}
}
return String.join(",", arr);
}
@Override
public String multiple(String x, int y) {
String arr[] = x.split(",");
for(int i = 0; i < arr.length; ++i) {
try {
Integer first = Integer.parseInt(arr[i]);
arr[i] = (first * y) + "";
} catch (Exception err) {
arr[i] = "NaN";
}
}
return String.join(",", arr);
}
@Override
public String divide(String x, int y) {
String arr[] = x.split(",");
for(int i = 0; i < arr.length; ++i) {
try {
Integer first = Integer.parseInt(arr[i]);
arr[i] = (first / y) + "";
} catch (Exception err) {
arr[i] = "NaN";
}
}
return String.join(",", arr);
}
}

View File

@ -1,26 +0,0 @@
package ru.ip.labs.labs.calculator.domain;
import org.springframework.stereotype.Component;
@Component(value = "int")
public class IntCalculator implements Calculator<Integer> {
@Override
public Integer sum(Integer x, int y) {
return x + y;
}
@Override
public Integer diff(Integer x, int y) {
return x - y;
}
@Override
public Integer multiple(Integer x, int y) {
return x * y;
}
@Override
public Integer divide(Integer x, int y) {
return x / y;
}
}

View File

@ -1,41 +0,0 @@
package ru.ip.labs.labs.calculator.domain;
import org.springframework.stereotype.Component;
@Component(value = "string")
public class StringCalculator implements Calculator<String> {
@Override
public String sum(String x, int y) {
return x + (y + "");
}
@Override
public String diff(String x, int y) {
String res = "";
int ySize = (y + "").length();
for(int i = 0; i < x.length(); ++i) {
int index = x.indexOf(y + "", i - ySize);
if(index - i < ySize && i >= index) continue;
res += x.charAt(i);
}
return res;
}
@Override
public String multiple(String x, int y) {
String res = "";
for(int i = 0; i < y; ++i) res += x;
return res;
}
@Override
public String divide(String x, int y) {
int len = x.length() / y;
String res = "";
for(int i = 0; i < len; ++i) res += x.charAt(i);
return res;
}
}

View File

@ -1,35 +0,0 @@
package ru.ip.labs.labs.calculator.service;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;
import ru.ip.labs.labs.calculator.domain.Calculator;
@Service
public class CalculatorService {
private final ApplicationContext _applicationContext;
public CalculatorService(ApplicationContext applicationContext) {
this._applicationContext = applicationContext;
}
public <T> T getSum(T x, int y, String opType) {
Calculator<T> calc = (Calculator<T>)_applicationContext.getBean(opType);
return calc.sum(x, y);
}
public <T> T getDiff(T x, int y, String opType) {
Calculator<T> calc = (Calculator<T>)_applicationContext.getBean(opType);
return calc.diff(x, y);
}
public <T> T getMultiple(T x, int y, String opType) {
Calculator<T> calc = (Calculator<T>)_applicationContext.getBean(opType);
return calc.multiple(x, y);
}
public <T> T getDivide(T x, int y, String opType) {
Calculator<T> calc = (Calculator<T>)_applicationContext.getBean(opType);
return calc.divide(x, y);
}
}

View File

@ -1,56 +0,0 @@
package ru.ip.labs.labs.films.controller;
import org.springframework.web.bind.annotation.*;
import ru.ip.labs.labs.films.models.Film;
import ru.ip.labs.labs.films.service.FilmsService;
import java.util.Iterator;
import java.util.List;
@RestController
@RequestMapping("/film")
public class FilmController {
private final FilmsService filmService;
public FilmController(FilmsService filmService) {
this.filmService = filmService;
}
@GetMapping("/test")
public String test() {
return "Test request";
}
@GetMapping("/{id}")
public Film getFilm(@PathVariable Long id) {
return filmService.findFilm(id);
}
@GetMapping("/")
public List<Film> getFilms() {
return filmService.findAllFilms();
}
@PostMapping("/")
public Film createFilm(@RequestParam String name) {
return filmService.addFilm(name);
}
@PatchMapping("/{id}")
public Film updateFilm(@PathVariable Long id,
@RequestParam("firstName") String name) {
return filmService.updateFilm(id, name);
}
@PatchMapping("/add_genre/{id}")
public Film addGenre(@PathVariable Long id, @RequestParam Long genre_id) {
return filmService.addGenre(id, genre_id);
}
@DeleteMapping("/{id}")
public Film deleteFilm(@PathVariable Long id) {
return filmService.deleteFilm(id);
}
}

View File

@ -1,46 +0,0 @@
package ru.ip.labs.labs.films.controller;
import org.springframework.web.bind.annotation.*;
import ru.ip.labs.labs.films.models.Film;
import ru.ip.labs.labs.films.models.Genre;
import ru.ip.labs.labs.films.service.FilmsService;
import ru.ip.labs.labs.films.service.GenreService;
import java.util.List;
@RestController
@RequestMapping("/genre")
public class GenreController {
private final GenreService genreService;
public GenreController(GenreService genreService) {
this.genreService = genreService;
}
@GetMapping("/{id}")
public Genre getGenre(@PathVariable Long id) {
return genreService.findGenre(id);
}
@GetMapping("/")
public List<Genre> getGenres() {
return genreService.findAllGenres();
}
@PostMapping("/")
public Genre createGenre(@RequestParam("name") String name) {
return genreService.addGenre(name);
}
@PatchMapping("/{id}")
public Genre updateGenre(@PathVariable Long id,
@RequestParam("name") String name) {
return genreService.updateGenre(id, name);
}
@DeleteMapping("/{id}")
public Genre deleteGenre(@PathVariable Long id) {
return genreService.deleteGenre(id);
}
}

View File

@ -1,71 +0,0 @@
package ru.ip.labs.labs.films.models;
import javax.persistence.*;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.util.List;
@Entity
public class Actor {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
private String name;
private String surname;
@Lob
private byte[] photo;
@ManyToMany(fetch = FetchType.EAGER, mappedBy = "actors")
private List<Film> films;
public Actor() {}
public Actor(String name, String surname) {
this.name = name;
this.surname = surname;
}
public byte[] getPhoto() {
return photo;
}
public void setPhoto(String path) throws IOException {
File f = new File(path);
photo = Files.readAllBytes(f.toPath());
}
public Long getId() {
return id;
}
public String getName() {
return name;
}
public String getSurname() {
return surname;
}
public void setSurname(String surname) {
this.surname = surname;
}
public void setName(String name) {
this.name = name;
}
public List<Film> getFilms() {
return films;
}
@Override
public String toString() {
String res = "\nFilm{" +
"id: " + id + "," +
"name: " + name + "," +
"surname: " + name + "," +
"films:" + (films == null ? "[]" : films.toString()) + "}"
;
return res;
}
}

View File

@ -1,83 +0,0 @@
package ru.ip.labs.labs.films.models;
import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;
import javax.persistence.*;
import java.util.Iterator;
import java.util.List;
@Entity
public class Film {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
private String name;
@ManyToMany
@LazyCollection(LazyCollectionOption.FALSE)
@JoinTable(name="films_genres",
joinColumns = @JoinColumn(name="film_id"),
inverseJoinColumns = @JoinColumn(name="genre_id")
)
private List<Genre> genres;
@ManyToMany(fetch = FetchType.EAGER)
@JoinTable(name="actors_films",
joinColumns = @JoinColumn(name="film_id"),
inverseJoinColumns = @JoinColumn(name="actor_id")
)
private List<Actor> actors;
public Film() {}
public Film(String name) {
this.name = name;
}
public Long getId() {
return id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public void addGenre(Genre g) {
genres.add(g);
}
public void addActor(Actor actor) {
actors.add(actor);
}
public List<Actor> getActors() {
return actors;
}
public List<Genre> getGenres() {
return genres;
}
@Override
public String toString() {
String res = "\nFilm{" +
"id: " + id + "," +
"name: " + name + "," +
"genres:" + (genres == null ? "[]" : genres.toString()) + "}"
;
/*
Iterator<Genre> iter = genres.iterator();
while(iter.hasNext()) {
Genre curr = iter.next();
res += "{ id: " + curr.getId() + ", name: " + curr.getName() + (iter.hasNext() ? "}, " : "}");
}
res += "]\n}";*/
return res;
}
}

View File

@ -1,36 +0,0 @@
package ru.ip.labs.labs.films.models;
import javax.persistence.*;
import java.util.List;
@Entity
public class Genre {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
private String name;
public Genre() {}
public Genre(String name) {
this.name = name;
}
public Long getId() {
return id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public String toString() {
return "Genre{" +
"id=" + id +
", name='" + name + '\'' +
'}';
}
}

View File

@ -1,85 +0,0 @@
package ru.ip.labs.labs.films.service;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import ru.ip.labs.labs.films.models.Actor;
import ru.ip.labs.labs.films.models.Film;
import javax.persistence.EntityManager;
import javax.persistence.EntityNotFoundException;
import javax.persistence.PersistenceContext;
import java.io.IOException;
import java.util.List;
@Service
public class ActorService {
@PersistenceContext
private EntityManager em;
@Transactional
public Actor addActor(String name, String surname) {
if (!StringUtils.hasText(name)) {
throw new IllegalArgumentException("Student name is null or empty");
}
Actor actor = new Actor(name, surname);
em.persist(actor);
return em.find(Actor.class, actor.getId());
}
@Transactional
public Actor addActor(String name, String surname, String path) {
if (!StringUtils.hasText(name)) {
throw new IllegalArgumentException("Student name is null or empty");
}
Actor actor = new Actor(name, surname);
try {
actor.setPhoto(path);
} catch(IOException err) {
System.out.println(err.getMessage());
}
em.persist(actor);
return em.find(Actor.class, actor.getId());
}
@Transactional(readOnly = true)
public Actor findActor(Long id) {
final Actor actor = em.find(Actor.class, id);
if (actor == null) {
throw new EntityNotFoundException(String.format("Actor with id [%s] is not found", id));
}
return actor;
}
@Transactional(readOnly = true)
public List<Actor> findAllActors() {
return em.createQuery("select f from Actor f", Actor.class)
.getResultList();
}
@Transactional
public Actor updateActor(Long id, String name, String surname) {
if (!StringUtils.hasText(name)) {
throw new IllegalArgumentException("Actor name is null or empty");
}
final Actor currentActor = findActor(id);
if(name != null) currentActor.setName(name);
if(surname != null) currentActor.setSurname(surname);
return em.merge(currentActor);
}
@Transactional
public Actor deleteActor(Long id) {
final Actor currentActor = findActor(id);
em.remove(currentActor);
return currentActor;
}
@Transactional
public void deleteAllActors() {
em.createQuery("delete from Actor").executeUpdate();
}
}

View File

@ -1,130 +0,0 @@
package ru.ip.labs.labs.films.service;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import ru.ip.labs.labs.films.models.Actor;
import ru.ip.labs.labs.films.models.Film;
import ru.ip.labs.labs.films.models.Genre;
import javax.persistence.EntityManager;
import javax.persistence.EntityNotFoundException;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import java.time.LocalDate;
import java.util.List;
@Service
public class FilmsService {
@PersistenceContext
private EntityManager em;
@Transactional
public Film addFilm(String name) {
if (!StringUtils.hasText(name)) {
throw new IllegalArgumentException("Student name is null or empty");
}
Film film = new Film(name);
em.persist(film);
return em.find(Film.class, film.getId());
}
// фильмы по жанру
// фильмы по актеру
@Transactional
public Film addGenre(Long filmId, Long genreId) {
final Film film = em.find(Film.class, filmId);
if (film == null) {
throw new EntityNotFoundException(String.format("Film with id [%s] is not found", filmId));
}
final Genre genre = em.find(Genre.class, genreId);
if (genre == null) {
throw new EntityNotFoundException(String.format("Genre with id [%s] is not found", genreId));
}
film.addGenre(genre);
return em.merge(film);
}
@Transactional
public Film addActor(Long filmId, Long actorId) {
final Film film = em.find(Film.class, filmId);
if (film == null) {
throw new EntityNotFoundException(String.format("Film with id [%s] is not found", filmId));
}
final Actor actor = em.find(Actor.class, actorId);
if (actor == null) {
throw new EntityNotFoundException(String.format("Genre with id [%s] is not found", actorId));
}
film.addActor(actor);
return em.merge(film);
}
@Transactional(readOnly = true)
public Film findFilm(Long id) {
final Film film = em.find(Film.class, id);
if (film == null) {
throw new EntityNotFoundException(String.format("Film with id [%s] is not found", id));
}
return film;
}
@Transactional(readOnly = true)
public List<Film> findFilmByGenre(Long id, Long genreId) {
Query query = em.createQuery("select f from Film f " +
"join f.genres g " +
"where g.id = :genreId", Film.class)
.setParameter("genreId", genreId);
List<Film> result = query.getResultList();
return result;
}
@Transactional(readOnly = true)
public List<Film> findFilmByActor(Long id, String name) {
Query query = em.createQuery("select f from Film f " +
"join f.actors a " +
"where a.name like :actorName", Film.class)
.setParameter("actorName", '%' + name + '%');
List<Film> result = query.getResultList();
return result;
}
@Transactional(readOnly = true)
public List<Film> findAllFilms() {
return em.createQuery("select f from Film f", Film.class)
.getResultList();
}
@Transactional
public Film updateFilm(Long id, String name) {
if (!StringUtils.hasText(name)) {
throw new IllegalArgumentException("Film name is null or empty");
}
final Film currentFilm = findFilm(id);
currentFilm.setName(name);
return em.merge(currentFilm);
}
@Transactional
public Film deleteFilm(Long id) {
final Film currentFilm = findFilm(id);
em.remove(currentFilm);
return currentFilm;
}
@Transactional
public void deleteAllFilms() {
em.createQuery("delete from Film").executeUpdate();
}
}

View File

@ -1,68 +0,0 @@
package ru.ip.labs.labs.films.service;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import ru.ip.labs.labs.films.models.Film;
import ru.ip.labs.labs.films.models.Genre;
import javax.persistence.EntityManager;
import javax.persistence.EntityNotFoundException;
import javax.persistence.PersistenceContext;
import java.util.List;
@Service
public class GenreService {
@PersistenceContext
private EntityManager em;
@Transactional
public Genre addGenre(String name) {
if (!StringUtils.hasText(name)) {
throw new IllegalArgumentException("Genre name is null or empty");
}
Genre genre = new Genre(name);
em.persist(genre);
return em.find(Genre.class, genre.getId());
}
@Transactional(readOnly = true)
public Genre findGenre(Long id) {
final Genre genre = em.find(Genre.class, id);
if (genre == null) {
throw new EntityNotFoundException(String.format("Genre with id [%s] is not found", id));
}
return genre;
}
@Transactional(readOnly = true)
public List<Genre> findAllGenres() {
return em.createQuery("select g from Genre g", Genre.class)
.getResultList();
}
@Transactional
public Genre updateGenre(Long id, String name) {
if (!StringUtils.hasText(name)) {
throw new IllegalArgumentException("Film name is null or empty");
}
final Genre currentGenre = findGenre(id);
currentGenre.setName(name);
return em.merge(currentGenre);
}
@Transactional
public Genre deleteGenre(Long id) {
final Genre currentGenre = findGenre(id);
em.remove(currentGenre);
return currentGenre;
}
@Transactional
public void deleteAllGenres() {
em.createQuery("delete from Genre").executeUpdate();
}
}

View File

@ -1,11 +1 @@
spring.main.banner-mode=off
#server.port=8080
spring.datasource.url=jdbc:h2:file:./data
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=password
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
spring.jpa.hibernate.ddl-auto=update
spring.h2.console.enabled=true
spring.h2.console.settings.trace=false
spring.h2.console.settings.web-allow-others=false

View File

@ -1,100 +0,0 @@
package ru.ip.labs.labs;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import ru.ip.labs.labs.films.models.Actor;
import ru.ip.labs.labs.films.models.Film;
import ru.ip.labs.labs.films.models.Genre;
import ru.ip.labs.labs.films.service.ActorService;
import ru.ip.labs.labs.films.service.FilmsService;
import ru.ip.labs.labs.films.service.GenreService;
import javax.persistence.EntityNotFoundException;
import java.util.List;
@SpringBootTest
public class JpaActorsTest {
private static final Logger log = LoggerFactory.getLogger(JpaFilmsTest.class);
@Autowired
FilmsService filmService;
@Autowired
ActorService actorService;
@Test
void testFilmCreate() {
actorService.deleteAllActors();
final Actor actor = actorService.addActor("Victor", "Ivanov");
log.info(actor.toString());
Assertions.assertNotNull(actor.getId());
}
@Test
void testFilmReadNotFound() {
actorService.deleteAllActors();
Assertions.assertThrows(EntityNotFoundException.class, () -> actorService.findActor(-1L));
}
@Test
void findFilm() {
actorService.deleteAllActors();
final Actor actor = actorService.addActor("Victor", "Ivanov");
log.info(actor.toString());
final Actor findActor = actorService.findActor(actor.getId());
log.info(findActor.toString());
Assertions.assertEquals(actor.toString(), findActor.toString());
}
@Test
void testReadAll() {
actorService.deleteAllActors();
final Actor actor = actorService.addActor("Victor", "Ivanov");
log.info(actor.toString());
final List<Actor> actors = actorService.findAllActors();
Assertions.assertEquals(actors.size(), 1);
}
@Test
void updateActor() {
actorService.deleteAllActors();
final Actor actor = actorService.addActor("Victor", "Ivanov");
actorService.updateActor(actor.getId(), "Terminator", null);
final Actor findActor = actorService.findActor(actor.getId());
log.info(findActor.toString());
Assertions.assertEquals(findActor.getName() + " " + findActor.getSurname(), "Terminator Ivanov");
}
@Test
void deleteActor() {
actorService.deleteAllActors();
final Actor actor = actorService.addActor("Victor", "Ivanov");
log.info(actor.toString());
actorService.deleteActor(actor.getId());
Assertions.assertThrows(EntityNotFoundException.class, () -> actorService.findActor(actor.getId()));
}
@Test
void addPhoto() {
actorService.deleteAllActors();
final Actor actor = actorService.addActor("Victor", "Ivanov", "C:\\Users\\админ\\Pictures\\Screenshots\\Снимок экрана (2).png");
Actor findActor = actorService.findActor(actor.getId());
Assertions.assertNotEquals(findActor.getPhoto().length, 0);
}
@Test
void addFilm() {
actorService.deleteAllActors();
filmService.findAllFilms();
final Actor actor = actorService.addActor("Victor", "Ivanov");
final Film film = filmService.addFilm("Terminator 2");
filmService.addActor(film.getId(), actor.getId());
final Actor findActor = actorService.findActor(actor.getId());
Assertions.assertEquals(findActor.getFilms().get(0).getId(), film.getId());
}
}

View File

@ -1,138 +0,0 @@
package ru.ip.labs.labs;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import ru.ip.labs.labs.films.models.Actor;
import ru.ip.labs.labs.films.models.Film;
import ru.ip.labs.labs.films.models.Genre;
import ru.ip.labs.labs.films.service.ActorService;
import ru.ip.labs.labs.films.service.FilmsService;
import ru.ip.labs.labs.films.service.GenreService;
import javax.persistence.EntityNotFoundException;
import java.util.List;
@SpringBootTest
public class JpaFilmsTest {
private static final Logger log = LoggerFactory.getLogger(JpaFilmsTest.class);
@Autowired
FilmsService filmService;
@Autowired
GenreService genreService;
@Autowired
ActorService actorService;
@Test
void testFilmCreate() {
filmService.deleteAllFilms();
final Film film = filmService.addFilm("Terminator 2");
log.info(film.toString());
Assertions.assertNotNull(film.getId());
}
@Test
void testFilmReadNotFound() {
filmService.deleteAllFilms();
Assertions.assertThrows(EntityNotFoundException.class, () -> filmService.findFilm(-1L));
}
@Test
void findFilm() {
filmService.deleteAllFilms();
final Film film = filmService.addFilm("Terminator 2");
log.info(film.toString());
final Film findFilm = filmService.findFilm(film.getId());
log.info(findFilm.toString());
Assertions.assertEquals(film.toString(), findFilm.toString());
}
@Test
void updateFilm() {
filmService.deleteAllFilms();
final Film film = filmService.addFilm("Terminator 2");
filmService.updateFilm(film.getId(), "Terminator 3");
final Film findFilm = filmService.findFilm(film.getId());
log.info(findFilm.toString());
Assertions.assertEquals(findFilm.getName(), "Terminator 3");
}
@Test
void testReadAll() {
filmService.deleteAllFilms();
final Film film = filmService.addFilm("Terminator 2");
log.info(film.toString());
final List<Film> films = filmService.findAllFilms();
Assertions.assertEquals(films.size(), 1);
}
@Test
void deleteFilm() {
filmService.deleteAllFilms();
final Film film = filmService.addFilm("Terminator 2");
log.info(film.toString());
filmService.deleteFilm(film.getId());
Assertions.assertThrows(EntityNotFoundException.class, () -> filmService.findFilm(film.getId()));
}
@Test
void findFilmsByGenres() {
filmService.deleteAllFilms();
genreService.deleteAllGenres();
final Film film = filmService.addFilm("Terminator 2");
filmService.addFilm("Terminator 3");
final Genre genre = genreService.addGenre("Comedy");
filmService.addGenre(film.getId(), genre.getId());
final List<Film> films = filmService.findFilmByGenre(film.getId(), genre.getId());
Assertions.assertEquals(films.size(), 1);
}
@Test
void findFilmsByActor() {
filmService.deleteAllFilms();
genreService.deleteAllGenres();
final Film film = filmService.addFilm("Terminator 2");
final Film film2 = filmService.addFilm("Terminator 3");
filmService.addFilm("Terminator 4");
final Actor actor = actorService.addActor("Victor", "Ivanov");
final Actor actor2 = actorService.addActor("Victoria", "Ivanov");
filmService.addActor(film.getId(), actor.getId());
filmService.addActor(film2.getId(), actor2.getId());
final List<Film> films = filmService.findFilmByActor(film.getId(), "Victor");
Assertions.assertEquals(films.size(), 2);
}
@Test
void addGenre() {
filmService.deleteAllFilms();
genreService.deleteAllGenres();
final Film film = filmService.addFilm("Terminator 2");
final Genre genre = genreService.addGenre("Comedy");
filmService.addGenre(film.getId(), genre.getId());
final Film findFilm = filmService.findFilm(film.getId());
Assertions.assertEquals(findFilm.getGenres().get(0).toString(), genre.toString());
}
@Test
void addActor() {
filmService.deleteAllFilms();
genreService.deleteAllGenres();
final Film film = filmService.addFilm("Terminator 2");
final Actor actor = actorService.addActor("Victor", "Ivanov");
filmService.addActor(film.getId(), actor.getId());
final Film findFilm = filmService.findFilm(film.getId());
Assertions.assertEquals(findFilm.getActors().get(0).getId(), actor.getId());
}
}

View File

@ -1,77 +0,0 @@
package ru.ip.labs.labs;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import ru.ip.labs.labs.films.models.Film;
import ru.ip.labs.labs.films.models.Genre;
import ru.ip.labs.labs.films.service.FilmsService;
import ru.ip.labs.labs.films.service.GenreService;
import javax.persistence.EntityNotFoundException;
import java.util.List;
@SpringBootTest
public class JpaGenresTest {
private static final Logger log = LoggerFactory.getLogger(JpaFilmsTest.class);
@Autowired
FilmsService filmService;
@Autowired
GenreService genreService;
@Test
void testGenreCreate() {
genreService.deleteAllGenres();
final Genre genre = genreService.addGenre("Comedy");
log.info(genre.toString());
Assertions.assertNotNull(genre.getId());
}
@Test
void testGenreReadNotFound() {
genreService.deleteAllGenres();
Assertions.assertThrows(EntityNotFoundException.class, () -> genreService.findGenre(-1L));
}
@Test
void findGenre() {
genreService.deleteAllGenres();
final Genre genre = genreService.addGenre("Comedy");
log.info(genre.toString());
final Genre findGenre = genreService.findGenre(genre.getId());
log.info(findGenre.toString());
Assertions.assertEquals(genre.toString(), findGenre.toString());
}
@Test
void testReadAll() {
genreService.deleteAllGenres();
final Genre genre = genreService.addGenre("Comedy");
log.info(genre.toString());
final List<Genre> genres = genreService.findAllGenres();
Assertions.assertEquals(genres.size(), 1);
}
@Test
void updateGenre() {
genreService.deleteAllGenres();
final Genre genre = genreService.addGenre("Comedy");
genreService.updateGenre(genre.getId(), "Drama");
final Genre findGenre = genreService.findGenre(genre.getId());
log.info(findGenre.toString());
Assertions.assertEquals(findGenre.getName(), "Drama");
}
@Test
void deleteGenre() {
genreService.deleteAllGenres();
final Genre genre = genreService.addGenre("Comedy");
log.info(genre.toString());
genreService.deleteGenre(genre.getId());
Assertions.assertThrows(EntityNotFoundException.class, () -> filmService.findFilm(genre.getId()));
}
}

View File

@ -1,79 +1,13 @@
package ru.ip.labs.labs; package ru.ip.labs.labs;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import ru.ip.labs.labs.calculator.domain.Calculator;
import ru.ip.labs.labs.calculator.service.CalculatorService;
@SpringBootTest @SpringBootTest
class LabsApplicationTests { class LabsApplicationTests {
@Autowired
private CalculatorService calculatorService;
@Test @Test
void testIntSum() { void contextLoads() {
Integer res = calculatorService.getSum(2, 2, "int");
Assertions.assertEquals(4, res);
}
@Test
void testArraySum() {
String res = calculatorService.getSum("1,2", 2, "array");
Assertions.assertEquals("3,4", res);
} }
@Test
void testIntDiff() {
Integer res = calculatorService.getDiff(4, 2, "int");
Assertions.assertEquals(2, res);
}
@Test
void testStringDiff() {
String res = calculatorService.getDiff("hello2", 2, "string");
Assertions.assertEquals("hello", res);
}
@Test
void testArrayDiff() {
String res = calculatorService.getDiff("1,2,3", 2, "array");
Assertions.assertEquals("-1,0,1", res);
}
@Test
void testIntMultiple() {
Integer res = calculatorService.getMultiple(2, 3, "int");
Assertions.assertEquals(6, res);
}
@Test
void testStringMultiple() {
String res = calculatorService.getMultiple("test", 2, "string");
Assertions.assertEquals("testtest", res);
}
@Test
void testArrayMultiple() {
String res = calculatorService.getMultiple("2,3", 2, "array");
Assertions.assertEquals("4,6", res);
}
@Test
void testIntDivide() {
Integer res = calculatorService.getDivide(10, 2, "int");
Assertions.assertEquals(5, res);
}
@Test
void testStringDivide() {
String res = calculatorService.getDivide("test", 2, "string");
Assertions.assertEquals("te", res);
}
@Test
void testArrayDivide() {
String res = calculatorService.getDivide("6,8", 2, "array");
Assertions.assertEquals("3,4", res);
}
@Test
void testErrorErrorWired() {
Assertions.assertThrows(NoSuchBeanDefinitionException.class, () -> calculatorService.getSum(1, 2, "date"));
}
} }