Search in sources :

Example 1 with GitRepository

use of org.platformlayer.service.git.model.GitRepository in project platformlayer by platformlayer.

the class GitRepositoryDirectory method addChildren.

@Override
protected void addChildren() throws OpsException {
    GitRepository model = OpsContext.get().getInstance(GitRepository.class);
    File gitBase = new File("/var/git");
    File repoDir = new File(gitBase, model.name);
    {
        ManagedDirectory dir = ManagedDirectory.build(repoDir, "755");
        addChild(dir);
    }
    {
        GitRepoInit initRepo = injected(GitRepoInit.class);
        initRepo.repoDir = repoDir;
        addChild(initRepo);
    }
    {
        BackupDirectory backup = injected(BackupDirectory.class);
        backup.itemKey = model.getKey();
        backup.backupRoot = repoDir;
        addChild(backup);
    }
}
Also used : GitRepository(org.platformlayer.service.git.model.GitRepository) BackupDirectory(org.platformlayer.ops.backups.BackupDirectory) ManagedDirectory(org.platformlayer.ops.filesystem.ManagedDirectory) File(java.io.File)

Example 2 with GitRepository

use of org.platformlayer.service.git.model.GitRepository in project platformlayer by platformlayer.

the class ITGitService method testCreateAndDeleteItem.

@Test
public void testCreateAndDeleteItem() throws Exception {
    OpenLdapTestHelpers openLdap = new OpenLdapTestHelpers(getContext());
    LdapService ldapService = openLdap.createLdapServer();
    openFirewall(ldapService, LdapServiceController.PORT);
    String organizationName = "test.platformlayer.org";
    LdapDomain ldapDomain = openLdap.createLdapDomain(ldapService, organizationName);
    String id = "git" + random.randomAlphanumericString(8);
    GitService service = new GitService();
    service.dnsName = id + ".test.platformlayer.org";
    service.ldapGroup = "ou=Git Users,dc=test,dc=platformlayer,dc=org";
    service = putItem(id, service);
    service = waitForHealthy(service);
    InetSocketAddress socketAddress = getUniqueEndpoint(service);
    Assert.assertFalse(isPortOpen(socketAddress));
    openFirewall(service, GitServerController.PORT);
    Assert.assertTrue(isPortOpen(socketAddress));
    String repoId = "repo" + id;
    GitRepository repo = new GitRepository();
    repo.name = repoId;
    repo = putItem(repoId, repo);
    repo = waitForHealthy(repo);
    // TODO: Make endpoint http://<ip>:<port>/<path>...
    String url = "http://" + socketAddress.getAddress().getHostAddress() + ":" + socketAddress.getPort() + "/git/" + repoId;
    String username = null;
    String password = null;
    testGitRepo(url, username, password);
}
Also used : GitRepository(org.platformlayer.service.git.model.GitRepository) LdapDomain(org.platformlayer.service.openldap.model.LdapDomain) InetSocketAddress(java.net.InetSocketAddress) GitService(org.platformlayer.service.git.model.GitService) OpenLdapTestHelpers(org.platformlayer.service.openldap.tests.OpenLdapTestHelpers) LdapService(org.platformlayer.service.openldap.model.LdapService) Test(org.testng.annotations.Test) PlatformLayerApiTest(org.platformlayer.tests.PlatformLayerApiTest)

Aggregations

GitRepository (org.platformlayer.service.git.model.GitRepository)2 File (java.io.File)1 InetSocketAddress (java.net.InetSocketAddress)1 BackupDirectory (org.platformlayer.ops.backups.BackupDirectory)1 ManagedDirectory (org.platformlayer.ops.filesystem.ManagedDirectory)1 GitService (org.platformlayer.service.git.model.GitService)1 LdapDomain (org.platformlayer.service.openldap.model.LdapDomain)1 LdapService (org.platformlayer.service.openldap.model.LdapService)1 OpenLdapTestHelpers (org.platformlayer.service.openldap.tests.OpenLdapTestHelpers)1 PlatformLayerApiTest (org.platformlayer.tests.PlatformLayerApiTest)1 Test (org.testng.annotations.Test)1