-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
98 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ dcsc-web/build/** | |
utilities/build/** | ||
**/build/** | ||
bin/** | ||
out/** | ||
.DS_STORE | ||
.settings | ||
.project | ||
|
7 changes: 7 additions & 0 deletions
7
athena/src/main/java/org/dcsc/athena/services/TutorUserService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package org.dcsc.athena.services; | ||
|
||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
public class TutorUserService { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
core/src/main/java/org/dcsc/core/user/group/GroupRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package org.dcsc.core.user.group; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
import java.util.Optional; | ||
|
||
@Repository | ||
public interface GroupRepository extends JpaRepository<Group, Long> { | ||
Optional<Group> findGroupByName(String name); | ||
} |
18 changes: 18 additions & 0 deletions
18
core/src/main/java/org/dcsc/core/user/group/GroupService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package org.dcsc.core.user.group; | ||
|
||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
@Service | ||
public class GroupService { | ||
@Autowired | ||
private GroupRepository groupRepository; | ||
|
||
// TODO: Use a more appropriate exception | ||
@Transactional(readOnly = true) | ||
public Group getGroup(String groupName) throws Exception { | ||
return groupRepository.findGroupByName(groupName) | ||
.orElseThrow(() -> new Exception(String.format("Could not find group with name - %s", groupName))); | ||
} | ||
} |
Submodule resources
updated
from e84622 to 8e7b5b
40 changes: 40 additions & 0 deletions
40
utilities/src/test/java/org/dcsc/utilities/converter/LocalDateTimeConverterTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package org.dcsc.utilities.converter; | ||
|
||
import org.junit.Assert; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.mockito.runners.MockitoJUnitRunner; | ||
|
||
import javax.persistence.AttributeConverter; | ||
import java.sql.Timestamp; | ||
import java.time.LocalDateTime; | ||
|
||
@RunWith(MockitoJUnitRunner.class) | ||
public class LocalDateTimeConverterTest { | ||
private static final AttributeConverter<LocalDateTime, Timestamp> converter = new LocalDateTimeConverter(); | ||
|
||
@Test | ||
public void convertToDatabaseColumnWithNullLocalDateTime() { | ||
Assert.assertNull(converter.convertToDatabaseColumn(null)); | ||
} | ||
|
||
@Test | ||
public void convertToDatabaseColumn() { | ||
LocalDateTime localDateTime = LocalDateTime.now(); | ||
|
||
Assert.assertEquals(Timestamp.valueOf(localDateTime), converter.convertToDatabaseColumn(localDateTime)); | ||
} | ||
|
||
@Test | ||
public void convertToEntityAttributeWithNullTimestamp() { | ||
Assert.assertNull(converter.convertToEntityAttribute(null)); | ||
} | ||
|
||
@Test | ||
public void convertToEntityAttribute() { | ||
LocalDateTime localDateTime = LocalDateTime.now(); | ||
Timestamp timestamp = Timestamp.valueOf(localDateTime); | ||
|
||
Assert.assertEquals(localDateTime, converter.convertToEntityAttribute(timestamp)); | ||
} | ||
} |