diff --git a/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/JGitFileSystemProvider.java b/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/JGitFileSystemProvider.java index 5867153a68..fa30050481 100644 --- a/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/JGitFileSystemProvider.java +++ b/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/JGitFileSystemProvider.java @@ -53,8 +53,6 @@ import org.eclipse.jgit.diff.DiffEntry; import org.eclipse.jgit.errors.RepositoryNotFoundException; -import org.eclipse.jgit.internal.ketch.KetchLeaderCache; -import org.eclipse.jgit.internal.ketch.KetchSystem; import org.eclipse.jgit.internal.storage.file.WindowCache; import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.Ref; @@ -140,14 +138,7 @@ import org.uberfire.java.nio.fs.jgit.util.ProxyAuthenticator; import org.uberfire.java.nio.fs.jgit.util.commands.Clone; import org.uberfire.java.nio.fs.jgit.util.commands.PathUtil; -import org.uberfire.java.nio.fs.jgit.util.model.CommitContent; -import org.uberfire.java.nio.fs.jgit.util.model.CommitInfo; -import org.uberfire.java.nio.fs.jgit.util.model.CopyCommitContent; -import org.uberfire.java.nio.fs.jgit.util.model.DefaultCommitContent; -import org.uberfire.java.nio.fs.jgit.util.model.MoveCommitContent; -import org.uberfire.java.nio.fs.jgit.util.model.PathInfo; -import org.uberfire.java.nio.fs.jgit.util.model.PathType; -import org.uberfire.java.nio.fs.jgit.util.model.RevertCommitContent; +import org.uberfire.java.nio.fs.jgit.util.model.*; import org.uberfire.java.nio.fs.jgit.ws.JGitFileSystemsEventsManager; import org.uberfire.java.nio.fs.jgit.ws.JGitWatchEvent; import org.uberfire.java.nio.security.FileSystemAuthorizer; @@ -185,8 +176,6 @@ public class JGitFileSystemProvider implements SecuredFileSystemProvider, private static final Logger LOG = LoggerFactory.getLogger(JGitFileSystemProvider.class); private static final TimeUnit LOCK_LAST_ACCESS_TIME_UNIT = TimeUnit.SECONDS; private static final long LOCK_LAST_ACCESS_THRESHOLD = 10; - final KetchSystem system = new KetchSystem(); - final KetchLeaderCache leaders = new KetchLeaderCache(system); private final Map fullHostNames = new HashMap<>(); private final Object postponedEventsLock = new Object(); private final ExecutorService executorService; @@ -511,8 +500,7 @@ void buildAndStartDaemon() { daemonService = new Daemon(new InetSocketAddress(config.getDaemonHostAddr(), config.getDaemonPort()), new ExecutorWrapper(executorService), - executorService, - config.isEnableKetch() ? leaders : null); + executorService); daemonService.setRepositoryResolver(new RepositoryResolverImpl<>()); try { daemonService.start(); @@ -632,11 +620,6 @@ public FileSystem newFileSystem(final URI uri, } } - if (config.isEnableKetch()) { - createNewGitRepo(env, - fsName).enableKetch(); - } - if (config.isDaemonEnabled() && daemonService != null && !daemonService.isRunning()) { buildAndStartDaemon(); } @@ -728,7 +711,6 @@ protected Git createNewGitRepo(Map env, fsName, branches, credential, - config.isEnableKetch() ? leaders : null, config.getHookDir(), config.isSslVerify()); } else if (subdirectory != null) { @@ -740,7 +722,6 @@ protected Git createNewGitRepo(Map env, subdirectory, branches, credential, - leaders, config.getHookDir(), config.isSslVerify()); } else { @@ -749,7 +730,6 @@ protected Git createNewGitRepo(Map env, isMirror, branches, credential, - config.isEnableKetch() ? leaders : null, config.getHookDir(), config.isSslVerify()); } @@ -760,7 +740,6 @@ protected Git createNewGitRepo(Map env, } else { git = Git.createRepository(repoDest, config.getHookDir(), - config.isEnableKetch() ? leaders : null, config.isSslVerify()); } return git; diff --git a/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/JGitFileSystemProviderConfiguration.java b/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/JGitFileSystemProviderConfiguration.java index 4f23e6ea85..3e796ed404 100644 --- a/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/JGitFileSystemProviderConfiguration.java +++ b/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/JGitFileSystemProviderConfiguration.java @@ -41,7 +41,6 @@ public class JGitFileSystemProviderConfiguration { public static final String GIT_NIO_DIR = "org.uberfire.nio.git.dir"; public static final String GIT_NIO_DIR_NAME = "org.uberfire.nio.git.dirname"; - public static final String ENABLE_GIT_KETCH = "org.uberfire.nio.git.ketch"; public static final String HOOK_DIR = "org.uberfire.nio.git.hooks"; public static final String GIT_HTTP_HOST = "org.uberfire.nio.git.http.host"; @@ -149,7 +148,6 @@ public class JGitFileSystemProviderConfiguration { private File hookDir; - boolean enableKetch = false; private String proxyType; private boolean sshOverHttpProxy; private String httpProxyHost; @@ -177,8 +175,6 @@ public void load(ConfigProperties systemConfig) { LOG.debug("Configuring from properties:"); final String currentDirectory = System.getProperty(USER_DIR); - final ConfigProperties.ConfigProperty enableKetchProp = systemConfig.get(ENABLE_GIT_KETCH, - DEFAULT_ENABLE_GIT_KETCH); final ConfigProperties.ConfigProperty hookDirProp = systemConfig.get(HOOK_DIR, null); final ConfigProperties.ConfigProperty bareReposDirProp = systemConfig.get(GIT_NIO_DIR, @@ -294,10 +290,6 @@ public void load(ConfigProperties systemConfig) { LOG.debug(systemConfig.getConfigurationSummary("Summary of JGit configuration:")); } - if (enableKetchProp != null && enableKetchProp.getValue() != null) { - enableKetch = enableKetchProp.getBooleanValue(); - } - if (hookDirProp != null && hookDirProp.getValue() != null) { hookDir = new File(hookDirProp.getValue()); if (!hookDir.exists()) { @@ -455,10 +447,6 @@ public File getHookDir() { return hookDir; } - public boolean isEnableKetch() { - return enableKetch; - } - public String getProxyType() { return proxyType; } diff --git a/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/JGitSSHConfigSessionFactory.java b/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/JGitSSHConfigSessionFactory.java index 8d1d3d1141..0039744285 100644 --- a/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/JGitSSHConfigSessionFactory.java +++ b/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/JGitSSHConfigSessionFactory.java @@ -7,13 +7,14 @@ import com.jcraft.jsch.Session; import com.jcraft.jsch.UserInfo; import org.eclipse.jgit.errors.UnsupportedCredentialItem; +import org.eclipse.jgit.internal.transport.ssh.jsch.CredentialsProviderUserInfo; import org.eclipse.jgit.transport.CredentialItem; import org.eclipse.jgit.transport.CredentialsProvider; -import org.eclipse.jgit.transport.CredentialsProviderUserInfo; -import org.eclipse.jgit.transport.OpenSshConfig; import org.eclipse.jgit.transport.URIish; +import org.eclipse.jgit.transport.ssh.jsch.JschConfigSessionFactory; +import org.eclipse.jgit.transport.ssh.jsch.OpenSshConfig; -public class JGitSSHConfigSessionFactory extends org.eclipse.jgit.transport.JschConfigSessionFactory { +public class JGitSSHConfigSessionFactory extends JschConfigSessionFactory { private final JGitFileSystemProviderConfiguration config; diff --git a/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/daemon/git/Daemon.java b/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/daemon/git/Daemon.java index 15d4fc64ad..6d368575e1 100644 --- a/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/daemon/git/Daemon.java +++ b/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/daemon/git/Daemon.java @@ -32,7 +32,6 @@ import org.eclipse.jgit.errors.RepositoryNotFoundException; import org.eclipse.jgit.internal.JGitText; -import org.eclipse.jgit.internal.ketch.KetchLeaderCache; import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.storage.pack.PackConfig; import org.eclipse.jgit.transport.ServiceMayNotContinueException; @@ -76,15 +75,6 @@ public class Daemon { private final Executor acceptThreadPool; - public Daemon(final InetSocketAddress addr, - final Executor acceptThreadPool, - final ExecutorService executorService) { - this(addr, - acceptThreadPool, - executorService, - null); - } - /** * Configures a new daemon for the specified network address. The daemon will not attempt to bind to an address or * accept connections until a call to {@link #start()}. @@ -95,8 +85,7 @@ public Daemon(final InetSocketAddress addr, */ public Daemon(final InetSocketAddress addr, final Executor acceptThreadPool, - final ExecutorService executorService, - final KetchLeaderCache leaders) { + final ExecutorService executorService) { myAddress = addr; this.acceptThreadPool = checkNotNull("acceptThreadPool", acceptThreadPool); diff --git a/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/daemon/git/KetchCustomReceivePack.java b/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/daemon/git/KetchCustomReceivePack.java deleted file mode 100644 index a20336049b..0000000000 --- a/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/daemon/git/KetchCustomReceivePack.java +++ /dev/null @@ -1,77 +0,0 @@ -package org.uberfire.java.nio.fs.jgit.daemon.git; - -import java.io.IOException; -import java.text.MessageFormat; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.eclipse.jgit.internal.JGitText; -import org.eclipse.jgit.internal.storage.reftree.RefTreeDatabase; -import org.eclipse.jgit.lib.BatchRefUpdate; -import org.eclipse.jgit.lib.NullProgressMonitor; -import org.eclipse.jgit.lib.ObjectId; -import org.eclipse.jgit.lib.Ref; -import org.eclipse.jgit.lib.RefDatabase; -import org.eclipse.jgit.lib.Repository; -import org.eclipse.jgit.transport.ReceiveCommand; -import org.eclipse.jgit.transport.ReceivePack; - -public class KetchCustomReceivePack extends ReceivePack { - - public KetchCustomReceivePack(final Repository into) { - super(into); - } - - @Override - public void setAdvertisedRefs(final Map allRefs, - final Set additionalHaves) { - super.setAdvertisedRefs(allRefs, - additionalHaves); - final Map refs = getAdvertisedRefs(); - if (getRepository().getRefDatabase() instanceof RefTreeDatabase) { - final RefDatabase bootstrap = ((RefTreeDatabase) getRepository().getRefDatabase()).getBootstrap(); - try { - for (Map.Entry entry : bootstrap.getRefs("").entrySet()) { - refs.put(entry.getKey(), - entry.getValue()); - } - } catch (final IOException e) { - e.printStackTrace(); - } - } - } - - @Override - protected void executeCommands() { - if (getRepository().getRefDatabase() instanceof RefTreeDatabase) { - List toApply = filterCommands(ReceiveCommand.Result.NOT_ATTEMPTED); - if (toApply.isEmpty()) { - return; - } - final BatchRefUpdate batch = ((RefTreeDatabase) getRepository().getRefDatabase()).getBootstrap().newBatchUpdate(); - batch.setAllowNonFastForwards(true); - batch.setAtomic(false); - batch.setRefLogIdent(getRefLogIdent()); - batch.setRefLogMessage("push", - true); //$NON-NLS-1$ - batch.addCommand(toApply); - try { - batch.setPushCertificate(getPushCertificate()); - batch.execute(getRevWalk(), - NullProgressMonitor.INSTANCE); - } catch (IOException err) { - for (ReceiveCommand cmd : toApply) { - if (cmd.getResult() == ReceiveCommand.Result.NOT_ATTEMPTED) { - cmd.setResult(ReceiveCommand.Result.REJECTED_OTHER_REASON, - MessageFormat.format( - JGitText.get().lockError, - err.getMessage())); - } - } - } - } else { - super.executeCommands(); - } - } -} diff --git a/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/daemon/ssh/GitReceiveCommand.java b/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/daemon/ssh/GitReceiveCommand.java index 9b30cedc12..395b9d5ce7 100644 --- a/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/daemon/ssh/GitReceiveCommand.java +++ b/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/daemon/ssh/GitReceiveCommand.java @@ -16,13 +16,10 @@ package org.uberfire.java.nio.fs.jgit.daemon.ssh; -import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.concurrent.ExecutorService; -import org.apache.sshd.server.Environment; -import org.apache.sshd.server.channel.ChannelSession; import org.eclipse.jgit.api.Git; import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.transport.ReceivePack; diff --git a/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/Git.java b/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/Git.java index eeb5c97c81..0eacbca443 100644 --- a/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/Git.java +++ b/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/Git.java @@ -28,8 +28,6 @@ import org.eclipse.jgit.api.errors.GitAPIException; import org.eclipse.jgit.api.errors.InvalidRemoteException; import org.eclipse.jgit.diff.DiffEntry; -import org.eclipse.jgit.internal.ketch.KetchLeader; -import org.eclipse.jgit.internal.ketch.KetchLeaderCache; import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.Ref; import org.eclipse.jgit.lib.Repository; @@ -67,37 +65,16 @@ static Git createRepository(final File repoDir, static Git createRepository(final File repoDir, final File hookDir) { - return createRepository(repoDir, - hookDir, - null, - JGitFileSystemProviderConfiguration.DEFAULT_GIT_HTTP_SSL_VERIFY); - } - - static Git createRepository(final File repoDir, - final File hookDir, - final boolean sslVerify) { - return createRepository(repoDir, - hookDir, - null, - sslVerify); - } - - static Git createRepository(final File repoDir, - final File hookDir, - final KetchLeaderCache leaders) { return new CreateRepository(repoDir, hookDir, - leaders, JGitFileSystemProviderConfiguration.DEFAULT_GIT_HTTP_SSL_VERIFY).execute().get(); } static Git createRepository(final File repoDir, final File hookDir, - final KetchLeaderCache leaders, final boolean sslVerify) { return new CreateRepository(repoDir, hookDir, - leaders, sslVerify).execute().get(); } @@ -106,14 +83,12 @@ static Git fork(final File gitRepoContainerDir, final String name, final List branches, final CredentialsProvider credential, - final KetchLeaderCache leaders, final File hookDir) { return new Fork(gitRepoContainerDir, origin, name, branches, credential, - leaders, hookDir, JGitFileSystemProviderConfiguration.DEFAULT_GIT_HTTP_SSL_VERIFY).execute(); } @@ -123,7 +98,6 @@ static Git fork(final File gitRepoContainerDir, final String name, final List branches, final CredentialsProvider credential, - final KetchLeaderCache leaders, final File hookDir, final boolean sslVerify) { return new Fork(gitRepoContainerDir, @@ -131,7 +105,6 @@ static Git fork(final File gitRepoContainerDir, name, branches, credential, - leaders, hookDir, sslVerify).execute(); } @@ -141,14 +114,12 @@ static Git clone(final File repoDest, final boolean isMirror, final List branches, final CredentialsProvider credential, - final KetchLeaderCache leaders, final File hookDir) { return new Clone(repoDest, origin, isMirror, branches, credential, - leaders, hookDir, JGitFileSystemProviderConfiguration.DEFAULT_GIT_HTTP_SSL_VERIFY).execute().get(); } @@ -158,7 +129,6 @@ static Git clone(final File repoDest, final boolean isMirror, final List branches, final CredentialsProvider credential, - final KetchLeaderCache leaders, final File hookDir, final boolean sslVerify) { return new Clone(repoDest, @@ -166,7 +136,6 @@ static Git clone(final File repoDest, isMirror, branches, credential, - leaders, hookDir, sslVerify).execute().get(); } @@ -176,14 +145,12 @@ static Git cloneSubdirectory(final File repoDest, final String subdirectory, final List branches, final CredentialsProvider credential, - final KetchLeaderCache leaders, final File hookDir) { return new SubdirectoryClone(repoDest, origin, subdirectory, branches, credential, - leaders, hookDir, JGitFileSystemProviderConfiguration.DEFAULT_GIT_HTTP_SSL_VERIFY).execute(); } @@ -193,7 +160,6 @@ static Git cloneSubdirectory(final File repoDest, final String subdirectory, final List branches, final CredentialsProvider credential, - final KetchLeaderCache leaders, final File hookDir, final boolean sslVerify) { return new SubdirectoryClone(repoDest, @@ -201,13 +167,10 @@ static Git cloneSubdirectory(final File repoDest, subdirectory, branches, credential, - leaders, hookDir, sslVerify).execute(); } - void convertRefTree(); - void deleteRef(final Ref ref); Ref getRef(final String ref); @@ -337,16 +300,8 @@ List listPathContent(final String branchName, void refUpdate(final String branch, final RevCommit commit) throws IOException, ConcurrentRefUpdateException; - KetchLeader getKetchLeader(); - - boolean isKetchEnabled(); - - void enableKetch(); - void updateRepo(Repository repo); - void updateLeaders(final KetchLeaderCache leaders); - void removeRemote(String remote, String ref); diff --git a/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/GitImpl.java b/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/GitImpl.java index 86f34dcc22..fad104c09c 100644 --- a/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/GitImpl.java +++ b/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/GitImpl.java @@ -40,9 +40,6 @@ import org.eclipse.jgit.api.errors.GitAPIException; import org.eclipse.jgit.api.errors.InvalidRemoteException; import org.eclipse.jgit.diff.DiffEntry; -import org.eclipse.jgit.internal.ketch.KetchLeader; -import org.eclipse.jgit.internal.ketch.KetchLeaderCache; -import org.eclipse.jgit.internal.storage.reftree.RefTreeDatabase; import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.Ref; import org.eclipse.jgit.lib.Repository; @@ -62,7 +59,6 @@ import org.uberfire.java.nio.fs.jgit.util.commands.CherryPick; import org.uberfire.java.nio.fs.jgit.util.commands.Commit; import org.uberfire.java.nio.fs.jgit.util.commands.ConflictBranchesChecker; -import org.uberfire.java.nio.fs.jgit.util.commands.ConvertRefTree; import org.uberfire.java.nio.fs.jgit.util.commands.CreateBranch; import org.uberfire.java.nio.fs.jgit.util.commands.DeleteBranch; import org.uberfire.java.nio.fs.jgit.util.commands.DiffBranches; @@ -82,7 +78,6 @@ import org.uberfire.java.nio.fs.jgit.util.commands.MapDiffContent; import org.uberfire.java.nio.fs.jgit.util.commands.Merge; import org.uberfire.java.nio.fs.jgit.util.commands.Push; -import org.uberfire.java.nio.fs.jgit.util.commands.RefTreeUpdateCommand; import org.uberfire.java.nio.fs.jgit.util.commands.RemoveRemote; import org.uberfire.java.nio.fs.jgit.util.commands.ResolveObjectIds; import org.uberfire.java.nio.fs.jgit.util.commands.ResolveRevCommit; @@ -105,9 +100,7 @@ public class GitImpl implements Git { private static final String DEFAULT_JGIT_RETRY_SLEEP_TIME = "50"; private static int JGIT_RETRY_TIMES = initRetryValue(); private static final int JGIT_RETRY_SLEEP_TIME = initSleepTime(); - private static final String MAIN_BRANCH = "master"; - private boolean isEnabled = false; - + public static final String MAIN_BRANCH = "master"; private static int initSleepTime() { final ConfigProperties config = new ConfigProperties(System.getProperties()); return config.get("org.uberfire.nio.git.retry.onfail.sleep", @@ -133,28 +126,10 @@ private static int initRetryValue() { } private org.eclipse.jgit.api.Git git; - private KetchLeaderCache leaders; private final AtomicBoolean isHeadInitialized = new AtomicBoolean(false); public GitImpl(final org.eclipse.jgit.api.Git git) { - this(git, - null); - } - - public GitImpl(final org.eclipse.jgit.api.Git git, - final KetchLeaderCache leaders) { this.git = git; - this.leaders = leaders; - } - - @Override - public void convertRefTree() { - try { - new ConvertRefTree(this).execute(); - } catch (IOException e) { - e.printStackTrace(); - throw new RuntimeException(e); - } } @Override @@ -546,34 +521,9 @@ public void setHeadAsInitialized() { public void refUpdate(final String branch, final RevCommit commit) throws IOException, ConcurrentRefUpdateException { - if (getRepository().getRefDatabase() instanceof RefTreeDatabase) { - new RefTreeUpdateCommand(this, - branch, - commit).execute(); - } else { new SimpleRefUpdateCommand(this, branch, commit).execute(); - } - } - - @Override - public KetchLeader getKetchLeader() { - try { - return leaders.get(getRepository()); - } catch (URISyntaxException e) { - throw new RuntimeException(e); - } - } - - @Override - public boolean isKetchEnabled() { - return isEnabled; - } - - @Override - public void enableKetch() { - isEnabled = true; } @Override @@ -581,11 +531,6 @@ public void updateRepo(final Repository repo) { this.git = new org.eclipse.jgit.api.Git(repo); } - @Override - public void updateLeaders(final KetchLeaderCache leaders) { - this.leaders = leaders; - } - @Override public void removeRemote(final String remote, final String ref) { diff --git a/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/Clone.java b/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/Clone.java index f7fa492709..bf6c1d8de6 100644 --- a/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/Clone.java +++ b/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/Clone.java @@ -21,7 +21,6 @@ import java.util.List; import java.util.Optional; -import org.eclipse.jgit.internal.ketch.KetchLeaderCache; import org.eclipse.jgit.internal.storage.file.WindowCache; import org.eclipse.jgit.storage.file.WindowCacheConfig; import org.eclipse.jgit.transport.CredentialsProvider; @@ -46,24 +45,22 @@ public class Clone { private final List branches; private final CredentialsProvider credentialsProvider; private final boolean isMirror; - private final KetchLeaderCache leaders; private final File hookDir; private final boolean sslVerify; private Logger logger = LoggerFactory.getLogger(Clone.class); + public Clone(final File directory, final String origin, final boolean isMirror, final List branches, final CredentialsProvider credentialsProvider, - final KetchLeaderCache leaders, final File hookDir) { this(directory, origin, isMirror, branches, credentialsProvider, - leaders, hookDir, JGitFileSystemProviderConfiguration.DEFAULT_GIT_HTTP_SSL_VERIFY); } @@ -73,7 +70,6 @@ public Clone(final File directory, final boolean isMirror, final List branches, final CredentialsProvider credentialsProvider, - final KetchLeaderCache leaders, final File hookDir, final boolean sslVerify) { this.repoDir = checkNotNull("directory", @@ -83,7 +79,6 @@ public Clone(final File directory, this.isMirror = isMirror; this.branches = branches; this.credentialsProvider = credentialsProvider; - this.leaders = leaders; this.hookDir = hookDir; this.sslVerify = sslVerify; } @@ -118,11 +113,6 @@ public Optional execute() { git.syncRemote(remote); - if (git.isKetchEnabled()) { - git.convertRefTree(); - git.updateLeaders(leaders); - } - git.setHeadAsInitialized(); BranchUtil.deleteUnfilteredBranches(git.getRepository(), branches); diff --git a/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/ConvertRefTree.java b/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/ConvertRefTree.java deleted file mode 100644 index 81affc84d3..0000000000 --- a/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/ConvertRefTree.java +++ /dev/null @@ -1,150 +0,0 @@ -package org.uberfire.java.nio.fs.jgit.util.commands; - -import java.io.File; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.StandardCopyOption; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.TimeZone; - -import org.eclipse.jgit.internal.storage.reftree.Command; -import org.eclipse.jgit.internal.storage.reftree.RefTree; -import org.eclipse.jgit.internal.storage.reftree.RefTreeDatabase; -import org.eclipse.jgit.lib.CommitBuilder; -import org.eclipse.jgit.lib.ObjectId; -import org.eclipse.jgit.lib.ObjectInserter; -import org.eclipse.jgit.lib.ObjectReader; -import org.eclipse.jgit.lib.PersonIdent; -import org.eclipse.jgit.lib.Ref; -import org.eclipse.jgit.lib.RefDatabase; -import org.eclipse.jgit.lib.RefUpdate; -import org.eclipse.jgit.lib.Repository; -import org.eclipse.jgit.lib.StoredConfig; -import org.eclipse.jgit.revwalk.RevWalk; -import org.eclipse.jgit.storage.file.FileRepositoryBuilder; -import org.uberfire.java.nio.fs.jgit.util.Git; - -import static org.eclipse.jgit.lib.Constants.HEAD; - -public class ConvertRefTree { - - private final Git git; - private String txnNamespace; - private String txnCommitted; - - public ConvertRefTree(final Git git) { - this.git = git; - } - - public void execute() throws IOException { - try (ObjectReader reader = git.getRepository().newObjectReader(); - RevWalk rw = new RevWalk(reader); - ObjectInserter inserter = git.getRepository().newObjectInserter()) { - RefDatabase refDb = git.getRepository().getRefDatabase(); - if (refDb instanceof RefTreeDatabase) { - RefTreeDatabase d = (RefTreeDatabase) refDb; - refDb = d.getBootstrap(); - txnNamespace = d.getTxnNamespace(); - txnCommitted = d.getTxnCommitted(); - } else { - RefTreeDatabase d = new RefTreeDatabase(git.getRepository(), - refDb); - txnNamespace = d.getTxnNamespace(); - txnCommitted = d.getTxnCommitted(); - } - - CommitBuilder b = new CommitBuilder(); - Ref ref = refDb.exactRef(txnCommitted); - RefUpdate update = refDb.newUpdate(txnCommitted, - true); - ObjectId oldTreeId; - - if (ref != null && ref.getObjectId() != null) { - ObjectId oldId = ref.getObjectId(); - update.setExpectedOldObjectId(oldId); - b.setParentId(oldId); - oldTreeId = rw.parseCommit(oldId).getTree(); - } else { - update.setExpectedOldObjectId(ObjectId.zeroId()); - oldTreeId = ObjectId.zeroId(); - } - - RefTree tree = rebuild(refDb); - b.setTreeId(tree.writeTree(inserter)); - b.setAuthor(new PersonIdent("system", - "system", - new Date(1481754897254L), - TimeZone.getDefault())); - b.setCommitter(b.getAuthor()); - if (b.getTreeId().equals(oldTreeId)) { - return; - } - - update.setNewObjectId(inserter.insert(b)); - inserter.flush(); - - RefUpdate.Result result = update.update(rw); - switch (result) { - case NEW: - case FAST_FORWARD: - break; - default: - throw new RuntimeException(String.format("%s: %s", - update.getName(), - result)); //$NON-NLS-1$ - } - - if (!(git.getRepository().getRefDatabase() instanceof RefTreeDatabase)) { - StoredConfig cfg = git.getRepository().getConfig(); - cfg.setInt("core", - null, - "repositoryformatversion", - 1); //$NON-NLS-1$ //$NON-NLS-2$ - cfg.setString("extensions", - null, - "refsStorage", - "reftree"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - cfg.save(); - - final Repository repo = new FileRepositoryBuilder() - .setGitDir(git.getRepository().getDirectory()) - .build(); - git.updateRepo(repo); - } - final File commited = new File(git.getRepository().getDirectory(), - txnCommitted); - final File accepted = new File(git.getRepository().getDirectory(), - txnNamespace + "accepted"); - Files.copy(commited.toPath(), - accepted.toPath(), - StandardCopyOption.REPLACE_EXISTING); - } - } - - private RefTree rebuild(RefDatabase refdb) throws IOException { - RefTree tree = RefTree.newEmptyTree(); - List cmds - = new ArrayList<>(); - - Ref head = refdb.exactRef(HEAD); - if (head != null) { - cmds.add(new org.eclipse.jgit.internal.storage.reftree.Command( - null, - head)); - } - - for (Ref r : refdb.getRefs(RefDatabase.ALL).values()) { - if (r.getName().equals(txnCommitted) || r.getName().equals(HEAD) - || r.getName().startsWith(txnNamespace)) { - continue; - } - cmds.add(new org.eclipse.jgit.internal.storage.reftree.Command( - null, - git.getRepository().peel(r))); - } - tree.apply(cmds); - return tree; - } -} diff --git a/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/CreateRepository.java b/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/CreateRepository.java index a1a1262d7d..873cd3455e 100644 --- a/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/CreateRepository.java +++ b/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/CreateRepository.java @@ -22,7 +22,6 @@ import java.util.Optional; import org.apache.commons.io.FileUtils; -import org.eclipse.jgit.internal.ketch.KetchLeaderCache; import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.lib.StoredConfig; import org.eclipse.jgit.storage.file.FileRepositoryBuilder; @@ -35,7 +34,6 @@ public class CreateRepository { private final File repoDir; private final File hookDir; - private final KetchLeaderCache leaders; private final boolean sslVerify; private static final List HOOK_IGNORED = Arrays.asList("system", @@ -45,7 +43,6 @@ public class CreateRepository { public CreateRepository(final File repoDir) { this(repoDir, - null, null, JGitFileSystemProviderConfiguration.DEFAULT_GIT_HTTP_SSL_VERIFY); } @@ -53,7 +50,6 @@ public CreateRepository(final File repoDir) { public CreateRepository(final File repoDir, final boolean sslVerify) { this(repoDir, - null, null, sslVerify); } @@ -62,35 +58,14 @@ public CreateRepository(final File repoDir, final File hookDir) { this(repoDir, hookDir, - null, JGitFileSystemProviderConfiguration.DEFAULT_GIT_HTTP_SSL_VERIFY); } public CreateRepository(final File repoDir, final File hookDir, final boolean sslVerify) { - this(repoDir, - hookDir, - null, - sslVerify); - } - - public CreateRepository(final File repoDir, - final File hookDir, - final KetchLeaderCache leaders) { - this(repoDir, - hookDir, - leaders, - JGitFileSystemProviderConfiguration.DEFAULT_GIT_HTTP_SSL_VERIFY); - } - - public CreateRepository(final File repoDir, - final File hookDir, - final KetchLeaderCache leaders, - final boolean sslVerify) { this.repoDir = repoDir; this.hookDir = hookDir; - this.leaders = leaders; this.sslVerify = sslVerify; } @@ -99,20 +74,6 @@ public Optional execute() { boolean newRepository = !repoDir.exists(); final org.eclipse.jgit.api.Git _git = org.eclipse.jgit.api.Git.init().setBare(true).setDirectory(repoDir).call(); - if (leaders != null) { - new WriteConfiguration(_git.getRepository(), - cfg -> { - cfg.setInt("core", - null, - "repositoryformatversion", - 1); - cfg.setString("extensions", - null, - "refsStorage", - "reftree"); - }).execute(); - } - final Repository repo = new FileRepositoryBuilder() .setGitDir(repoDir) .build(); @@ -139,8 +100,7 @@ public Optional execute() { } } - return Optional.of(new GitImpl(git, - leaders)); + return Optional.of(new GitImpl(git)); } catch (final Exception ex) { throw new IOException(ex); } diff --git a/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/CustomDiffCommand.java b/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/CustomDiffCommand.java index 3f9b48cc26..856decfd57 100644 --- a/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/CustomDiffCommand.java +++ b/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/CustomDiffCommand.java @@ -66,7 +66,7 @@ public class CustomDiffCommand extends GitCommand> { private ProgressMonitor monitor = NullProgressMonitor.INSTANCE; /** - * @param repo + * @param git */ protected CustomDiffCommand(Git git) { super(git.getRepository()); diff --git a/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/Fork.java b/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/Fork.java index 1f54191d77..797e6a7457 100644 --- a/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/Fork.java +++ b/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/Fork.java @@ -22,7 +22,6 @@ import java.io.File; import java.util.List; -import org.eclipse.jgit.internal.ketch.KetchLeaderCache; import org.eclipse.jgit.transport.CredentialsProvider; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -33,7 +32,6 @@ public class Fork { private static final String DOT_GIT_EXT = ".git"; - private final KetchLeaderCache leaders; private Logger logger = LoggerFactory.getLogger(Fork.class); private File parentFolder; @@ -49,7 +47,6 @@ public Fork(final File parentFolder, final String target, final List branches, final CredentialsProvider credentialsProvider, - final KetchLeaderCache leaders, final File hookDir) { this(parentFolder, @@ -57,7 +54,6 @@ public Fork(final File parentFolder, target, branches, credentialsProvider, - leaders, hookDir, JGitFileSystemProviderConfiguration.DEFAULT_GIT_HTTP_SSL_VERIFY); } @@ -67,7 +63,6 @@ public Fork(final File parentFolder, final String target, final List branches, final CredentialsProvider credentialsProvider, - final KetchLeaderCache leaders, final File hookDir, final boolean sslVerify) { this.parentFolder = checkNotNull("parentFolder", @@ -79,8 +74,6 @@ public Fork(final File parentFolder, this.branches = branches; this.credentialsProvider = checkNotNull("credentialsProvider", credentialsProvider); - this.leaders = leaders; - this.hookDir = hookDir; this.sslVerify = sslVerify; @@ -111,7 +104,6 @@ public Git execute() { false, branches, credentialsProvider, - leaders, hookDir, sslVerify); } diff --git a/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/GarbageCollector.java b/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/GarbageCollector.java index b2ebaab018..ee5a082a73 100644 --- a/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/GarbageCollector.java +++ b/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/GarbageCollector.java @@ -18,7 +18,6 @@ import org.eclipse.jgit.api.errors.GitAPIException; import org.eclipse.jgit.api.errors.JGitInternalException; -import org.eclipse.jgit.internal.storage.reftree.RefTreeDatabase; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.uberfire.java.nio.fs.jgit.util.GitImpl; @@ -35,9 +34,7 @@ public GarbageCollector(final GitImpl git) { public void execute() { try { - if (!(git.getRepository().getRefDatabase() instanceof RefTreeDatabase)) { - git._gc().call(); - } + git._gc().call(); } catch (GitAPIException | JGitInternalException e) { if (this.logger.isDebugEnabled()) { this.logger.error("Garbage collector can't perform this operation right now, please try it later.", diff --git a/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/RefTreeUpdateCommand.java b/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/RefTreeUpdateCommand.java deleted file mode 100644 index e6813b4ba7..0000000000 --- a/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/RefTreeUpdateCommand.java +++ /dev/null @@ -1,294 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.uberfire.java.nio.fs.jgit.util.commands; - -import java.io.File; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.StandardCopyOption; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.eclipse.jgit.api.errors.ConcurrentRefUpdateException; -import org.eclipse.jgit.errors.MissingObjectException; -import org.eclipse.jgit.internal.JGitText; -import org.eclipse.jgit.internal.ketch.Proposal; -import org.eclipse.jgit.internal.storage.reftree.Command; -import org.eclipse.jgit.internal.storage.reftree.RefTree; -import org.eclipse.jgit.internal.storage.reftree.RefTreeDatabase; -import org.eclipse.jgit.lib.CommitBuilder; -import org.eclipse.jgit.lib.Constants; -import org.eclipse.jgit.lib.ObjectId; -import org.eclipse.jgit.lib.ObjectIdRef; -import org.eclipse.jgit.lib.ObjectInserter; -import org.eclipse.jgit.lib.ObjectReader; -import org.eclipse.jgit.lib.PersonIdent; -import org.eclipse.jgit.lib.Ref; -import org.eclipse.jgit.lib.RefDatabase; -import org.eclipse.jgit.lib.RefUpdate; -import org.eclipse.jgit.lib.Repository; -import org.eclipse.jgit.lib.SymbolicRef; -import org.eclipse.jgit.revwalk.RevCommit; -import org.eclipse.jgit.revwalk.RevObject; -import org.eclipse.jgit.revwalk.RevTag; -import org.eclipse.jgit.revwalk.RevWalk; -import org.uberfire.java.nio.fs.jgit.util.Git; -import org.uberfire.java.nio.fs.jgit.util.exceptions.GitException; - -import static java.util.concurrent.TimeUnit.MILLISECONDS; -import static org.eclipse.jgit.internal.ketch.Proposal.State.QUEUED; -import static org.eclipse.jgit.lib.Constants.HEAD; -import static org.eclipse.jgit.lib.Constants.MASTER; -import static org.eclipse.jgit.lib.Ref.Storage.NETWORK; -import static org.eclipse.jgit.transport.ReceiveCommand.Result.NOT_ATTEMPTED; -import static org.eclipse.jgit.transport.ReceiveCommand.Result.REJECTED_OTHER_REASON; - -public class RefTreeUpdateCommand { - - private final Git git; - private final String name; - private final RevCommit commit; - - public RefTreeUpdateCommand(final Git git, - final String branchName, - final RevCommit commit) { - this.git = git; - this.name = branchName; - this.commit = commit; - } - - public void execute() throws java.io.IOException, ConcurrentRefUpdateException { - update(git.getRepository(), - Constants.R_HEADS + name, - commit); - //this `initialization` aims to be temporary - // -> without this cgit can't find master when cloning repos - if (name.equals(MASTER) && !git.isHEADInitialized()) { - synchronized (git.getRepository()) { - symRef(git, - HEAD, - Constants.R_HEADS + name); - git.setHeadAsInitialized(); - } - } - } - - private void symRef(final Git git, - final String name, - final String dst) - throws java.io.IOException { - commit(git.getRepository(), - null, - (reader, tree) -> { - Ref old = tree.exactRef(reader, - name); - Ref newx = tree.exactRef(reader, - dst); - final Command n; - if (newx != null) { - n = new Command(old, - new SymbolicRef(name, - newx)); - } else { - n = new Command(old, - new SymbolicRef(name, - new ObjectIdRef.Unpeeled(Ref.Storage.NEW, - dst, - null))); - } - return tree.apply(Collections.singleton(n)); - }); - } - - private void update(final Repository _repo, - final String _name, - final RevCommit _commit) - throws IOException { - commit(_repo, - _commit, - (reader, refTree) -> { - final Ref old = refTree.exactRef(reader, - _name); - final List n = new ArrayList<>(1); - try (RevWalk rw = new RevWalk(_repo)) { - n.add(new Command(old, - toRef(rw, - _commit, - _name, - true))); - if (git.isKetchEnabled()) { - proposeKetch(n, - _commit); - } - } catch (final IOException | InterruptedException e) { - String msg = JGitText.get().transactionAborted; - for (Command cmd : n) { - if (cmd.getResult() == NOT_ATTEMPTED) { - cmd.setResult(REJECTED_OTHER_REASON, - msg); - } - } - throw new GitException("Error"); - //log.error(msg, e); - } - return refTree.apply(n); - }); - } - - private void proposeKetch(final List n, - final RevCommit _commit) throws IOException, InterruptedException { - final Proposal proposal = new Proposal(n) - .setAuthor(_commit.getAuthorIdent()) - .setMessage("push"); - git.getKetchLeader().queueProposal(proposal); - if (proposal.isDone()) { - // This failed fast, e.g. conflict or bad precondition. - throw new GitException("Error"); - } - if (proposal.getState() == QUEUED) { - waitForQueue(proposal); - } - if (!proposal.isDone()) { - waitForPropose(proposal); - } - } - - private void waitForQueue(final Proposal proposal) - throws InterruptedException { - while (!proposal.awaitStateChange(QUEUED, - 250, - MILLISECONDS)) { - System.out.println("waiting queue..."); - } - switch (proposal.getState()) { - case RUNNING: - default: - break; - - case EXECUTED: - break; - - case ABORTED: - break; - } - } - - private void waitForPropose(final Proposal proposal) throws InterruptedException { - while (!proposal.await(250, - MILLISECONDS)) { - System.out.println("waiting propose..."); - } - } - - private static Ref toRef(final RevWalk rw, - final ObjectId id, - final String name, - final boolean mustExist) throws IOException { - if (ObjectId.zeroId().equals(id)) { - return null; - } - - try { - RevObject o = rw.parseAny(id); - if (o instanceof RevTag) { - RevObject p = rw.peel(o); - return new ObjectIdRef.PeeledTag(NETWORK, - name, - id, - p.copy()); - } - return new ObjectIdRef.PeeledNonTag(NETWORK, - name, - id); - } catch (MissingObjectException e) { - if (mustExist) { - throw e; - } - return new ObjectIdRef.Unpeeled(NETWORK, - name, - id); - } - } - - interface BiFunction { - - boolean apply(final ObjectReader reader, - final RefTree refTree) throws IOException; - } - - private void commit(final Repository repo, - final RevCommit original, - final BiFunction fun) throws IOException { - try (final ObjectReader reader = repo.newObjectReader(); - final ObjectInserter inserter = repo.newObjectInserter(); - final RevWalk rw = new RevWalk(reader)) { - - final RefTreeDatabase refdb = (RefTreeDatabase) repo.getRefDatabase(); - final RefDatabase bootstrap = refdb.getBootstrap(); - final RefUpdate refUpdate = bootstrap.newUpdate(refdb.getTxnCommitted(), - false); - - final CommitBuilder cb = new CommitBuilder(); - final Ref ref = bootstrap.exactRef(refdb.getTxnCommitted()); - final RefTree tree; - if (ref != null && ref.getObjectId() != null) { - tree = RefTree.read(reader, - rw.parseTree(ref.getObjectId())); - cb.setParentId(ref.getObjectId()); - refUpdate.setExpectedOldObjectId(ref.getObjectId()); - } else { - tree = RefTree.newEmptyTree(); - refUpdate.setExpectedOldObjectId(ObjectId.zeroId()); - } - - if (fun.apply(reader, - tree)) { - final Ref ref2 = bootstrap.exactRef(refdb.getTxnCommitted()); - if (ref2 == null || ref2.getObjectId().equals(ref != null ? ref.getObjectId() : null)) { - cb.setTreeId(tree.writeTree(inserter)); - if (original != null) { - cb.setAuthor(original.getAuthorIdent()); - cb.setCommitter(original.getAuthorIdent()); - } else { - final PersonIdent personIdent = new PersonIdent("user", - "user@example.com"); - cb.setAuthor(personIdent); - cb.setCommitter(personIdent); - } - refUpdate.setNewObjectId(inserter.insert(cb)); - inserter.flush(); - final RefUpdate.Result result = refUpdate.update(rw); - switch (result) { - case NEW: - case FAST_FORWARD: - break; - default: - throw new RuntimeException(repo.getDirectory() + " -> " + result.toString() + " : " + refUpdate.getName()); - } - final File commited = new File(repo.getDirectory(), - refdb.getTxnCommitted()); - final File accepted = new File(repo.getDirectory(), - refdb.getTxnNamespace() + "accepted"); - Files.copy(commited.toPath(), - accepted.toPath(), - StandardCopyOption.REPLACE_EXISTING); - } - } - } - } -} diff --git a/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/SubdirectoryClone.java b/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/SubdirectoryClone.java index bdbd87c274..bd71c14143 100644 --- a/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/SubdirectoryClone.java +++ b/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/SubdirectoryClone.java @@ -43,7 +43,6 @@ import org.eclipse.jgit.errors.IncorrectObjectTypeException; import org.eclipse.jgit.errors.MissingObjectException; import org.eclipse.jgit.errors.UnmergedPathException; -import org.eclipse.jgit.internal.ketch.KetchLeaderCache; import org.eclipse.jgit.internal.storage.file.WindowCache; import org.eclipse.jgit.lib.CommitBuilder; import org.eclipse.jgit.lib.FileMode; @@ -79,7 +78,6 @@ public class SubdirectoryClone { private final File repoDir; private final String origin; private final CredentialsProvider credentialsProvider; - private final KetchLeaderCache leaders; private final File hookDir; private final boolean sslVerify; @@ -93,7 +91,6 @@ public class SubdirectoryClone { * @param subdirectory The subdirectory within the origin being copied. Must not be null. * @param branches The branches that should be copied. Must not be null. * @param credentialsProvider Provides credentials for the initial cloning of the origin. May be null. - * @param leaders Used for initial cloning. May be null. * @param hookDir Used to specify the directory containing the Git Hooks to add to the repository. May be null. */ public SubdirectoryClone(final File directory, @@ -101,14 +98,12 @@ public SubdirectoryClone(final File directory, final String subdirectory, final List branches, final CredentialsProvider credentialsProvider, - final KetchLeaderCache leaders, final File hookDir) { this(directory, origin, subdirectory, branches, credentialsProvider, - leaders, hookDir, JGitFileSystemProviderConfiguration.DEFAULT_GIT_HTTP_SSL_VERIFY); } @@ -118,7 +113,6 @@ public SubdirectoryClone(final File directory, * @param subdirectory The subdirectory within the origin being copied. Must not be null. * @param branches The branches that should be copied. Must not be null. * @param credentialsProvider Provides credentials for the initial cloning of the origin. May be null. - * @param leaders Used for initial cloning. May be null. * @param hookDir Used to specify the directory containing the Git Hooks to add to the repository. May be null. * @param sslVerify Used to disable http ssl verify on the repository */ @@ -127,7 +121,6 @@ public SubdirectoryClone(final File directory, final String subdirectory, final List branches, final CredentialsProvider credentialsProvider, - final KetchLeaderCache leaders, final File hookDir, final boolean sslVerify) { this.subdirectory = ensureTrailingSlash(subdirectory); @@ -137,7 +130,6 @@ public SubdirectoryClone(final File directory, this.origin = checkNotEmpty("origin", origin); this.credentialsProvider = credentialsProvider; - this.leaders = leaders; this.hookDir = hookDir; this.sslVerify = sslVerify; } @@ -151,7 +143,7 @@ private static String ensureTrailingSlash(String subdirectory) { } public Git execute() { - final Git git = new Clone(repoDir, origin, false, branches, credentialsProvider, leaders, hookDir, sslVerify).execute().get(); + final Git git = new Clone(repoDir, origin, false, branches, credentialsProvider, hookDir, sslVerify).execute().get(); final Repository repository = git.getRepository(); try (final ObjectReader reader = repository.newObjectReader(); diff --git a/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitCloneTest.java b/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitCloneTest.java index 5806fbad4e..2e769db2b8 100644 --- a/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitCloneTest.java +++ b/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitCloneTest.java @@ -28,18 +28,15 @@ import java.io.File; import java.io.IOException; import java.util.HashMap; -import java.util.List; + import java.util.Set; import org.eclipse.jgit.api.errors.GitAPIException; import org.eclipse.jgit.hooks.PostCommitHook; import org.eclipse.jgit.hooks.PreCommitHook; -import org.eclipse.jgit.lib.Ref; import org.eclipse.jgit.lib.StoredConfig; -import org.eclipse.jgit.storage.file.FileBasedConfig; import org.eclipse.jgit.transport.CredentialsProvider; import org.junit.Test; -import org.uberfire.commons.config.ConfigProperties; import org.uberfire.java.nio.fs.jgit.util.Git; import org.uberfire.java.nio.fs.jgit.util.commands.Clone; import org.uberfire.java.nio.fs.jgit.util.commands.Commit; @@ -70,7 +67,6 @@ public void testToCloneSuccess() throws IOException, GitAPIException { null, CredentialsProvider.getDefault(), null, - null, true).execute().get(); assertThat(cloned).isNotNull(); @@ -101,7 +97,6 @@ public void cloneShouldOnlyWorksWithEmptyRepos() throws IOException { null, CredentialsProvider.getDefault(), null, - null, true).execute().get(); assertThat(cloned).isNotNull(); @@ -116,7 +111,6 @@ public void cloneShouldOnlyWorksWithEmptyRepos() throws IOException { null, CredentialsProvider.getDefault(), null, - null, true).execute().get()) .isInstanceOf(Clone.CloneException.class); } @@ -144,7 +138,6 @@ public void testCloneWithHookDir() throws IOException, GitAPIException { false, null, CredentialsProvider.getDefault(), - null, hooksDir, true).execute().get(); @@ -223,7 +216,6 @@ public void cloneNotMirrorRepoConfigTest() throws IOException { null, CredentialsProvider.getDefault(), null, - null, sslVerify).execute().get(); assertThat(clonedNotMirror).isNotNull(); @@ -260,7 +252,6 @@ public void cloneMirrorRepoNoSSLVerifyConfigTest() throws IOException { null, CredentialsProvider.getDefault(), null, - null, sslVerify).execute().get(); assertThat(clonedMirror).isNotNull(); @@ -312,7 +303,6 @@ public void testCloneMultipleBranches() throws Exception { asList("main", "dev"), CredentialsProvider.getDefault(), null, - null, false).execute().get(); assertThat(cloned).isNotNull(); diff --git a/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitFileSystemImplTest.java b/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitFileSystemImplTest.java index 23c144371f..83f899674a 100644 --- a/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitFileSystemImplTest.java +++ b/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitFileSystemImplTest.java @@ -40,6 +40,7 @@ import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; +import static org.uberfire.java.nio.fs.jgit.util.GitImpl.MAIN_BRANCH; public class JGitFileSystemImplTest extends AbstractTestInfra { @@ -78,7 +79,7 @@ public void testRemoteRoot() throws IOException, GitAPIException { final JGitFileSystemProvider fsProvider = mock(JGitFileSystemProvider.class); final File tempDir = createTempDirectory(); - final Git git = new GitImpl(GitImpl._cloneRepository().setNoCheckout(false).setBare(true).setCloneAllBranches(true).setURI(setupGit().getRepository().getDirectory().toString()).setDirectory(tempDir).call()); + final Git git = new GitImpl(GitImpl._cloneRepository().setNoCheckout(false).setBare(true).setCloneAllBranches(true).setURI(setupGit().getRepository().getDirectory().toString()).setDirectory(tempDir).setBranch(MAIN_BRANCH).call()); final JGitFileSystemImpl fileSystem = new JGitFileSystemImpl(fsProvider, null, diff --git a/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitForkTest.java b/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitForkTest.java index c9bee0fc6b..30e2c0570e 100644 --- a/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitForkTest.java +++ b/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitForkTest.java @@ -24,26 +24,14 @@ import java.io.File; import java.io.IOException; import java.net.URI; -import java.util.ArrayList; import java.util.HashMap; -import java.util.Iterator; -import java.util.List; import java.util.Map; import java.util.Set; import org.eclipse.jgit.api.errors.GitAPIException; import org.eclipse.jgit.hooks.PostCommitHook; import org.eclipse.jgit.hooks.PreCommitHook; -import org.eclipse.jgit.lib.ObjectId; -import org.eclipse.jgit.lib.PersonIdent; -import org.eclipse.jgit.lib.Ref; -import org.eclipse.jgit.lib.Repository; -import org.eclipse.jgit.revwalk.RevCommit; -import org.eclipse.jgit.revwalk.RevSort; -import org.eclipse.jgit.revwalk.RevWalk; import org.eclipse.jgit.transport.CredentialsProvider; -import org.eclipse.jgit.treewalk.CanonicalTreeParser; -import org.eclipse.jgit.treewalk.TreeWalk; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -114,7 +102,6 @@ public void testToForkSuccess() throws IOException, GitAPIException { TARGET_GIT, null, CredentialsProvider.getDefault(), - null, null).execute(); final File gitCloned = new File(parentFolder, @@ -175,7 +162,6 @@ public void testToForkAlreadyExists() throws IOException, GitAPIException { TARGET_GIT, null, CredentialsProvider.getDefault(), - null, null).execute(); } @@ -189,7 +175,6 @@ public void testToForkWrongSource() throws IOException { TARGET_GIT, null, CredentialsProvider.getDefault(), - null, null).execute(); fail("If got here is because it could for the repository"); } catch (Clone.CloneException e) { @@ -310,7 +295,6 @@ public void testForkWithHookDir() throws IOException, GitAPIException { TARGET_GIT, null, CredentialsProvider.getDefault(), - null, hooksDir).execute(); assertThat(cloned).isNotNull(); @@ -373,7 +357,6 @@ public void testForkMultipleBranches() throws Exception { TARGET_GIT, asList("main", "dev"), CredentialsProvider.getDefault(), - null, null).execute(); assertThat(cloned).isNotNull(); diff --git a/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitHistoryTest.java b/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitHistoryTest.java index 3449e52338..2d6c507450 100644 --- a/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitHistoryTest.java +++ b/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitHistoryTest.java @@ -17,7 +17,6 @@ import java.io.File; import java.io.IOException; -import java.util.Arrays; import java.util.HashMap; import java.util.Map; diff --git a/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitMirrorTest.java b/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitMirrorTest.java index 57480b5f56..6454bf319f 100644 --- a/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitMirrorTest.java +++ b/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitMirrorTest.java @@ -36,7 +36,6 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.fail; import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; public class JGitMirrorTest extends AbstractTestInfra { @@ -54,7 +53,6 @@ public void testToHTTPMirrorSuccess() throws IOException, GitAPIException { true, null, CredentialsProvider.getDefault(), - null, null).execute(); final Git cloned = Git.open(directory); @@ -89,7 +87,6 @@ public void testToHTTPUnmirrorSuccess() throws IOException, GitAPIException { false, null, CredentialsProvider.getDefault(), - null, null).execute(); final Git cloned = Git.open(directory); @@ -131,7 +128,6 @@ public void testEmptyCredentials() throws IOException, GitAPIException { false, null, null, - null, null).execute(); final Git cloned = Git.open(directory); @@ -163,7 +159,6 @@ public void testBadUrl() throws IOException, GitAPIException { false, null, CredentialsProvider.getDefault(), - null, null).execute(); fail("If got here the test is wrong because the ORIGIN does no exist"); } catch (Clone.CloneException ex) { diff --git a/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitSSHConfigSessionFactoryTest.java b/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitSSHConfigSessionFactoryTest.java index 4ee6723cb0..52d396d9a4 100644 --- a/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitSSHConfigSessionFactoryTest.java +++ b/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitSSHConfigSessionFactoryTest.java @@ -6,7 +6,7 @@ import com.jcraft.jsch.Proxy; import com.jcraft.jsch.ProxyHTTP; import com.jcraft.jsch.Session; -import org.eclipse.jgit.transport.OpenSshConfig; +import org.eclipse.jgit.transport.ssh.jsch.OpenSshConfig; import org.junit.Test; import org.uberfire.commons.config.ConfigProperties; diff --git a/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitSubdirectoryCloneTest.java b/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitSubdirectoryCloneTest.java index cacc7e5851..5576e23ac2 100644 --- a/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitSubdirectoryCloneTest.java +++ b/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitSubdirectoryCloneTest.java @@ -41,7 +41,6 @@ import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.ObjectInserter; import org.eclipse.jgit.lib.PersonIdent; -import org.eclipse.jgit.lib.Ref; import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.revwalk.RevCommit; import org.eclipse.jgit.revwalk.RevSort; @@ -52,7 +51,6 @@ import org.junit.Test; import org.uberfire.java.nio.fs.jgit.util.Git; import org.uberfire.java.nio.fs.jgit.util.commands.CreateRepository; -import org.uberfire.java.nio.fs.jgit.util.commands.ListRefs; import org.uberfire.java.nio.fs.jgit.util.commands.SubdirectoryClone; public class JGitSubdirectoryCloneTest extends AbstractTestInfra { @@ -80,7 +78,6 @@ public void cloneSubdirectorySingleBranch() throws Exception { "dir1", singletonList("main"), CredentialsProvider.getDefault(), - null, null).execute(); assertThat(origin.getRepository().getRemoteNames()).isEmpty(); @@ -133,7 +130,6 @@ public void cloneSubdirectoryMultipleBranches() throws Exception { "dir1", asList("main", "dev"), CredentialsProvider.getDefault(), - null, null).execute(); assertThat(cloned).isNotNull(); @@ -204,7 +200,6 @@ public void cloneSubdirectoryWithMergeCommit() throws Exception { "dir1", asList("main", "dev"), CredentialsProvider.getDefault(), - null, null).execute(); assertThat(cloned).isNotNull(); @@ -268,7 +263,6 @@ public void cloneSubdirectoryWithHookDir() throws Exception { "dir1", singletonList("main"), CredentialsProvider.getDefault(), - null, hooksDir).execute(); assertThat(origin.getRepository().getRemoteNames()).isEmpty(); diff --git a/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitUtilTest.java b/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitUtilTest.java index 95a098b77a..78a37e0b9d 100644 --- a/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitUtilTest.java +++ b/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitUtilTest.java @@ -131,7 +131,6 @@ public void testClone() throws IOException, InvalidRemoteException { false, null, CredentialsProvider.getDefault(), - null, null).execute().get(); assertThat(git).isNotNull(); @@ -183,7 +182,6 @@ public void testPathResolve() throws IOException, InvalidRemoteException { false, null, CredentialsProvider.getDefault(), - null, null).execute().get(); assertThat(git.getPathInfo("user_branch", @@ -236,7 +234,6 @@ public void testAmend() throws IOException, InvalidRemoteException { false, null, CredentialsProvider.getDefault(), - null, null).execute().get(); assertThat(git.getPathInfo("main", diff --git a/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/daemon/http/HTTPSOnlySupportTest.java b/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/daemon/http/HTTPSOnlySupportTest.java index 8655c8f34f..d09a2b2724 100644 --- a/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/daemon/http/HTTPSOnlySupportTest.java +++ b/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/daemon/http/HTTPSOnlySupportTest.java @@ -14,7 +14,6 @@ import org.uberfire.java.nio.fs.jgit.JGitFileSystemProviderConfiguration; import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.assertFalse; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.mock; diff --git a/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/daemon/http/HTTPSupportDisableTest.java b/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/daemon/http/HTTPSupportDisableTest.java index 3475fafd7a..e00129d7c0 100644 --- a/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/daemon/http/HTTPSupportDisableTest.java +++ b/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/daemon/http/HTTPSupportDisableTest.java @@ -5,10 +5,8 @@ import javax.servlet.Servlet; import javax.servlet.ServletContext; import javax.servlet.ServletContextEvent; -import javax.servlet.ServletRegistration; import org.junit.Test; -import org.mockito.ArgumentCaptor; import org.uberfire.java.nio.fs.jgit.AbstractTestInfra; import org.uberfire.java.nio.fs.jgit.JGitFileSystemProvider; import org.uberfire.java.nio.fs.jgit.JGitFileSystemProviderConfiguration; diff --git a/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/ws/JGitFileSystemsEventsManagerTest.java b/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/ws/JGitFileSystemsEventsManagerTest.java index 8a2af337dd..fb710d1827 100644 --- a/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/ws/JGitFileSystemsEventsManagerTest.java +++ b/uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/ws/JGitFileSystemsEventsManagerTest.java @@ -18,7 +18,6 @@ import java.util.Arrays; import java.util.List; -import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.Test; @@ -35,7 +34,6 @@ import static org.junit.Assert.*; import static org.mockito.Mockito.*; -import static org.uberfire.commons.cluster.ClusterParameters.APPFORMER_JMS_CONNECTION_MODE; @RunWith(MockitoJUnitRunner.class) public class JGitFileSystemsEventsManagerTest {