diff --git a/.gitignore b/.gitignore
index 31f10c63..bccefb37 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,6 +4,8 @@ build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**
!**/src/test/**
+### maven I introduced it 16032020, runs with JDK15 ###
+target/
### STS ###
.apt_generated
diff --git a/db/passwordfile.txt b/db/passwordfile.txt
new file mode 100644
index 00000000..7d72bd78
--- /dev/null
+++ b/db/passwordfile.txt
@@ -0,0 +1 @@
+postgres
\ No newline at end of file
diff --git a/docker-compose-postgres-only.yml b/docker-compose-postgres-only.yml
new file mode 100644
index 00000000..974a0b0d
--- /dev/null
+++ b/docker-compose-postgres-only.yml
@@ -0,0 +1,21 @@
+version: "3.7"
+services:
+ db:
+ image: postgres:12
+ ports:
+ - "5432:5432"
+ secrets:
+ - db-password
+ volumes:
+ - db-data:/var/lib/postgresql/data
+ networks:
+ - spring-postgres
+ environment:
+ - POSTGRES_PASSWORD_FILE=/run/secrets/db-password
+volumes:
+ db-data:
+secrets:
+ db-password:
+ file: db/passwordfile.txt
+networks:
+ spring-postgres:
\ No newline at end of file
diff --git a/knowhow-Docker-postgres.rai b/knowhow-Docker-postgres.rai
new file mode 100644
index 00000000..c54d544e
--- /dev/null
+++ b/knowhow-Docker-postgres.rai
@@ -0,0 +1,30 @@
+gradle jedoch nur JDK 11
+gradle build clean
+
+oder
+
+maven mit JDK 15
+mvn clean
+mvn spring-boot:run
+
+docker run -p 5432:5432 -d -e POSTGRES_PASSWORD=postgres -e POSTGRES_USER=postgres -e POSTGRES_DB=postgres -v pgdata:/var/lib/postgresql/data postgres
+oder
+docker-compose up -f docker-compose-postgres-only.yml
+
+mit heidisql
+Verbindung mit port 5432 / postgres / postgres
+
+DROP TABLE IF EXISTS student;
+CREATE TABLE "student001" (
+ "student_id" SERIAL PRIMARY KEY,
+ "student_branch" VARCHAR(255) NULL,
+ "student_email" VARCHAR(255) NULL,
+ "student_name" VARCHAR(255) NULL
+)
+;
+
+INSERT INTO student001 ( student_branch, student_email, student_name) VALUES
+ ( 'BCA', 'dolly@gmail.com', 'MDolly'),
+ ( 'B-Tech', 'rainier@gmail.com', 'rainier'),
+ ('M-Tech', 'ula1983@email.de', 'Ula'),
+ ('B-Tech', 'ula@gmail.de', 'Ula Habich 29.03.1983 meet 2015 (18.09.2015)),(01.11.2015),(21.12.2015) and 2016 (23.01.2016'));
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 00000000..8e76b7b8
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,54 @@
+
+
+ 4.0.0
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 2.3.4.RELEASE
+
+
+ com.main
+ Student
+ 0.0.1-SNAPSHOT
+ Student
+ Demo project for Spring Boot
+
+
+ 15
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-data-jpa
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+ org.postgresql
+ postgresql
+ runtime
+
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+
+
diff --git a/src/main/java/com/circleci/demojavaspring/controller/StudentController.java b/src/main/java/com/circleci/demojavaspring/controller/StudentController.java
new file mode 100644
index 00000000..b7d9e415
--- /dev/null
+++ b/src/main/java/com/circleci/demojavaspring/controller/StudentController.java
@@ -0,0 +1,47 @@
+package com.circleci.demojavaspring.controller;
+
+import com.circleci.demojavaspring.model.Student;
+import com.circleci.demojavaspring.service.Student_Service;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+import java.util.Optional;
+
+@RestController
+@CrossOrigin(origins="http://localhost:4200")
+@RequestMapping(value="/api")
+public class StudentController {
+
+ @Autowired
+ private Student_Service studentservice;
+
+ @PostMapping("save-student")
+ public boolean saveStudent(@RequestBody Student student) {
+ return studentservice.saveStudent(student);
+ }
+
+ @GetMapping("students-list")
+ public List allstudents() {
+ return studentservice.getStudents();
+ }
+
+
+ @DeleteMapping("delete-student/{student_id}")
+ public boolean deleteStudent(@PathVariable("student_id") int student_id,Student student) {
+ student.setStudent_id(student_id);
+ return studentservice.deleteStudent(student);
+ }
+
+ @GetMapping("student/{student_id}")
+ public List allstudentByID(@PathVariable("student_id") int student_id, Student student) {
+ student.setStudent_id(student_id);
+ return studentservice.getStudentByID(student);
+ }
+
+ @PostMapping("update-student/{student_id}")
+ public boolean updateStudent(@RequestBody Student student,@PathVariable("student_id") int student_id) {
+ student.setStudent_id(student_id);
+ return studentservice.updateStudent(student);
+ }
+}
diff --git a/src/main/java/com/circleci/demojavaspring/dao/Student_DAO.java b/src/main/java/com/circleci/demojavaspring/dao/Student_DAO.java
new file mode 100644
index 00000000..19e083bb
--- /dev/null
+++ b/src/main/java/com/circleci/demojavaspring/dao/Student_DAO.java
@@ -0,0 +1,15 @@
+package com.circleci.demojavaspring.dao;
+
+import com.circleci.demojavaspring.model.Student;
+
+import java.util.List;
+import java.util.Optional;
+
+public interface Student_DAO {
+
+ public boolean saveStudent(Student student);
+ public List getStudents();
+ public boolean deleteStudent(Student student);
+ public Optional getStudentByID(Student student);
+ public boolean updateStudent(Student student);
+}
diff --git a/src/main/java/com/circleci/demojavaspring/dao/Student_DAO_Imp.java b/src/main/java/com/circleci/demojavaspring/dao/Student_DAO_Imp.java
new file mode 100644
index 00000000..4ea13c5a
--- /dev/null
+++ b/src/main/java/com/circleci/demojavaspring/dao/Student_DAO_Imp.java
@@ -0,0 +1,63 @@
+package com.circleci.demojavaspring.dao;
+
+import com.circleci.demojavaspring.model.Student;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Repository;
+import com.circleci.demojavaspring.repository.StudentRepository;
+
+import java.util.List;
+import java.util.Optional;
+
+@Repository
+public class Student_DAO_Imp implements Student_DAO{
+
+ @Autowired
+ private StudentRepository studentRepository;
+
+ @Override
+ public boolean saveStudent(Student student) {
+ boolean status=false;
+ try {
+ studentRepository.save(student);
+ status=true;
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return status;
+ }
+
+ @Override
+ public List getStudents() {
+
+ return studentRepository.findAll();
+ }
+
+ @Override
+ public boolean deleteStudent(Student student) {
+ boolean status=false;
+ try {
+ studentRepository.delete(student);
+ status=true;
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return status;
+ }
+
+ @Override
+ public Optional getStudentByID(Student student) {
+ return studentRepository.findById(student.getStudent_id());
+ }
+
+ @Override
+ public boolean updateStudent(Student student) {
+ boolean status=false;
+ try {
+ studentRepository.save(student);
+ status=true;
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return status;
+ }
+}
diff --git a/src/main/java/com/circleci/demojavaspring/model/Student.java b/src/main/java/com/circleci/demojavaspring/model/Student.java
new file mode 100644
index 00000000..57077be7
--- /dev/null
+++ b/src/main/java/com/circleci/demojavaspring/model/Student.java
@@ -0,0 +1,48 @@
+package com.circleci.demojavaspring.model;
+
+import javax.persistence.*;
+
+@Entity
+@Table(name = "student")
+public class Student {
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ private int student_id;
+ private String student_name;
+ private String student_email;
+ private String student_branch;
+
+ public int getStudent_id() {
+ return student_id;
+ }
+
+ public void setStudent_id(int student_id) {
+ this.student_id = student_id;
+ }
+
+ public String getStudent_name() {
+ return student_name;
+ }
+
+ public void setStudent_name(String student_name) {
+ this.student_name = student_name;
+ }
+
+ public String getStudent_email() {
+ return student_email;
+ }
+
+ public void setStudent_email(String student_email) {
+ this.student_email = student_email;
+ }
+
+ public String getStudent_branch() {
+ return student_branch;
+ }
+
+ public void setStudent_branch(String student_branch) {
+ this.student_branch = student_branch;
+ }
+
+
+}
diff --git a/src/main/java/com/circleci/demojavaspring/repository/StudentRepository.java b/src/main/java/com/circleci/demojavaspring/repository/StudentRepository.java
new file mode 100644
index 00000000..67d9fe7d
--- /dev/null
+++ b/src/main/java/com/circleci/demojavaspring/repository/StudentRepository.java
@@ -0,0 +1,11 @@
+package com.circleci.demojavaspring.repository;
+
+import com.circleci.demojavaspring.model.Student;
+import org.springframework.data.repository.CrudRepository;
+
+import java.util.List;
+
+public interface StudentRepository extends CrudRepository {
+ @Override
+ List findAll();
+}
diff --git a/src/main/java/com/circleci/demojavaspring/service/Student_Service.java b/src/main/java/com/circleci/demojavaspring/service/Student_Service.java
new file mode 100644
index 00000000..eb629b7a
--- /dev/null
+++ b/src/main/java/com/circleci/demojavaspring/service/Student_Service.java
@@ -0,0 +1,14 @@
+package com.circleci.demojavaspring.service;
+
+import com.circleci.demojavaspring.model.Student;
+
+import java.util.List;
+import java.util.Optional;
+
+public interface Student_Service {
+ public boolean saveStudent(Student student);
+ public List getStudents();
+ public boolean deleteStudent(Student student);
+ public List getStudentByID(Student student);
+ public boolean updateStudent(Student student);
+}
diff --git a/src/main/java/com/circleci/demojavaspring/service/Student_Service_Imp.java b/src/main/java/com/circleci/demojavaspring/service/Student_Service_Imp.java
new file mode 100644
index 00000000..a8c18ea7
--- /dev/null
+++ b/src/main/java/com/circleci/demojavaspring/service/Student_Service_Imp.java
@@ -0,0 +1,47 @@
+package com.circleci.demojavaspring.service;
+
+import com.circleci.demojavaspring.dao.Student_DAO;
+import com.circleci.demojavaspring.model.Student;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Service
+@Transactional
+public class Student_Service_Imp implements Student_Service {
+
+ @Autowired
+ private Student_DAO studentdao;
+
+ @Override
+ public boolean saveStudent(Student student) {
+ return studentdao.saveStudent(student);
+ }
+
+ @Override
+ public List getStudents() {
+ return studentdao.getStudents();
+ }
+
+ @Override
+ public boolean deleteStudent(Student student) {
+ return studentdao.deleteStudent(student);
+ }
+
+ @Override
+ public List getStudentByID(Student student) {
+ Student studa = studentdao.getStudentByID(student).get();
+ ArrayList studentArrayList = new ArrayList<>();
+ studentArrayList.add(studa);
+ return studentArrayList;
+ }
+
+ @Override
+ public boolean updateStudent(Student student) {
+ return studentdao.updateStudent(student);
+ }
+
+}
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index c0cb0c8d..b3f1ea68 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -1,6 +1,6 @@
spring.datasource.url=jdbc:postgresql://localhost:5432/postgres
spring.datasource.username=postgres
-spring.datasource.password=password
+spring.datasource.password=postgres
spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=update
diff --git a/src/main/resources/test.properties b/src/main/resources/test.properties
index b380b783..06302054 100644
--- a/src/main/resources/test.properties
+++ b/src/main/resources/test.properties
@@ -1,4 +1,9 @@
-spring.datasource.url=jdbc:postgresql://localhost:5432/circle_test
+#spring.datasource.url=jdbc:postgresql://localhost:5432/circle_test
+#spring.datasource.username=postgres
+spring.datasource.url=jdbc:postgresql://localhost:5432/postgres
spring.datasource.username=postgres
+spring.datasource.password=postgres
-spring.jpa.hibernate.ddl-auto=create-drop
\ No newline at end of file
+#spring.jpa.hibernate.ddl-auto=create-drop
+spring.jpa.hibernate.ddl-auto=update
+spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true
\ No newline at end of file
diff --git a/src/test/java/com/circleci/demojavaspring/FifteenSecondTest.java b/src/test/java/com/circleci/demojavaspring/FifteenSecondTest.java
deleted file mode 100644
index 25d5ee72..00000000
--- a/src/test/java/com/circleci/demojavaspring/FifteenSecondTest.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.circleci.demojavaspring;
-
-import org.junit.Test;
-
-public class FifteenSecondTest {
-
- @Test
- public void fifteenSecondTest() throws InterruptedException {
- Thread.sleep(15000);
- }
-
-}
diff --git a/src/test/java/com/circleci/demojavaspring/FiftySecondTest.java b/src/test/java/com/circleci/demojavaspring/FiftySecondTest.java
deleted file mode 100644
index 7878bc32..00000000
--- a/src/test/java/com/circleci/demojavaspring/FiftySecondTest.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.circleci.demojavaspring;
-
-import org.junit.Test;
-
-public class FiftySecondTest {
-
- @Test
- public void fiftySecondTest() throws InterruptedException {
- Thread.sleep(50000);
- }
-
-}
diff --git a/src/test/java/com/circleci/demojavaspring/FivePerHundredSecondTest.java b/src/test/java/com/circleci/demojavaspring/FivePerHundredSecondTest.java
new file mode 100644
index 00000000..b8e796c1
--- /dev/null
+++ b/src/test/java/com/circleci/demojavaspring/FivePerHundredSecondTest.java
@@ -0,0 +1,18 @@
+package com.circleci.demojavaspring;
+
+import org.junit.Test;
+
+public class FivePerHundredSecondTest {
+
+ @Test
+ public void nullKommaNullFiveSecondTest() throws InterruptedException {
+ /*
+ 5000 fünf Sekunden
+ 500 fünf /10 Zehntel
+ 50 fünf /100 Sekunden
+ 5 fünf /1000 Sekunden, 5 Millisekunden
+ */
+ Thread.sleep(50);
+ }
+
+}
diff --git a/src/test/java/com/circleci/demojavaspring/FiveSecondTest.java b/src/test/java/com/circleci/demojavaspring/FiveSecondTest.java
deleted file mode 100644
index d35cce7b..00000000
--- a/src/test/java/com/circleci/demojavaspring/FiveSecondTest.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.circleci.demojavaspring;
-
-import org.junit.Test;
-
-public class FiveSecondTest {
-
- @Test
- public void fiveSecondTest() throws InterruptedException {
- Thread.sleep(5000);
- }
-
-}
diff --git a/src/test/java/com/circleci/demojavaspring/FortyFiveSecondTest.java b/src/test/java/com/circleci/demojavaspring/FortyFiveSecondTest.java
deleted file mode 100644
index 22cc8341..00000000
--- a/src/test/java/com/circleci/demojavaspring/FortyFiveSecondTest.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.circleci.demojavaspring;
-
-import org.junit.Test;
-
-public class FortyFiveSecondTest {
-
- @Test
- public void fortyFiveSecondTest() throws InterruptedException {
- Thread.sleep(45000);
- }
-
-}
diff --git a/src/test/java/com/circleci/demojavaspring/FortySecondTest.java b/src/test/java/com/circleci/demojavaspring/FortySecondTest.java
deleted file mode 100644
index 758db33b..00000000
--- a/src/test/java/com/circleci/demojavaspring/FortySecondTest.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.circleci.demojavaspring;
-
-import org.junit.Test;
-
-public class FortySecondTest {
-
- @Test
- public void fortySecondTest() throws InterruptedException {
- Thread.sleep(40000);
- }
-
-}
diff --git a/src/test/java/com/circleci/demojavaspring/HundredSecondTest.java b/src/test/java/com/circleci/demojavaspring/HundredSecondTest.java
deleted file mode 100644
index 28ebf509..00000000
--- a/src/test/java/com/circleci/demojavaspring/HundredSecondTest.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.circleci.demojavaspring;
-
-import org.junit.Test;
-
-public class HundredSecondTest {
-
- @Test
- public void hundredSecondTest() throws InterruptedException {
- Thread.sleep(100000);
- }
-
-}
diff --git a/src/test/java/com/circleci/demojavaspring/SixtySecondTest.java b/src/test/java/com/circleci/demojavaspring/SixtySecondTest.java
deleted file mode 100644
index 7701ad16..00000000
--- a/src/test/java/com/circleci/demojavaspring/SixtySecondTest.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.circleci.demojavaspring;
-
-import org.junit.Test;
-
-public class SixtySecondTest {
-
- @Test
- public void sixtySecondTest() throws InterruptedException {
- Thread.sleep(60000);
- }
-
-}
diff --git a/src/test/java/com/circleci/demojavaspring/TenSecondTest.java b/src/test/java/com/circleci/demojavaspring/TenSecondTest.java
deleted file mode 100644
index 110c9a22..00000000
--- a/src/test/java/com/circleci/demojavaspring/TenSecondTest.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.circleci.demojavaspring;
-
-import org.junit.Test;
-
-public class TenSecondTest {
-
- @Test
- public void tenSecondTest() throws InterruptedException {
- Thread.sleep(10000);
- }
-
-}
diff --git a/src/test/java/com/circleci/demojavaspring/ThirtySecondTest.java b/src/test/java/com/circleci/demojavaspring/ThirtySecondTest.java
deleted file mode 100644
index fe14c027..00000000
--- a/src/test/java/com/circleci/demojavaspring/ThirtySecondTest.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.circleci.demojavaspring;
-
-import org.junit.Test;
-
-public class ThirtySecondTest {
-
- @Test
- public void thirtySecondTest() throws InterruptedException {
- Thread.sleep(30000);
- }
-
-}
diff --git a/src/test/java/com/circleci/demojavaspring/TwentySecondTest.java b/src/test/java/com/circleci/demojavaspring/TwentySecondTest.java
deleted file mode 100644
index bf4c17bd..00000000
--- a/src/test/java/com/circleci/demojavaspring/TwentySecondTest.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.circleci.demojavaspring;
-
-import org.junit.Test;
-
-public class TwentySecondTest {
-
- @Test
- public void twentySecondTest() throws InterruptedException {
- Thread.sleep(20000);
- }
-
-}
diff --git a/studentPostgres.sql b/studentPostgres.sql
new file mode 100644
index 00000000..01a0394a
--- /dev/null
+++ b/studentPostgres.sql
@@ -0,0 +1,41 @@
+-- --------------------------------------------------------
+-- Host: 127.0.0.1
+-- Server Version: PostgreSQL 13.2 (Debian 13.2-1.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
+-- Server Betriebssystem:
+-- HeidiSQL Version: 11.2.0.6213
+-- --------------------------------------------------------
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET NAMES */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+
+-- Exportiere Struktur von Tabelle public.student
+CREATE TABLE IF NOT EXISTS "student" (
+ "student_id" INTEGER NOT NULL DEFAULT 'nextval(''student_student_id_seq''::regclass)',
+ "student_branch" VARCHAR(255) NULL DEFAULT NULL,
+ "student_email" VARCHAR(255) NULL DEFAULT NULL,
+ "student_name" VARCHAR(255) NULL DEFAULT NULL,
+ PRIMARY KEY ("student_id")
+);
+
+-- Exportiere Daten aus Tabelle public.student: 0 rows
+/*!40000 ALTER TABLE "student" DISABLE KEYS */;
+INSERT INTO "student" ("student_id", "student_branch", "student_email", "student_name") VALUES
+ (1, 'MCA', 'dolly@gmail.com', 'Dolly'),
+ (4, 'MCA', 'dolly@gmail.com', 'Dolly'),
+ (6, 'B-Tech', 'sonoo@gmail.com
+', 'sonoo'),
+ (7, 'B-Tech', 'rai707@email.de', 'RainerB'),
+ (3, 'MCA', 'sonoo@gmail.com
+', 'sonoo'),
+ (8, 'BCA', 'dolly@gmail.com', 'MDolly'),
+ (9, 'B-Tech', 'rainier@gmail.com', 'rainier'),
+ (10, 'M-Tech', 'ula1983@email.de', 'Ula Habich 29.03.1983 / meet 2015 (18.09.2015),(01.11.2015),(21.12.2015) and 2016 (23.01.2016)');
+/*!40000 ALTER TABLE "student" ENABLE KEYS */;
+
+/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
+/*!40014 SET FOREIGN_KEY_CHECKS=IFNULL(@OLD_FOREIGN_KEY_CHECKS, 1) */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40111 SET SQL_NOTES=IFNULL(@OLD_SQL_NOTES, 1) */;