temp comment out classes not referred to in unit tests

This commit is contained in:
Paul Campbell 2018-05-31 23:17:12 +01:00
parent f6aeb1fbb6
commit fa9481704a
10 changed files with 110 additions and 121 deletions

View file

@ -1,17 +1,17 @@
package net.kemitix.gitdb; package net.kemitix.gitdb;
import lombok.Getter; //import lombok.Getter;
import lombok.RequiredArgsConstructor; //import lombok.RequiredArgsConstructor;
@RequiredArgsConstructor //@RequiredArgsConstructor
public class Author { //public class Author {
//
@Getter // @Getter
private final String name; // private final String name;
@Getter // @Getter
private final String email; // private final String email;
//
public static Author name(final String name, final String email) { // public static Author name(final String name, final String email) {
return new Author(name, email); // return new Author(name, email);
} // }
} //}

View file

@ -1,13 +1,13 @@
package net.kemitix.gitdb; package net.kemitix.gitdb;
import net.kemitix.mon.TypeAlias; //import net.kemitix.mon.TypeAlias;
public class Branch extends TypeAlias<String> { //public class Branch extends TypeAlias<String> {
protected Branch(final String value) { // protected Branch(final String value) {
super(value); // super(value);
} // }
//
static Branch name(final String name) { // static Branch name(final String name) {
return new Branch(name); // return new Branch(name);
} // }
} //}

View file

@ -1,18 +1,18 @@
package net.kemitix.gitdb; package net.kemitix.gitdb;
import lombok.Getter; //import lombok.Getter;
import lombok.RequiredArgsConstructor; //import lombok.RequiredArgsConstructor;
@RequiredArgsConstructor //@RequiredArgsConstructor
public class Document<T> { //public class Document<T> {
//
public static <T> Document<T> create(Key key, T value) { // public static <T> Document<T> create(Key key, T value) {
return new Document<>(key, value); // return new Document<>(key, value);
} // }
//
@Getter // @Getter
private final Key key; // private final Key key;
//
@Getter // @Getter
private final T value; // private final T value;
} //}

View file

@ -3,22 +3,11 @@ package net.kemitix.gitdb;
import org.eclipse.jgit.api.Git; import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.api.errors.GitAPIException; import org.eclipse.jgit.api.errors.GitAPIException;
import java.io.Closeable;
import java.io.IOException;
import java.nio.file.Path; import java.nio.file.Path;
import java.util.stream.Stream;
public interface GitDB extends Closeable { public interface GitDB
// extends Closeable
/** {
* Open an existing local gitdb.
*
* @param dbDir the path to the local repo
* @return a GitDB instance for the local gitdb
*/
static GitDB local(final Path dbDir) throws IOException {
return new GitDBLocal(Git.open(dbDir.toFile()));
}
/** /**
* Initialise a new local gitdb. * Initialise a new local gitdb.
@ -33,15 +22,25 @@ public interface GitDB extends Closeable {
.call()); .call());
} }
/** // /**
* Select a branch. // * Open an existing local gitdb.
* // *
* @param branch the branch to select // * @param dbDir the path to the local repo
* @return a branch within the gitdb // * @return a GitDB instance for the local gitdb
*/ // */
GitDbBranch branch(Branch branch); // static GitDB local(final Path dbDir) throws IOException {
// return new GitDBLocal(Git.open(dbDir.toFile()));
// }
interface GitDbBranch { // /**
// * Select a branch.
// *
// * @param branch the branch to select
// * @return a branch within the gitdb
// */
// GitDbBranch branch(Branch branch);
// interface GitDbBranch {
// String get(Key key); // String get(Key key);
// //
@ -57,8 +56,8 @@ public interface GitDB extends Closeable {
// //
// GitDbBranch fork(Branch branch); // GitDbBranch fork(Branch branch);
} // }
Stream<Branch> allBranches(); // Stream<Branch> allBranches();
} }

View file

@ -1,36 +1,27 @@
package net.kemitix.gitdb; package net.kemitix.gitdb;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import org.eclipse.jgit.api.Git; import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.api.errors.GitAPIException;
import org.eclipse.jgit.lib.*;
import org.eclipse.jgit.storage.file.FileRepositoryBuilder;
import java.io.*;
import java.nio.file.Path;
import java.util.Optional;
import java.util.stream.Stream;
@RequiredArgsConstructor @RequiredArgsConstructor
class GitDBLocal implements GitDB { class GitDBLocal implements GitDB {
private final Git git; private final Git git;
@Override // @Override
public void close() { // public void close() {
git.close(); // git.close();
} // }
@Override // @Override
public GitDbBranch branch(Branch branch) { // public GitDbBranch branch(Branch branch) {
return null; // return null;
} // }
//
@Override // @Override
public Stream<Branch> allBranches() { // public Stream<Branch> allBranches() {
return null; // return null;
} // }
// @Override // @Override
// public String get(Branch branch, Key key) { // public String get(Branch branch, Key key) {

View file

@ -1,13 +1,13 @@
package net.kemitix.gitdb; package net.kemitix.gitdb;
import net.kemitix.mon.TypeAlias; //import net.kemitix.mon.TypeAlias;
public class Key extends TypeAlias<String> { //public class Key extends TypeAlias<String> {
protected Key(final String value) { // protected Key(final String value) {
super(value); // super(value);
} // }
//
public static Key name(final String name) { // public static Key name(final String name) {
return new Key(name); // return new Key(name);
} // }
} //}

View file

@ -1,12 +1,12 @@
package net.kemitix.gitdb; package net.kemitix.gitdb;
import net.kemitix.mon.TypeAlias; //import net.kemitix.mon.TypeAlias;
public class Message extends TypeAlias<String> { //public class Message extends TypeAlias<String> {
protected Message(final String value) { // protected Message(final String value) {
super(value); // super(value);
} // }
public static Message message(final String message) { // public static Message message(final String message) {
return new Message(message); // return new Message(message);
} // }
} //}

View file

@ -1,9 +1,9 @@
package net.kemitix.gitdb; package net.kemitix.gitdb;
import net.kemitix.mon.TypeAlias; //import net.kemitix.mon.TypeAlias;
public class Reference extends TypeAlias<String> { //public class Reference extends TypeAlias<String> {
protected Reference(String value) { // protected Reference(String value) {
super(value); // super(value);
} // }
} //}

View file

@ -1,9 +1,9 @@
package net.kemitix.gitdb; package net.kemitix.gitdb;
import net.kemitix.mon.TypeAlias; //import net.kemitix.mon.TypeAlias;
public class Transaction extends TypeAlias<String> { //public class Transaction extends TypeAlias<String> {
protected Transaction(String value) { // protected Transaction(String value) {
super(value); // super(value);
} // }
} //}

View file

@ -8,16 +8,15 @@ import java.nio.file.DirectoryStream;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.util.List; import java.util.List;
import java.util.UUID;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
class GitDBTest { class GitDBTest {
private final Branch master = Branch.name("master"); // private final Branch master = Branch.name("master");
private final Message message = Message.message(UUID.randomUUID().toString()); // private final Message message = Message.message(UUID.randomUUID().toString());
private final Key key = Key.name(UUID.randomUUID().toString()); // private final Key key = Key.name(UUID.randomUUID().toString());
private final Author author = Author.name("junit", "gitdb@kemitix.net"); // private final Author author = Author.name("junit", "gitdb@kemitix.net");
// When initialising a repo in a dir that doesn't exist then a bare repo is created // When initialising a repo in a dir that doesn't exist then a bare repo is created
@Test @Test