diff --git a/spring-data-radis/pom.xml b/spring-data-radis/pom.xml deleted file mode 100644 index 4d3b467d7b..0000000000 --- a/spring-data-radis/pom.xml +++ /dev/null @@ -1,78 +0,0 @@ - - 4.0.0 - - org.baeldung - sprint-data-radis - 0.0.1-SNAPSHOT - jar - - sprint-data-radis - - - UTF-8 - 4.2.2.RELEASE - 1.6.2.RELEASE - 0.8.0 - - - - - org.springframework.data - spring-data-redis - ${spring-data-redis} - - - - cglib - cglib-nodep - 2.2 - - - - log4j - log4j - 1.2.16 - - - - redis.clients - jedis - 2.5.1 - jar - - - - org.springframework - spring-core - ${spring.version} - - - - org.springframework - spring-context - ${spring.version} - - - - junit - junit - 4.12 - test - - - - org.springframework - spring-test - ${spring.version} - test - - - - com.lordofthejars - nosqlunit-redis - ${nosqlunit.version} - - - - diff --git a/spring-data-radis/src/main/java/org/baeldung/spring/data/radis/model/Student.java b/spring-data-radis/src/main/java/org/baeldung/spring/data/radis/model/Student.java deleted file mode 100644 index 4b8a90943c..0000000000 --- a/spring-data-radis/src/main/java/org/baeldung/spring/data/radis/model/Student.java +++ /dev/null @@ -1,64 +0,0 @@ -package org.baeldung.spring.data.radis.model; - - -import java.io.Serializable; - -public class Student implements Serializable { - - private static final long serialVersionUID = -1907106213598514113L; - - public enum Gender{Male, Female} - private String id; - private String name; - private Gender gender; - private int grade; - - public Student(String id, String name, Gender gender, int grade) { - this.id = id; - this.name = name; - this.gender = gender; - this.grade = grade; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public Gender getGender() { - return gender; - } - - public void setGender(Gender gender) { - this.gender = gender; - } - - public int getGrade() { - return grade; - } - - public void setGrade(int grade) { - this.grade = grade; - } - - @Override - public String toString() { - return "Student{" + - "id='" + id + '\'' + - ", name='" + name + '\'' + - ", gender=" + gender + - ", grade=" + grade + - '}'; - } -} \ No newline at end of file diff --git a/spring-data-radis/src/main/java/org/baeldung/spring/data/radis/repo/StudentRepository.java b/spring-data-radis/src/main/java/org/baeldung/spring/data/radis/repo/StudentRepository.java deleted file mode 100644 index bc1201478c..0000000000 --- a/spring-data-radis/src/main/java/org/baeldung/spring/data/radis/repo/StudentRepository.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung.spring.data.radis.repo; - -import org.baeldung.spring.data.radis.model.Student; - -import java.util.Map; - -public interface StudentRepository { - void saveStudent(Student person); - - void updateStudent(Student student); - - Student findStudent(String id); - - Map findAllStudents(); - - void deleteStudent(String id); -} diff --git a/spring-data-radis/src/main/java/org/baeldung/spring/data/radis/repo/StudentRepositoryImpl.java b/spring-data-radis/src/main/java/org/baeldung/spring/data/radis/repo/StudentRepositoryImpl.java deleted file mode 100644 index 3033020c24..0000000000 --- a/spring-data-radis/src/main/java/org/baeldung/spring/data/radis/repo/StudentRepositoryImpl.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.baeldung.spring.data.radis.repo; - -import org.baeldung.spring.data.radis.model.Student; -import org.springframework.data.redis.core.RedisTemplate; - -import java.util.Map; - -public class StudentRepositoryImpl implements StudentRepository { - - private static final String KEY = "Student"; - - private RedisTemplate redisTemplate; - - public void setRedisTemplate(RedisTemplate redisTemplate) { - this.redisTemplate = redisTemplate; - } - - public void saveStudent(final Student student) { - this.redisTemplate.opsForHash().put(KEY, student.getId(), student); - } - - public void updateStudent(final Student student) { - this.redisTemplate.opsForHash().put(KEY, student.getId(), student); - } - - public Student findStudent(final String id) { - return (Student)this.redisTemplate.opsForHash().get(KEY, id); - } - - public Map findAllStudents() { - return this.redisTemplate.opsForHash().entries(KEY); - } - - public void deleteStudent(final String id) { - this.redisTemplate.opsForHash().delete(KEY,id); - } -} diff --git a/spring-data-radis/src/main/resources/logback.xml b/spring-data-radis/src/main/resources/logback.xml deleted file mode 100644 index 215eeede64..0000000000 --- a/spring-data-radis/src/main/resources/logback.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - web - %date [%thread] %-5level %logger{36} - %message%n - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/spring-data-radis/src/main/resources/spring-config.xml b/spring-data-radis/src/main/resources/spring-config.xml deleted file mode 100644 index 950cd9a6fd..0000000000 --- a/spring-data-radis/src/main/resources/spring-config.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/spring-data-radis/src/main/resources/test.png b/spring-data-radis/src/main/resources/test.png deleted file mode 100644 index c3b5e80276..0000000000 Binary files a/spring-data-radis/src/main/resources/test.png and /dev/null differ diff --git a/spring-data-radis/src/test/java/org/baeldung/spring/data/radis/repo/StudentRepositoryTest.java b/spring-data-radis/src/test/java/org/baeldung/spring/data/radis/repo/StudentRepositoryTest.java deleted file mode 100644 index 024fd06295..0000000000 --- a/spring-data-radis/src/test/java/org/baeldung/spring/data/radis/repo/StudentRepositoryTest.java +++ /dev/null @@ -1,58 +0,0 @@ -package org.baeldung.spring.data.radis.repo; - -import org.baeldung.spring.data.radis.model.Student; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -import java.util.Map; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(locations = {"classpath:/spring-config.xml"}) -public class StudentRepositoryTest { - - @Autowired - private StudentRepository studentRepository; - - @Test - public void whenSavingStudent_thenAvailableOnRetrieval() throws Exception { - final Student student = new Student("Eng2015001", "John Doe", Student.Gender.Male, 1); - studentRepository.saveStudent(student); - final Student retrievedStudent = studentRepository.findStudent(student.getId()); - assertEquals(student.getId(), retrievedStudent.getId()); - } - - @Test - public void whenUpdatingStudent_thenAvailableOnRetrieval() throws Exception { - final Student student = new Student("Eng2015001", "John Doe", Student.Gender.Male, 1); - studentRepository.saveStudent(student); - student.setName("Richard Watson"); - studentRepository.saveStudent(student); - final Student retrievedStudent = studentRepository.findStudent(student.getId()); - assertEquals(student.getName(), retrievedStudent.getName()); - } - - @Test - public void whenSavingStudents_thenAllShouldAvailableOnRetrieval() throws Exception { - final Student engStudent = new Student("Eng2015001", "John Doe", Student.Gender.Male, 1); - final Student medStudent = new Student("Med2015001", "Gareth Houston", Student.Gender.Male, 2); - studentRepository.saveStudent(engStudent); - studentRepository.saveStudent(medStudent); - final Map retrievedStudent = studentRepository.findAllStudents(); - assertEquals(retrievedStudent.size(), 2); - } - - @Test - public void whenDeletingStudent_thenNotAvailableOnRetrieval() throws Exception { - final Student student = new Student("Eng2015001", "John Doe", Student.Gender.Male, 1); - studentRepository.saveStudent(student); - studentRepository.deleteStudent(student.getId()); - final Student retrievedStudent = studentRepository.findStudent(student.getId()); - assertNull(retrievedStudent); - } -} \ No newline at end of file