Remove redundant constructor parameter

The repository can be retrieved from the context and does not have to be
passed through by every constructor
This commit is contained in:
René Pfeuffer
2020-05-12 15:45:58 +02:00
parent d1c6a33c67
commit d5d9690389
80 changed files with 308 additions and 425 deletions

View File

@@ -110,6 +110,6 @@ public class SvnBlameCommandTest extends AbstractSvnCommandTestBase
*/
private SvnBlameCommand createCommand()
{
return new SvnBlameCommand(createContext(), repository);
return new SvnBlameCommand(createContext());
}
}

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
import org.junit.Test;
@@ -268,7 +268,7 @@ public class SvnBrowseCommandTest extends AbstractSvnCommandTestBase
*/
private SvnBrowseCommand createCommand()
{
return new SvnBrowseCommand(createContext(), repository);
return new SvnBrowseCommand(createContext());
}
//~--- get methods ----------------------------------------------------------

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
//~--- non-JDK imports --------------------------------------------------------
@@ -57,8 +57,7 @@ public class SvnBundleCommandTest extends AbstractSvnCommandTestBase
File file = temp.newFile();
ByteSink sink = Files.asByteSink(file);
BundleCommandRequest req = new BundleCommandRequest(sink);
BundleResponse res = new SvnBundleCommand(createContext(),
repository).bundle(req);
BundleResponse res = new SvnBundleCommand(createContext()).bundle(req);
assertThat(res, notNullValue());
assertThat(res.getChangesetCount(), is(5l));

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
import org.hamcrest.BaseMatcher;
@@ -111,7 +111,7 @@ public class SvnCatCommandTest extends AbstractSvnCommandTestBase {
request.setPath("a.txt");
request.setRevision("1");
InputStream catResultStream = new SvnCatCommand(createContext(), repository).getCatResultStream(request);
InputStream catResultStream = new SvnCatCommand(createContext()).getCatResultStream(request);
assertEquals('a', catResultStream.read());
assertEquals('\n', catResultStream.read());
@@ -126,8 +126,7 @@ public class SvnCatCommandTest extends AbstractSvnCommandTestBase {
try
{
new SvnCatCommand(createContext(), repository).getCatResult(request,
baos);
new SvnCatCommand(createContext()).getCatResult(request, baos);
}
finally
{

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
//~--- non-JDK imports --------------------------------------------------------
@@ -136,7 +136,7 @@ public class SvnLogCommandTest extends AbstractSvnCommandTestBase
checkDate(c.getDate());
assertEquals("perfect", c.getAuthor().getName());
assertNull("douglas.adams@hitchhiker.com", c.getAuthor().getMail());
SvnModificationsCommand modificationsCommand = new SvnModificationsCommand(createContext(), repository);
SvnModificationsCommand modificationsCommand = new SvnModificationsCommand(createContext());
Modifications modifications = modificationsCommand.getModifications("3");
assertNotNull(modifications);
@@ -177,6 +177,6 @@ public class SvnLogCommandTest extends AbstractSvnCommandTestBase
*/
private SvnLogCommand createCommand()
{
return new SvnLogCommand(createContext(), repository);
return new SvnLogCommand(createContext());
}
}

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
import org.apache.shiro.subject.Subject;
@@ -57,7 +57,7 @@ public class SvnModifyCommandTest extends AbstractSvnCommandTestBase {
public void initSvnModifyCommand() {
context = createContext();
workDirFactory = new SimpleSvnWorkDirFactory(new WorkdirProvider(context.getDirectory()));
svnModifyCommand = new SvnModifyCommand(context, createRepository(), workDirFactory);
svnModifyCommand = new SvnModifyCommand(context, workDirFactory);
}
@Before

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
//~--- non-JDK imports --------------------------------------------------------
@@ -57,13 +57,8 @@ public class SvnUnbundleCommandTest extends AbstractSvnCommandTestBase
File bundle = bundle();
SvnContext ctx = createEmptyContext();
//J-
UnbundleResponse res = new SvnUnbundleCommand(
ctx,
repository
).unbundle(
new UnbundleCommandRequest(
Files.asByteSource(bundle)
)
UnbundleResponse res = new SvnUnbundleCommand(ctx)
.unbundle(new UnbundleCommandRequest(Files.asByteSource(bundle))
);
//J+
@@ -81,13 +76,8 @@ public class SvnUnbundleCommandTest extends AbstractSvnCommandTestBase
File file = tempFolder.newFile();
//J-
new SvnBundleCommand(
createContext(),
repository
).bundle(
new BundleCommandRequest(
Files.asByteSink(file)
)
new SvnBundleCommand(createContext())
.bundle(new BundleCommandRequest(Files.asByteSink(file))
);
//J+