Search in sources :

Example 1 with RepositoryDao

use of com.walmartlabs.concord.server.org.project.RepositoryDao in project concord by walmartlabs.

the class SecretDaoTest method testOnCascade.

@Test
public void testOnCascade() {
    UUID orgId = OrganizationManager.DEFAULT_ORG_ID;
    String projectName = "project#" + System.currentTimeMillis();
    ProjectDao projectDao = new ProjectDao(getConfiguration(), new ConcordObjectMapper(TestObjectMapper.INSTANCE));
    UUID projectId = projectDao.insert(orgId, projectName, "test", null, null, null, null, new byte[0], null, null);
    String secretName = "secret#" + System.currentTimeMillis();
    SecretDao secretDao = new SecretDao(getConfiguration());
    UUID secretId = secretDao.insert(orgId, null, secretName, null, SecretType.KEY_PAIR, SecretEncryptedByType.SERVER_KEY, "concord", SecretVisibility.PUBLIC, INSERT);
    secretDao.updateData(secretId, new byte[] { 0, 1, 2 });
    secretDao.update(secretId, secretName, UUID.fromString("4b9d496a-c3a0-4e1b-804c-ac3fccddcb27"), null, new byte[0], null, projectId, orgId);
    String repoName = "repo#" + System.currentTimeMillis();
    RepositoryDao repositoryDao = new RepositoryDao(getConfiguration(), new ConcordObjectMapper(TestObjectMapper.INSTANCE));
    UUID repoId = repositoryDao.insert(projectId, repoName, "n/a", null, null, null, secretId, false, null, false);
    // ---
    secretDao.delete(secretId);
    // ---
    RepositoryEntry r = repositoryDao.get(projectId, repoId);
    assertNotNull(r);
    assertNull(r.getSecretName());
}
Also used : RepositoryDao(com.walmartlabs.concord.server.org.project.RepositoryDao) ConcordObjectMapper(com.walmartlabs.concord.server.ConcordObjectMapper) RepositoryEntry(com.walmartlabs.concord.server.org.project.RepositoryEntry) UUID(java.util.UUID) ProjectDao(com.walmartlabs.concord.server.org.project.ProjectDao) SecretDao(com.walmartlabs.concord.server.org.secret.SecretDao) Test(org.junit.jupiter.api.Test) AbstractDaoTest(com.walmartlabs.concord.server.AbstractDaoTest)

Example 2 with RepositoryDao

use of com.walmartlabs.concord.server.org.project.RepositoryDao in project concord by walmartlabs.

the class ProjectDaoTest method setUp.

@BeforeEach
public void setUp() {
    repositoryDao = new RepositoryDao(getConfiguration(), new ConcordObjectMapper(TestObjectMapper.INSTANCE));
    projectDao = new ProjectDao(getConfiguration(), new ConcordObjectMapper(TestObjectMapper.INSTANCE));
}
Also used : RepositoryDao(com.walmartlabs.concord.server.org.project.RepositoryDao) ConcordObjectMapper(com.walmartlabs.concord.server.ConcordObjectMapper) ProjectDao(com.walmartlabs.concord.server.org.project.ProjectDao) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

ConcordObjectMapper (com.walmartlabs.concord.server.ConcordObjectMapper)2 ProjectDao (com.walmartlabs.concord.server.org.project.ProjectDao)2 RepositoryDao (com.walmartlabs.concord.server.org.project.RepositoryDao)2 AbstractDaoTest (com.walmartlabs.concord.server.AbstractDaoTest)1 RepositoryEntry (com.walmartlabs.concord.server.org.project.RepositoryEntry)1 SecretDao (com.walmartlabs.concord.server.org.secret.SecretDao)1 UUID (java.util.UUID)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1 Test (org.junit.jupiter.api.Test)1