Browse Source
* feat: add integration test * feat: update action config * fix: action run failed * feat: add test report step in actionmaster
vran
3 years ago
committed by
GitHub
41 changed files with 806 additions and 59 deletions
@ -0,0 +1,10 @@ |
|||||
|
package com.databasir.core.infrastructure.constant; |
||||
|
|
||||
|
public interface RoleConstants { |
||||
|
|
||||
|
String SYS_OWNER = "SYS_OWNER"; |
||||
|
|
||||
|
String GROUP_OWNER = "GROUP_OWNER"; |
||||
|
|
||||
|
String GROUP_MEMBER = "GROUP_MEMBER"; |
||||
|
} |
@ -0,0 +1,92 @@ |
|||||
|
package com.databasir.core.domain.database.service; |
||||
|
|
||||
|
import com.databasir.common.DatabasirException; |
||||
|
import com.databasir.core.BaseTest; |
||||
|
import com.databasir.core.domain.DomainErrors; |
||||
|
import com.databasir.core.domain.database.data.DatabaseTypeCreateRequest; |
||||
|
import com.databasir.core.domain.database.data.DatabaseTypeUpdateRequest; |
||||
|
import com.databasir.dao.impl.DatabaseTypeDao; |
||||
|
import com.databasir.dao.tables.pojos.DatabaseTypePojo; |
||||
|
import org.junit.jupiter.api.Assertions; |
||||
|
import org.junit.jupiter.api.Test; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.test.context.jdbc.Sql; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
|
||||
|
@Transactional |
||||
|
class DatabaseTypeServiceTest extends BaseTest { |
||||
|
|
||||
|
@Autowired |
||||
|
private DatabaseTypeService databaseTypeService; |
||||
|
|
||||
|
@Autowired |
||||
|
private DatabaseTypeDao databaseTypeDao; |
||||
|
|
||||
|
@Test |
||||
|
void create() { |
||||
|
DatabaseTypeCreateRequest request = new DatabaseTypeCreateRequest(); |
||||
|
request.setDatabaseType("ut-mysql"); |
||||
|
request.setIcon(""); |
||||
|
request.setDescription("integration test"); |
||||
|
request.setJdbcDriverFileUrl("some url"); |
||||
|
request.setJdbcDriverClassName("com.mysql.jdbc.Driver"); |
||||
|
request.setJdbcProtocol("jdbc:mysql"); |
||||
|
request.setUrlPattern("{{jdbc.protocol}}//{{db.url}}/{{db.schema}}"); |
||||
|
Integer id = databaseTypeService.create(request); |
||||
|
Assertions.assertNotNull(id); |
||||
|
} |
||||
|
|
||||
|
@Test |
||||
|
@Sql("classpath:sql/domain/database/CreateDuplicate.sql") |
||||
|
void createWhenDatabaseTypeDuplicate() { |
||||
|
DatabaseTypeCreateRequest request = new DatabaseTypeCreateRequest(); |
||||
|
request.setDatabaseType("ut-mysql"); |
||||
|
request.setIcon(""); |
||||
|
request.setDescription("integration test"); |
||||
|
request.setJdbcDriverFileUrl("some url"); |
||||
|
request.setJdbcDriverClassName("com.mysql.jdbc.Driver"); |
||||
|
request.setJdbcProtocol("jdbc:mysql"); |
||||
|
request.setUrlPattern("{{jdbc.protocol}}//{{db.url}}/{{db.schema}}"); |
||||
|
|
||||
|
DatabasirException err = Assertions.assertThrows(DatabasirException.class, |
||||
|
() -> databaseTypeService.create(request)); |
||||
|
Assertions.assertEquals(DomainErrors.DATABASE_TYPE_NAME_DUPLICATE.getErrCode(), err.getErrCode()); |
||||
|
} |
||||
|
|
||||
|
@Test |
||||
|
@Sql("classpath:sql/domain/database/Update.sql") |
||||
|
void update() { |
||||
|
DatabaseTypeUpdateRequest request = new DatabaseTypeUpdateRequest(); |
||||
|
request.setId(-1000); |
||||
|
request.setIcon(""); |
||||
|
request.setDatabaseType("new-type"); |
||||
|
request.setDescription("integration test"); |
||||
|
request.setJdbcDriverFileUrl("some url"); |
||||
|
request.setJdbcDriverClassName("com.mysql.jdbc.Driver"); |
||||
|
request.setJdbcProtocol("jdbc:postgresql"); |
||||
|
request.setUrlPattern("{{jdbc.protocol}}//{{db.url}}/{{db.schema}}"); |
||||
|
databaseTypeService.update(request); |
||||
|
|
||||
|
DatabaseTypePojo pojo = databaseTypeDao.selectByDatabaseType("new-type"); |
||||
|
Assertions.assertNotNull(pojo); |
||||
|
Assertions.assertEquals("integration test", pojo.getDescription()); |
||||
|
Assertions.assertEquals("jdbc:postgresql", pojo.getJdbcProtocol()); |
||||
|
Assertions.assertEquals("{{jdbc.protocol}}//{{db.url}}/{{db.schema}}", pojo.getUrlPattern()); |
||||
|
} |
||||
|
|
||||
|
@Test |
||||
|
@Sql("classpath:sql/domain/database/DeleteById.sql") |
||||
|
void deleteById() { |
||||
|
int id = -1000; |
||||
|
databaseTypeService.deleteById(id); |
||||
|
Assertions.assertFalse(databaseTypeDao.existsById(id)); |
||||
|
} |
||||
|
|
||||
|
@Test |
||||
|
void deleteByIdWhenNotExists() { |
||||
|
int id = -1000; |
||||
|
databaseTypeService.deleteById(id); |
||||
|
Assertions.assertFalse(databaseTypeDao.existsById(id)); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,48 @@ |
|||||
|
package com.databasir.core.domain.description.service; |
||||
|
|
||||
|
import com.databasir.core.BaseTest; |
||||
|
import com.databasir.core.domain.description.data.DocumentDescriptionSaveRequest; |
||||
|
import com.databasir.dao.impl.DocumentDescriptionDao; |
||||
|
import com.databasir.dao.tables.pojos.DocumentDescriptionPojo; |
||||
|
import org.junit.jupiter.api.Assertions; |
||||
|
import org.junit.jupiter.api.Test; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
@Transactional |
||||
|
class DocumentDescriptionServiceTest extends BaseTest { |
||||
|
|
||||
|
@Autowired |
||||
|
private DocumentDescriptionService documentDescriptionService; |
||||
|
|
||||
|
@Autowired |
||||
|
private DocumentDescriptionDao documentDescriptionDao; |
||||
|
|
||||
|
@Test |
||||
|
void save() { |
||||
|
DocumentDescriptionSaveRequest saveRequest = new DocumentDescriptionSaveRequest(); |
||||
|
saveRequest.setTableName("ut"); |
||||
|
saveRequest.setColumnName("ut"); |
||||
|
saveRequest.setContent("hello world"); |
||||
|
int groupId = -1; |
||||
|
int projectId = -1; |
||||
|
int userId = -1; |
||||
|
documentDescriptionService.save(groupId, projectId, userId, saveRequest); |
||||
|
|
||||
|
boolean isExists = documentDescriptionDao.exists(projectId, |
||||
|
saveRequest.getTableName(), saveRequest.getColumnName()); |
||||
|
Assertions.assertTrue(isExists); |
||||
|
|
||||
|
DocumentDescriptionSaveRequest updateRequest = new DocumentDescriptionSaveRequest(); |
||||
|
updateRequest.setTableName("ut"); |
||||
|
updateRequest.setColumnName("ut"); |
||||
|
updateRequest.setContent("update content"); |
||||
|
documentDescriptionService.save(groupId, projectId, userId, updateRequest); |
||||
|
var tableData = documentDescriptionDao.selectTableDescriptionByProjectId(projectId); |
||||
|
Assertions.assertEquals(0, tableData.size()); |
||||
|
List<DocumentDescriptionPojo> descriptionData = documentDescriptionDao.selectByProjectId(projectId); |
||||
|
Assertions.assertEquals(1, descriptionData.size()); |
||||
|
} |
||||
|
} |
@ -0,0 +1,80 @@ |
|||||
|
package com.databasir.core.domain.discussion.service; |
||||
|
|
||||
|
import com.databasir.common.exception.Forbidden; |
||||
|
import com.databasir.core.BaseTest; |
||||
|
import com.databasir.core.domain.discussion.data.DiscussionCreateRequest; |
||||
|
import com.databasir.core.infrastructure.event.subscriber.DiscussionEventSubscriber; |
||||
|
import com.databasir.dao.Tables; |
||||
|
import com.databasir.dao.impl.DocumentDiscussionDao; |
||||
|
import org.junit.jupiter.api.Assertions; |
||||
|
import org.junit.jupiter.api.Test; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.boot.test.mock.mockito.MockBean; |
||||
|
import org.springframework.test.context.jdbc.Sql; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
|
||||
|
import static org.mockito.Mockito.*; |
||||
|
|
||||
|
@Transactional |
||||
|
class DocumentDiscussionServiceTest extends BaseTest { |
||||
|
|
||||
|
@Autowired |
||||
|
private DocumentDiscussionService documentDiscussionService; |
||||
|
|
||||
|
@Autowired |
||||
|
private DocumentDiscussionDao documentDiscussionDao; |
||||
|
|
||||
|
@MockBean |
||||
|
private DiscussionEventSubscriber discussionEventSubscriber; |
||||
|
|
||||
|
@Test |
||||
|
@Sql("classpath:sql/domain/discussion/DeleteById.sql") |
||||
|
void deleteById() { |
||||
|
int groupId = -999; |
||||
|
int projectId = -999; |
||||
|
int discussionId = -999; |
||||
|
documentDiscussionService.deleteById(groupId, projectId, discussionId); |
||||
|
|
||||
|
Assertions.assertFalse(documentDiscussionDao.existsById(discussionId)); |
||||
|
} |
||||
|
|
||||
|
@Test |
||||
|
void deleteByIdWhenProjectNotExists() { |
||||
|
int groupId = -1; |
||||
|
int projectId = -2; |
||||
|
Assertions.assertThrows(Forbidden.class, |
||||
|
() -> documentDiscussionService.deleteById(groupId, projectId, -1)); |
||||
|
} |
||||
|
|
||||
|
@Test |
||||
|
@Sql("classpath:sql/domain/discussion/Create.sql") |
||||
|
void create() { |
||||
|
doNothing().when(discussionEventSubscriber).onDiscussionCreated(any()); |
||||
|
|
||||
|
DiscussionCreateRequest request = new DiscussionCreateRequest(); |
||||
|
request.setContent("test"); |
||||
|
request.setColumnName("test"); |
||||
|
request.setTableName("test"); |
||||
|
int groupId = -999; |
||||
|
int projectId = -999; |
||||
|
int userId = -999; |
||||
|
documentDiscussionService.create(groupId, projectId, userId, request); |
||||
|
|
||||
|
var data = documentDiscussionDao.selectList(Tables.DOCUMENT_DISCUSSION.PROJECT_ID.eq(projectId)); |
||||
|
Assertions.assertEquals(1, data.size()); |
||||
|
verify(discussionEventSubscriber, times(1)).onDiscussionCreated(any()); |
||||
|
} |
||||
|
|
||||
|
@Test |
||||
|
void createWhenProjectNotExists() { |
||||
|
DiscussionCreateRequest request = new DiscussionCreateRequest(); |
||||
|
request.setContent("test"); |
||||
|
request.setColumnName("test"); |
||||
|
request.setTableName("test"); |
||||
|
int groupId = -1; |
||||
|
int projectId = -1; |
||||
|
int userId = -1; |
||||
|
Assertions.assertThrows(Forbidden.class, |
||||
|
() -> documentDiscussionService.create(groupId, projectId, userId, request)); |
||||
|
} |
||||
|
} |
@ -1,32 +1,160 @@ |
|||||
package com.databasir.core.domain.group.service; |
package com.databasir.core.domain.group.service; |
||||
|
|
||||
|
import com.databasir.common.DatabasirException; |
||||
|
import com.databasir.core.BaseTest; |
||||
|
import com.databasir.core.domain.DomainErrors; |
||||
|
import com.databasir.core.domain.group.data.GroupCreateRequest; |
||||
|
import com.databasir.core.domain.group.data.GroupMemberCreateRequest; |
||||
|
import com.databasir.core.domain.group.data.GroupUpdateRequest; |
||||
|
import com.databasir.core.infrastructure.constant.RoleConstants; |
||||
|
import com.databasir.dao.Tables; |
||||
|
import com.databasir.dao.impl.GroupDao; |
||||
|
import com.databasir.dao.impl.ProjectDao; |
||||
|
import com.databasir.dao.impl.ProjectSyncRuleDao; |
||||
|
import com.databasir.dao.impl.UserRoleDao; |
||||
|
import com.databasir.dao.tables.pojos.ProjectSyncRulePojo; |
||||
|
import com.databasir.dao.tables.pojos.UserRolePojo; |
||||
import org.junit.jupiter.api.Test; |
import org.junit.jupiter.api.Test; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.test.context.jdbc.Sql; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Objects; |
||||
|
import java.util.UUID; |
||||
|
import java.util.stream.Collectors; |
||||
|
|
||||
import static org.junit.jupiter.api.Assertions.*; |
import static org.junit.jupiter.api.Assertions.*; |
||||
|
|
||||
class GroupServiceTest { |
@Transactional |
||||
|
class GroupServiceTest extends BaseTest { |
||||
|
|
||||
|
@Autowired |
||||
|
private GroupService groupService; |
||||
|
|
||||
|
@Autowired |
||||
|
private UserRoleDao userRoleDao; |
||||
|
|
||||
|
@Autowired |
||||
|
private GroupDao groupDao; |
||||
|
|
||||
|
@Autowired |
||||
|
private ProjectDao projectDao; |
||||
|
|
||||
|
@Autowired |
||||
|
private ProjectSyncRuleDao projectSyncRuleDao; |
||||
|
|
||||
@Test |
@Test |
||||
void create() { |
void create() { |
||||
|
GroupCreateRequest request = new GroupCreateRequest(); |
||||
|
request.setName(UUID.randomUUID().toString()); |
||||
|
request.setDescription("group service test"); |
||||
|
request.setGroupOwnerUserIds(List.of(1, 2, 3)); |
||||
|
Integer groupId = groupService.create(request); |
||||
|
assertNotNull(groupId); |
||||
|
|
||||
|
List<UserRolePojo> roles = userRoleDao.selectByUserIds(List.of(1, 2, 3)) |
||||
|
.stream() |
||||
|
.filter(r -> Objects.equals(r.getGroupId(), groupId) && r.getRole().equals("GROUP_OWNER")) |
||||
|
.collect(Collectors.toList()); |
||||
|
assertEquals(3, roles.size()); |
||||
} |
} |
||||
|
|
||||
@Test |
@Test |
||||
|
@Sql("classpath:sql/domain/group/GroupUpdate.sql") |
||||
void update() { |
void update() { |
||||
|
int groupId = -999; |
||||
|
GroupUpdateRequest request = new GroupUpdateRequest(); |
||||
|
request.setId(groupId); |
||||
|
request.setName(UUID.randomUUID().toString()); |
||||
|
request.setDescription(UUID.randomUUID().toString()); |
||||
|
request.setGroupOwnerUserIds(List.of(1000, 1001)); |
||||
|
groupService.update(request); |
||||
|
|
||||
|
List<UserRolePojo> members = userRoleDao.selectList(Tables.USER_ROLE.GROUP_ID.eq(groupId)); |
||||
|
assertEquals(3, members.size()); |
||||
|
List<Integer> ownerUserIds = members.stream() |
||||
|
.filter(r -> r.getRole().equals("GROUP_OWNER")) |
||||
|
.map(UserRolePojo::getUserId) |
||||
|
.collect(Collectors.toList()); |
||||
|
assertEquals(2, ownerUserIds.size()); |
||||
|
assertTrue(ownerUserIds.contains(1000)); |
||||
|
assertTrue(ownerUserIds.contains(1001)); |
||||
} |
} |
||||
|
|
||||
@Test |
@Test |
||||
|
@Sql("classpath:sql/domain/group/GroupDelete.sql") |
||||
|
@SuppressWarnings("checkstyle:VariableDeclarationUsageDistance") |
||||
void delete() { |
void delete() { |
||||
|
int groupId = -999; |
||||
|
List<Integer> undeleteProjectIds = projectDao.selectProjectIdsByGroupId(groupId); |
||||
|
groupService.delete(groupId); |
||||
|
|
||||
|
// should clear all projects
|
||||
|
List<Integer> projectIds = projectDao.selectProjectIdsByGroupId(groupId); |
||||
|
assertEquals(0, projectIds.size()); |
||||
|
|
||||
|
// should clear group members
|
||||
|
List<UserRolePojo> members = userRoleDao.selectList(Tables.USER_ROLE.GROUP_ID.eq(groupId)); |
||||
|
assertEquals(0, members.size()); |
||||
|
|
||||
|
// should clear project sync schedule
|
||||
|
List<ProjectSyncRulePojo> syncRule = projectSyncRuleDao.selectInProjectIds(undeleteProjectIds); |
||||
|
assertTrue(syncRule.stream().allMatch(r -> !r.getIsAutoSync())); |
||||
} |
} |
||||
|
|
||||
@Test |
@Test |
||||
|
@Sql("classpath:sql/domain/group/MemberRemove.sql") |
||||
void removeMember() { |
void removeMember() { |
||||
|
int groupId = -999; |
||||
|
// remove group member
|
||||
|
assertTrue(userRoleDao.hasRole(-1, groupId)); |
||||
|
groupService.removeMember(groupId, -1); |
||||
|
assertFalse(userRoleDao.hasRole(-1, groupId)); |
||||
|
|
||||
|
// remove group owner
|
||||
|
assertTrue(userRoleDao.hasRole(-2, groupId)); |
||||
|
groupService.removeMember(groupId, -2); |
||||
|
assertFalse(userRoleDao.hasRole(-2, groupId)); |
||||
|
assertTrue(userRoleDao.hasRole(-2, -1000)); |
||||
} |
} |
||||
|
|
||||
@Test |
@Test |
||||
|
@Sql("classpath:sql/domain/group/MemberAdd.sql") |
||||
void addMember() { |
void addMember() { |
||||
|
int groupId = -999; |
||||
|
assertFalse(userRoleDao.hasRole(-1, groupId, RoleConstants.GROUP_MEMBER)); |
||||
|
|
||||
|
GroupMemberCreateRequest request = new GroupMemberCreateRequest(); |
||||
|
request.setRole(RoleConstants.GROUP_MEMBER); |
||||
|
request.setUserId(-1); |
||||
|
groupService.addMember(groupId, request); |
||||
|
|
||||
|
assertTrue(userRoleDao.hasRole(-1, groupId, RoleConstants.GROUP_MEMBER)); |
||||
} |
} |
||||
|
|
||||
@Test |
@Test |
||||
|
@Sql("classpath:sql/domain/group/MemberAdd.sql") |
||||
|
void addMemberWhenWasGroupMember() { |
||||
|
int groupId = -1000; |
||||
|
GroupMemberCreateRequest request = new GroupMemberCreateRequest(); |
||||
|
request.setRole(RoleConstants.GROUP_MEMBER); |
||||
|
request.setUserId(-2); |
||||
|
var err = assertThrows(DatabasirException.class, () -> groupService.addMember(groupId, request)); |
||||
|
assertEquals(DomainErrors.USER_ROLE_DUPLICATE.getErrCode(), err.getErrCode()); |
||||
|
} |
||||
|
|
||||
|
@Test |
||||
|
@Sql("classpath:sql/domain/group/MemberRoleChange.sql") |
||||
void changeMemberRole() { |
void changeMemberRole() { |
||||
|
int groupId = -999; |
||||
|
int userId = -1; |
||||
|
groupService.changeMemberRole(groupId, userId, RoleConstants.GROUP_MEMBER); |
||||
|
assertTrue(userRoleDao.hasRole(userId, groupId, RoleConstants.GROUP_MEMBER)); |
||||
|
|
||||
|
groupService.changeMemberRole(groupId, userId, RoleConstants.GROUP_OWNER); |
||||
|
assertTrue(userRoleDao.hasRole(userId, groupId, RoleConstants.GROUP_OWNER)); |
||||
|
List<UserRolePojo> roles = userRoleDao.selectByUserIds(List.of(userId)); |
||||
|
assertEquals(1, roles.size()); |
||||
} |
} |
||||
} |
} |
@ -0,0 +1,125 @@ |
|||||
|
package com.databasir.core.domain.project.service; |
||||
|
|
||||
|
import com.databasir.core.BaseTest; |
||||
|
import com.databasir.core.domain.project.data.DataSourcePropertyValue; |
||||
|
import com.databasir.core.domain.project.data.ProjectCreateRequest; |
||||
|
import com.databasir.core.domain.project.data.ProjectCreateRequest.DataSourceCreateRequest; |
||||
|
import com.databasir.core.domain.project.data.ProjectCreateRequest.ProjectSyncRuleCreateRequest; |
||||
|
import com.databasir.core.domain.project.data.ProjectTestConnectionRequest; |
||||
|
import com.databasir.core.domain.project.data.ProjectUpdateRequest; |
||||
|
import com.databasir.core.domain.project.data.ProjectUpdateRequest.ProjectSyncRuleUpdateRequest; |
||||
|
import com.databasir.core.infrastructure.connection.DatabaseTypes; |
||||
|
import com.databasir.dao.impl.ProjectDao; |
||||
|
import com.databasir.dao.impl.ProjectSyncRuleDao; |
||||
|
import com.databasir.dao.tables.pojos.ProjectSyncRulePojo; |
||||
|
import org.junit.jupiter.api.Assertions; |
||||
|
import org.junit.jupiter.api.Test; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.beans.factory.annotation.Value; |
||||
|
import org.springframework.test.context.jdbc.Sql; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
@Transactional |
||||
|
class ProjectServiceTest extends BaseTest { |
||||
|
|
||||
|
@Autowired |
||||
|
private ProjectService projectService; |
||||
|
|
||||
|
@Autowired |
||||
|
private ProjectDao projectDao; |
||||
|
|
||||
|
@Autowired |
||||
|
private ProjectSyncRuleDao projectSyncRuleDao; |
||||
|
|
||||
|
@Value("${databasir.db.username}") |
||||
|
private String dbUsername; |
||||
|
|
||||
|
@Value("${databasir.db.password}") |
||||
|
private String dbPassword; |
||||
|
|
||||
|
@Value("${databasir.db.url}") |
||||
|
private String dbUrl; |
||||
|
|
||||
|
@Test |
||||
|
void create() { |
||||
|
ProjectCreateRequest request = new ProjectCreateRequest(); |
||||
|
request.setName("ut"); |
||||
|
request.setDescription("integration test"); |
||||
|
request.setGroupId(-1000); |
||||
|
|
||||
|
DataSourceCreateRequest dataSource = new DataSourceCreateRequest(); |
||||
|
dataSource.setUsername("root"); |
||||
|
dataSource.setPassword("123456"); |
||||
|
dataSource.setUrl("localhost:3306"); |
||||
|
dataSource.setDatabaseName("databasir"); |
||||
|
dataSource.setSchemaName("databasir"); |
||||
|
dataSource.setDatabaseType(DatabaseTypes.MYSQL); |
||||
|
dataSource.setProperties(List.of(new DataSourcePropertyValue("useSSL", "false"))); |
||||
|
request.setDataSource(dataSource); |
||||
|
|
||||
|
ProjectSyncRuleCreateRequest syncRule = new ProjectSyncRuleCreateRequest(); |
||||
|
syncRule.setIgnoreTableNameRegexes(List.of("flywway.*", "demo.*")); |
||||
|
syncRule.setIgnoreColumnNameRegexes(List.of("id.*", "demo.*")); |
||||
|
syncRule.setIsAutoSync(true); |
||||
|
syncRule.setAutoSyncCron("0 0 0-23 0 0 ? *"); |
||||
|
request.setProjectSyncRule(syncRule); |
||||
|
|
||||
|
Integer id = projectService.create(request); |
||||
|
Assertions.assertNotNull(id); |
||||
|
} |
||||
|
|
||||
|
@Test |
||||
|
@Sql("classpath:sql/domain/project/Update.sql") |
||||
|
void update() { |
||||
|
ProjectUpdateRequest request = new ProjectUpdateRequest(); |
||||
|
request.setId(-1000); |
||||
|
request.setName("ut"); |
||||
|
request.setDescription("integration test"); |
||||
|
|
||||
|
var dataSource = new ProjectUpdateRequest.DataSourceUpdateRequest(); |
||||
|
dataSource.setUsername("root"); |
||||
|
dataSource.setPassword("123456"); |
||||
|
dataSource.setUrl("localhost:3306"); |
||||
|
dataSource.setDatabaseName("databasir"); |
||||
|
dataSource.setSchemaName("databasir"); |
||||
|
dataSource.setDatabaseType(DatabaseTypes.MYSQL); |
||||
|
dataSource.setProperties(List.of(new DataSourcePropertyValue("useSSL", "false"))); |
||||
|
request.setDataSource(dataSource); |
||||
|
|
||||
|
var syncRule = new ProjectSyncRuleUpdateRequest(); |
||||
|
syncRule.setIgnoreTableNameRegexes(List.of("flywway.*", "demo.*")); |
||||
|
syncRule.setIgnoreColumnNameRegexes(List.of("id.*", "demo.*")); |
||||
|
syncRule.setIsAutoSync(true); |
||||
|
syncRule.setAutoSyncCron("0 0 0-23 0 0 ? *"); |
||||
|
request.setProjectSyncRule(syncRule); |
||||
|
|
||||
|
projectService.update(-999, request); |
||||
|
} |
||||
|
|
||||
|
@Test |
||||
|
@Sql("classpath:sql/domain/project/Delete.sql") |
||||
|
void delete() { |
||||
|
int projectId = -1000; |
||||
|
projectService.delete(projectId); |
||||
|
Assertions.assertFalse(projectDao.existsById(projectId)); |
||||
|
ProjectSyncRulePojo syncRule = projectSyncRuleDao.selectByProjectId(projectId); |
||||
|
Assertions.assertNotNull(syncRule); |
||||
|
Assertions.assertNotNull(syncRule.getAutoSyncCron()); |
||||
|
Assertions.assertFalse(syncRule.getIsAutoSync()); |
||||
|
} |
||||
|
|
||||
|
@Test |
||||
|
void testConnection() { |
||||
|
ProjectTestConnectionRequest request = new ProjectTestConnectionRequest(); |
||||
|
request.setUsername(dbUsername); |
||||
|
request.setPassword(dbPassword); |
||||
|
request.setUrl(dbUrl); |
||||
|
request.setDatabaseName("databasir"); |
||||
|
request.setSchemaName("databasir"); |
||||
|
request.setDatabaseType(DatabaseTypes.MYSQL); |
||||
|
request.setProperties(List.of(new DataSourcePropertyValue("useSSL", "false"))); |
||||
|
projectService.testConnection(request); |
||||
|
} |
||||
|
} |
@ -0,0 +1,54 @@ |
|||||
|
package com.databasir.core.domain.user.service; |
||||
|
|
||||
|
import com.databasir.common.DatabasirException; |
||||
|
import com.databasir.core.BaseTest; |
||||
|
import com.databasir.core.domain.DomainErrors; |
||||
|
import com.databasir.dao.impl.UserFavoriteProjectDao; |
||||
|
import org.junit.jupiter.api.Assertions; |
||||
|
import org.junit.jupiter.api.Test; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.test.context.jdbc.Sql; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
@Transactional |
||||
|
class UserProjectServiceTest extends BaseTest { |
||||
|
|
||||
|
@Autowired |
||||
|
private UserProjectService userProjectService; |
||||
|
|
||||
|
@Autowired |
||||
|
private UserFavoriteProjectDao userFavoriteProjectDao; |
||||
|
|
||||
|
@Test |
||||
|
@Sql("classpath:sql/domain/user/AddFavorites.sql") |
||||
|
void addFavorites() { |
||||
|
int userId = 1; |
||||
|
int projectId = 999; |
||||
|
userProjectService.addFavorites(projectId, userId); |
||||
|
var data = userFavoriteProjectDao.selectByUserIdAndProjectIds(userId, List.of(projectId)); |
||||
|
Assertions.assertEquals(1, data.size()); |
||||
|
} |
||||
|
|
||||
|
@Test |
||||
|
void addFavoritesWhenProjectNotExists() { |
||||
|
DatabasirException ex = Assertions.assertThrows(DatabasirException.class, |
||||
|
() -> userProjectService.addFavorites(-999, 1)); |
||||
|
Assertions.assertEquals(DomainErrors.PROJECT_NOT_FOUND.getErrCode(), ex.getErrCode()); |
||||
|
} |
||||
|
|
||||
|
@Test |
||||
|
@Sql("classpath:sql/domain/user/RemoveFavorites.sql") |
||||
|
void removeFavorites() { |
||||
|
int projectId = 999; |
||||
|
int userId = 999; |
||||
|
// remove exists data
|
||||
|
userProjectService.removeFavorites(projectId, userId); |
||||
|
var data = userFavoriteProjectDao.selectByUserIdAndProjectIds(userId, List.of(projectId)); |
||||
|
Assertions.assertEquals(0, data.size()); |
||||
|
|
||||
|
// remove unknown data
|
||||
|
userProjectService.removeFavorites(-999, -999); |
||||
|
} |
||||
|
} |
@ -0,0 +1,4 @@ |
|||||
|
INSERT INTO databasir.database_type (id, database_type, icon, description, jdbc_driver_file_url, jdbc_driver_class_name, |
||||
|
jdbc_protocol, url_pattern) |
||||
|
VALUES (-1000, 'ut-mysql', '', 'system default mysql', 'N/A', 'com.mysql.cj.jdbc.Driver', 'jdbc:mysql', |
||||
|
'{{jdbc.protocol}}://{{db.url}}/{{db.name}}'); |
@ -0,0 +1,4 @@ |
|||||
|
INSERT INTO databasir.database_type (id, database_type, icon, description, jdbc_driver_file_url, jdbc_driver_class_name, |
||||
|
jdbc_protocol, url_pattern) |
||||
|
VALUES (-1000, 'ut-mysql', '', 'system default mysql', 'N/A', 'com.mysql.cj.jdbc.Driver', 'jdbc:mysql', |
||||
|
'{{jdbc.protocol}}://{{db.url}}/{{db.name}}'); |
@ -0,0 +1,4 @@ |
|||||
|
INSERT INTO databasir.database_type (id, database_type, icon, description, jdbc_driver_file_url, jdbc_driver_class_name, |
||||
|
jdbc_protocol, url_pattern) |
||||
|
VALUES (-1000, 'ut-mysql', '', 'system default mysql', 'N/A', 'com.mysql.cj.jdbc.Driver', 'jdbc:mysql', |
||||
|
'{{jdbc.protocol}}://{{db.url}}/{{db.name}}'); |
@ -0,0 +1,6 @@ |
|||||
|
INSERT INTO databasir.`group` (id, name, description, deleted, update_at, create_at) |
||||
|
VALUES (-999, '会员平台 ut', '会员平台', 0, '2022-03-06 02:10:40', '2022-03-06 02:10:40'); |
||||
|
|
||||
|
INSERT INTO databasir.project (id, name, description, group_id, deleted, deleted_token, create_at) |
||||
|
VALUES (-999, 'demo test', 'demo', -999, 0, 1, '2022-03-06 02:11:02'); |
||||
|
|
@ -0,0 +1,8 @@ |
|||||
|
INSERT INTO databasir.`group` (id, name, description, deleted, update_at, create_at) |
||||
|
VALUES (-999, '会员平台 ut', '会员平台', 0, '2022-03-06 02:10:40', '2022-03-06 02:10:40'); |
||||
|
|
||||
|
INSERT INTO databasir.project (id, name, description, group_id, deleted, deleted_token, create_at) |
||||
|
VALUES (-999, 'demo test', 'demo', -999, 0, 1, '2022-03-06 02:11:02'); |
||||
|
|
||||
|
INSERT INTO databasir.document_discussion(id, content, user_id, project_id, table_name, column_name) |
||||
|
VALUES (-999, 'demo test', -1, -999, 'ut', 'ut'); |
@ -0,0 +1,22 @@ |
|||||
|
INSERT INTO databasir.`group` (id, name, description, deleted, update_at, create_at) |
||||
|
VALUES (-999, '会员平台 ut', '会员平台', 0, '2022-03-06 02:10:40', '2022-03-06 02:10:40'); |
||||
|
|
||||
|
INSERT INTO databasir.user_role (user_id, role, group_id) |
||||
|
VALUES (1000, 'GROUP_OWNER', -999), |
||||
|
(1001, 'GROUP_OWNER', -999), |
||||
|
(1002, 'GROUP_OWNER', -999), |
||||
|
(1003, 'GROUP_OWNER', -999), |
||||
|
(1004, 'GROUP_MEMBER', -999); |
||||
|
|
||||
|
INSERT INTO databasir.project (id, name, description, group_id, deleted, deleted_token, create_at) |
||||
|
VALUES (-999, 'demo test', 'demo', -999, 0, 1, '2022-03-06 02:11:02'), |
||||
|
(-1000, 'demo test3', 'no member', -999, 0, 1, '2022-03-25 09:00:16'), |
||||
|
(-1001, 'demo test2', 'demo', -999, 0, 0, '2022-03-06 02:11:35'); |
||||
|
|
||||
|
|
||||
|
INSERT INTO databasir.project_sync_rule (project_id, ignore_table_name_regex_array, ignore_column_name_regex_array, |
||||
|
is_auto_sync, auto_sync_cron) |
||||
|
VALUES (-999, '[]', '[]', 1, '0 0/20 * * * ? '), |
||||
|
(-1000, '[]', '[]', 1, '0 0/20 * * * ? '), |
||||
|
(-1001, '[]', '[]', 1, '0 0/20 * * * ? '); |
||||
|
|
@ -0,0 +1,10 @@ |
|||||
|
INSERT INTO databasir.`group` (id, name, description, deleted, update_at, create_at) |
||||
|
VALUES (-999, '会员平台 ut', '会员平台', 0, '2022-03-06 02:10:40', '2022-03-06 02:10:40'), |
||||
|
(-1000, '商品中心 ut', '商品中心', 0, '2022-03-06 02:11:53', '2022-03-06 02:11:53'); |
||||
|
|
||||
|
INSERT INTO databasir.user_role (user_id, role, group_id) |
||||
|
VALUES (1000, 'GROUP_OWNER', -999), |
||||
|
(1001, 'GROUP_OWNER', -999), |
||||
|
(1002, 'GROUP_OWNER', -999), |
||||
|
(1003, 'GROUP_OWNER', -999), |
||||
|
(1004, 'GROUP_MEMBER', -999); |
@ -0,0 +1,7 @@ |
|||||
|
INSERT INTO databasir.`group` (id, name, description, deleted, update_at, create_at) |
||||
|
VALUES (-999, '会员平台 ut', '会员平台', 0, '2022-03-06 02:10:40', '2022-03-06 02:10:40'), |
||||
|
(-1000, '会员平台 ut2', '会员平台', 0, '2022-03-06 02:10:40', '2022-03-06 02:10:40'); |
||||
|
|
||||
|
INSERT INTO databasir.user_role (user_id, role, group_id) |
||||
|
VALUES (-2, 'GROUP_MEMBER', -999), |
||||
|
(-2, 'GROUP_OWNER', -1000); |
@ -0,0 +1,9 @@ |
|||||
|
INSERT INTO databasir.`group` (id, name, description, deleted, update_at, create_at) |
||||
|
VALUES (-999, '会员平台 ut', '会员平台', 0, '2022-03-06 02:10:40', '2022-03-06 02:10:40'), |
||||
|
(-1000, '会员平台 ut2', '会员平台', 0, '2022-03-06 02:10:40', '2022-03-06 02:10:40'); |
||||
|
|
||||
|
INSERT INTO databasir.user_role (user_id, role, group_id) |
||||
|
VALUES (-1, 'SYS_OWNER', NULL), |
||||
|
(-1, 'GROUP_OWNER', -999), |
||||
|
(-2, 'GROUP_MEMBER', -999), |
||||
|
(-2, 'GROUP_OWNER', -1000); |
@ -0,0 +1,5 @@ |
|||||
|
INSERT INTO databasir.`group` (id, name, description, deleted, update_at, create_at) |
||||
|
VALUES (-999, '会员平台 ut', '会员平台', 0, '2022-03-06 02:10:40', '2022-03-06 02:10:40'); |
||||
|
|
||||
|
INSERT INTO databasir.user_role (user_id, role, group_id) |
||||
|
VALUES (-1, 'GROUP_OWNER', -999); |
@ -0,0 +1,10 @@ |
|||||
|
INSERT INTO databasir.`group` (id, name, description, deleted, update_at, create_at) |
||||
|
VALUES (-999, '会员平台 ut', '会员平台', 0, '2022-03-06 02:10:40', '2022-03-06 02:10:40'); |
||||
|
|
||||
|
INSERT INTO databasir.project (id, name, description, group_id, deleted, deleted_token, create_at) |
||||
|
VALUES (-1000, 'demo test2', 'demo', -999, 0, 0, '2022-03-06 02:11:35'); |
||||
|
|
||||
|
INSERT INTO databasir.project_sync_rule (project_id, ignore_table_name_regex_array, ignore_column_name_regex_array, |
||||
|
is_auto_sync, auto_sync_cron) |
||||
|
VALUES (-1000, '[]', '[]', 1, '0 0/20 * * * ? '); |
||||
|
|
@ -0,0 +1,15 @@ |
|||||
|
INSERT INTO databasir.`group` (id, name, description, deleted, update_at, create_at) |
||||
|
VALUES (-999, '会员平台 ut', '会员平台', 0, '2022-03-06 02:10:40', '2022-03-06 02:10:40'); |
||||
|
|
||||
|
INSERT INTO databasir.project (id, name, description, group_id, deleted, deleted_token, create_at) |
||||
|
VALUES (-1000, 'demo test2', 'demo', -999, 0, 0, '2022-03-06 02:11:35'); |
||||
|
|
||||
|
INSERT INTO databasir.project_sync_rule (project_id, ignore_table_name_regex_array, ignore_column_name_regex_array, |
||||
|
is_auto_sync, auto_sync_cron) |
||||
|
VALUES (-1000, '[]', '[]', 0, '0 0/20 * * * ? '); |
||||
|
|
||||
|
INSERT INTO databasir.data_source(id, project_id, database_name, schema_name, database_type, url, username, password) |
||||
|
VALUES (-1000, -1000, 'databasir', 'databasir', 'mysql', 'localhost:3306', 'root', '123456'); |
||||
|
|
||||
|
INSERT INTO databasir.data_source_property(data_source_id, `key`, value) |
||||
|
VALUES (-1000, 'useSSL', 'true') |
@ -0,0 +1,2 @@ |
|||||
|
INSERT IGNORE INTO databasir.project (id, NAME, DESCRIPTION, group_id, deleted, deleted_token, create_at) |
||||
|
VALUES (999, 'addFavoritesTest', 'demo', 1, 0, 1, '2022-03-06 02:11:02'); |
@ -1,4 +1,6 @@ |
|||||
INSERT IGNORE INTO databasir.user (id, email, username, password, nickname, avatar, enabled) |
INSERT IGNORE INTO databasir.user (id, email, username, password, nickname, avatar, enabled) |
||||
VALUES (1, 'N/A', 'databasir', '$2a$10$8Wjfdbbk76jDNbQ0zKq', 'Databasir Admin', NULL, 1), |
VALUES (-998, 'sysOwner@databasir.com', 'sysOwner', '$2a$10$wXPDzPceCXeU1PLXGKRAEW', 'a', NULL, 1), |
||||
(2, 'sysOwner@databasir.com', 'sysOwner', '$2a$10$wXPDzPceCXeU1PLXGKRAEW', 'a', NULL, 1), |
(-999, 'notSysOwner@databasir.com', 'notSysOwner', '$2a$10$wXPDzPceU1PLXGKRAEW', 'b', NULL, 1); |
||||
(3, 'notSysOwner@databasir.com', 'notSysOwner', '$2a$10$wXPDzPceU1PLXGKRAEW', 'b', NULL, 1); |
|
||||
|
INSERT IGNORE INTO databasir.user_role (user_id, role, group_id, create_at) |
||||
|
VALUES (-998, 'SYS_OWNER', NULL, '2022-03-06 02:05:30'); |
||||
|
@ -0,0 +1,4 @@ |
|||||
|
INSERT IGNORE INTO databasir.user_favorite_project (user_id, project_id, create_at) |
||||
|
VALUES (999, 999, '2022-03-06 10:25:47'), |
||||
|
(999, 1000, '2022-03-10 09:13:30'); |
||||
|
|
@ -0,0 +1,6 @@ |
|||||
|
INSERT IGNORE INTO databasir.user (id, email, username, password, nickname, avatar, enabled) |
||||
|
VALUES (-998, 'sysOwner@databasir.com', 'sysOwner', '$2a$10$wXPDzPceCXeU1PLXGKRAEW', 'a', NULL, 1), |
||||
|
(-999, 'notSysOwner@databasir.com', 'notSysOwner', '$2a$10$wXPDzPceU1PLXGKRAEW', 'b', NULL, 1); |
||||
|
|
||||
|
INSERT IGNORE INTO databasir.user_role (user_id, role, group_id, create_at) |
||||
|
VALUES (-998, 'SYS_OWNER', NULL, '2022-03-06 02:05:30'); |
@ -1,3 +1,3 @@ |
|||||
INSERT IGNORE INTO databasir.user (id, email, username, password, nickname, avatar, enabled) |
INSERT IGNORE INTO databasir.user (id, email, username, password, nickname, avatar, enabled) |
||||
VALUES (1, 'N/A', 'databasir', '$2a$10$8WjfdbbDpzvkz5Rc.8TBk76jDNbQ0zKq', 'Databasir Admin', NULL, 1), |
VALUES (-1, 'N/A', 'databasir', '$2a$10$8WjfdbbDpzvkz5Rc.8TBk76jDNbQ0zKq', 'Databasir Admin', NULL, 1), |
||||
(2, 'vran@databasir.com', 'vran', '$2a$10$wXPDzPceCpqYErlZ3DRh.gOpgXXeU1PLXGKRAEW', 'vranssss', NULL, 1); |
(-2, 'vran@databasir.com', 'vran', '$2a$10$wXPDzPceCpqYErlZ3DRh.gOpgXXeU1PLXGKRAEW', 'vranssss', NULL, 1); |
@ -1,7 +1,6 @@ |
|||||
INSERT IGNORE INTO databasir.user (id, email, username, password, nickname, avatar, enabled) |
INSERT IGNORE INTO databasir.user (id, email, username, password, nickname, avatar, enabled) |
||||
VALUES (1, 'N/A', 'databasir', '$2a$10$8WjfdbbDpzvkz5Rc.8TBk76jDNbQ0zKq', 'Databasir Admin', NULL, 1), |
VALUES (-999, 'vran@databasir.com', 'vran', '$2a$10$wXPDzPceCpqYErlZ3DRh.gOpgXXeU1PLXGKRAEW', 'vranssss', NULL, 1); |
||||
(2, 'vran@databasir.com', 'vran', '$2a$10$wXPDzPceCpqYErlZ3DRh.gOpgXXeU1PLXGKRAEW', 'vranssss', NULL, 1); |
|
||||
|
|
||||
INSERT IGNORE INTO databasir.login (user_id, access_token, refresh_token, access_token_expire_at, |
INSERT IGNORE INTO databasir.login (user_id, access_token, refresh_token, access_token_expire_at, |
||||
refresh_token_expire_at) |
refresh_token_expire_at) |
||||
VALUES (2, 'eyJ0eXAiOiJKV1QM', '1a884c14ef6542ce0261', '2022-03-12 20:24:28', '2022-03-27 20:09:29'); |
VALUES (-999, 'eyJ0eXAiOiJKV1QM', '1a884c14ef6542ce0261', '2022-03-12 20:24:28', '2022-03-27 20:09:29'); |
||||
|
@ -0,0 +1,7 @@ |
|||||
|
INSERT IGNORE INTO databasir.login (user_id, access_token, refresh_token, access_token_expire_at, |
||||
|
refresh_token_expire_at) |
||||
|
VALUES (-999, 'eyJ0eXAiOiJKV1QM', '1a884c14ef6542ce0261', '2022-03-12 20:24:28', '2022-03-27 20:09:29'); |
||||
|
|
||||
|
INSERT IGNORE INTO databasir.user (id, email, username, password, nickname, avatar, enabled) |
||||
|
VALUES (-999, 'demo2@databasir.com', 'demo2', '$2a$10$KTi5HBIBURn/5h9d7sp2DeIxK4T03vlh34dSwyJphjeNBRGWTzEDK', 'demo2', |
||||
|
NULL, 1); |
@ -0,0 +1,7 @@ |
|||||
|
INSERT INTO databasir.login (user_id, access_token, refresh_token, access_token_expire_at, |
||||
|
refresh_token_expire_at) |
||||
|
VALUES (-999, 'eyJ0eXAiOiJKV1QM', '1a884c14ef6542ce0261', '2022-03-12 20:24:28', '2022-03-27 20:09:29'); |
||||
|
|
||||
|
INSERT INTO databasir.user (id, email, username, password, nickname, avatar, enabled, update_at, create_at) |
||||
|
VALUES (-999, 'demo2@databasir.com', 'demo2', '$2a$10$KTi5HBIBURn/5h9d7sp2DeIxK4T03vlh34dSwyJphjeNBRGWTzEDK', 'demo2', |
||||
|
NULL, 1, '2022-03-25 15:02:49', '2022-03-25 15:02:49'); |
@ -1,22 +1,22 @@ |
|||||
INSERT IGNORE INTO databasir.user (id, email, username, password, nickname, avatar, enabled) |
INSERT INTO databasir.user (id, email, username, password, nickname, avatar, enabled) |
||||
VALUES (1, 'N/A', 'databasir', '$2a$10$8WjfdbbDpzvkz5Rc.8TBk76jDNbQ0zKq', 'Databasir Admin', NULL, 1), |
VALUES (-1, 'jack@databasir.com', 'jack', '$2a$10$8WjfdbbDpzvkz5Rc.8TBk76jDNbQ0zKq', 'Databasir Admin', NULL, 1), |
||||
(2, 'vran@databasir.com', 'vran', '$2a$10$wXPDzPceCpqYErlZ3DRh.gOpgXXeU1PLXGKRAEW', 'vranssss', NULL, 1), |
(-2, 'vran@databasir.com', 'vran', '$2a$10$wXPDzPceCpqYErlZ3DRh.gOpgXXeU1PLXGKRAEW', 'vranssss', NULL, 1), |
||||
(3, 'test@databasir.com', 'test', '$2a$10$XbnZlQB26cKKGB4WLlgZxxwbUr9tD1Amn/3Tf5H0i', 'test', NULL, 1), |
(-3, 'test@databasir.com', 'test', '$2a$10$XbnZlQB26cKKGB4WLlgZxxwbUr9tD1Amn/3Tf5H0i', 'test', NULL, 1), |
||||
(4, 'sample@databasir.com', 'sample', '$2a$10$Ua0zrJ7.HDb6ZIRNWb7fCJiG2OZRTN1.', 'sample', NULL, 1), |
(-4, 'sample@databasir.com', 'sample', '$2a$10$Ua0zrJ7.HDb6ZIRNWb7fCJiG2OZRTN1.', 'sample', NULL, 1), |
||||
(5, 'demo@databasir.com', 'demo', '$2a$10$J4JT19JBO3LpWAvRARDxieFtm/pFQtna.dDq', 'demo', NULL, 0); |
(-5, 'demo@databasir.com', 'demo', '$2a$10$J4JT19JBO3LpWAvRARDxieFtm/pFQtna.dDq', 'demo', NULL, 0); |
||||
|
|
||||
INSERT IGNORE INTO databasir.project (id, name, description, group_id, deleted, deleted_token) |
INSERT INTO databasir.project (id, name, description, group_id, deleted, deleted_token) |
||||
VALUES (1, 'demo', 'demo', 1, 0, 1), |
VALUES (-1, 'demo', 'demo', 1, 0, 1), |
||||
(2, 'no member', 'no member', 1, 0, 1); |
(-2, 'no member', 'no member', 1, 0, 1); |
||||
|
|
||||
INSERT IGNORE INTO databasir.`group` (id, name, description, deleted) |
INSERT INTO databasir.`group` (id, name, description, deleted) |
||||
VALUES (1, '会员平台', '会员平台', 0), |
VALUES (-1, '会员平台', '会员平台', 0), |
||||
(2, '成员为空', '会员平台', 0); |
(-2, '成员为空', '会员平台', 0); |
||||
|
|
||||
INSERT IGNORE INTO databasir.user_role (user_id, role, group_id) |
INSERT INTO databasir.user_role (user_id, role, group_id) |
||||
VALUES (1, 'SYS_OWNER', NULL), |
VALUES (-1, 'SYS_OWNER', NULL), |
||||
(1, 'GROUP_OWNER', 1), |
(-1, 'GROUP_OWNER', 1), |
||||
(2, 'GROUP_OWNER', 1), |
(-2, 'GROUP_OWNER', 1), |
||||
(3, 'GROUP_MEMBER', 1), |
(-3, 'GROUP_MEMBER', 1), |
||||
(4, 'GROUP_OWNER', 1), |
(-4, 'GROUP_OWNER', 1), |
||||
(5, 'GROUP_OWNER', 1); |
(-5, 'GROUP_OWNER', 1); |
||||
|
@ -1,7 +1,3 @@ |
|||||
INSERT IGNORE INTO databasir.user (id, email, username, password, nickname, avatar, enabled) |
INSERT INTO databasir.user (id, email, username, password, nickname, avatar, enabled) |
||||
VALUES (1, 'N/A', 'databasir', '$2a$10$8WjfdbbDpzvkz5Rc.8TBk76jDNbQ0zKq', 'Databasir Admin', NULL, 1), |
VALUES (-999, 'vran@databasir.com', 'vran', '$2a$10$wXPDzPceCpqYErlZ3DRh.gOpgXXeU1PLXGKRAEW', 'vranssss', NULL, 1); |
||||
(2, 'vran@databasir.com', 'vran', '$2a$10$wXPDzPceCpqYErlZ3DRh.gOpgXXeU1PLXGKRAEW', 'vranssss', NULL, 1), |
|
||||
(3, 'test@databasir.com', 'test', '$2a$10$XbnZlQB26cKKGB4WLlgZxxwbUr9tD1Amn/3Tf5H0i', 'test', NULL, 1), |
|
||||
(4, 'sample@databasir.com', 'sample', '$2a$10$Ua0zrJ7.HDb6ZIRNWb7fCJiG2OZRTN1.', 'sample', NULL, 1), |
|
||||
(5, 'demo@databasir.com', 'demo', '$2a$10$J4JT19JBO3LpWAvRARDxieFtm/pFQtna.dDq', 'demo', NULL, 0); |
|
||||
|
|
||||
|
Loading…
Reference in new issue