// Path: src/test/java/com/asolutions/MockTestCase.java
// public class MockTestCase {
// 
// 	protected Mockery context = new JUnit4Mockery();
// 
// 	@Before
// 	public void setupMockery() {
// 		context.setImposteriser(ClassImposteriser.INSTANCE);
// 	}
// 	
// 	@After
// 	public void mockeryAssertIsSatisfied(){
// 		context.assertIsSatisfied();
// 	}
// 
// 	protected void checking(Expectations expectations) {
// 		context.checking(expectations);
// 	}
// 
// }
// 
// Path: src/main/java/com/asolutions/scmsshd/authorizors/AuthorizationLevel.java
// public enum AuthorizationLevel {
// 	AUTH_LEVEL_READ_ONLY, 
// 	AUTH_LEVEL_READ_WRITE;
// }
// 
// Path: src/main/java/com/asolutions/scmsshd/commands/FilteredCommand.java
// public class FilteredCommand {
// 	
// 	private String command;
// 	private String argument;
// 
// 	public FilteredCommand() {
// 	}
// 	
// 	public FilteredCommand(String command, String argument) {
// 		this.command = command;
// 		this.argument = argument;
// 	}
// 
// 	public void setArgument(String argument) {
// 		this.argument = argument;
// 	}
// 	
// 	public void setCommand(String command) {
// 		this.command = command;
// 	}
// 
// 	public String getCommand() {
// 		return this.command;
// 	}
// 
// 	public String getArgument() {
// 		return this.argument;
// 	}
// 	
// 	@Override
// 	public String toString()
// 	{
// 		return "Filtered Command: " + getCommand() + ", " + getArgument();
// 	}
// 
// }
// 
// Path: src/main/java/com/asolutions/scmsshd/commands/factories/GitSCMCommandFactory.java
// public class GitSCMCommandFactory implements ISCMCommandFactory {
// 
// 	public static final String REPOSITORY_BASE = "repositoryBase";
// 
// 	public Command create(FilteredCommand filteredCommand,
// 			IProjectAuthorizer projectAuthorizer,
// 			IPathToProjectNameConverter pathToProjectNameConverter,
// 			Properties configuration) {
// 		SCMCommand retVal = new SCMCommand(filteredCommand, projectAuthorizer, new GitSCMCommandHandler(), pathToProjectNameConverter, configuration);
// 		return retVal;
// 	}
// 
// }


import java.io.File;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Properties;
import org.apache.sshd.server.CommandFactory.ExitCallback;
import org.jmock.Expectations;
import org.junit.Test;
import org.spearce.jgit.lib.Repository;
import org.spearce.jgit.transport.UploadPack;
import com.asolutions.MockTestCase;
import com.asolutions.scmsshd.authorizors.AuthorizationLevel;
import com.asolutions.scmsshd.commands.FilteredCommand;
import com.asolutions.scmsshd.commands.factories.GitSCMCommandFactory;
package com.asolutions.scmsshd.commands.git;




public class GitUploadPackSCMCommandHandlerTest extends MockTestCase {

	@Test
	public void testUploadPackPassesCorrectStuffToJGIT() throws Exception {
		final String pathtobasedir = "pathtobasedir";

		final FilteredCommand filteredCommand = new FilteredCommand(
				"git-upload-pack", "proj-2/git.git");
		final InputStream mockInputStream = context.mock(InputStream.class);
		final OutputStream mockOutputStream = context.mock(OutputStream.class,
				"mockOutputStream");
		final OutputStream mockErrorStream = context.mock(OutputStream.class,
				"mockErrorStream");
		final ExitCallback mockExitCallback = context.mock(ExitCallback.class);

		final GitSCMRepositoryProvider mockRepoProvider = context
				.mock(GitSCMRepositoryProvider.class);
		final Repository mockRepoistory = context.mock(Repository.class);
		final File base = new File(pathtobasedir);
		final GitUploadPackProvider mockUploadPackProvider = context
				.mock(GitUploadPackProvider.class);
		final UploadPack mockUploadPack = context.mock(UploadPack.class);
		final Properties mockConfig = context.mock(Properties.class);

		checking(new Expectations() {
			{
				one(mockRepoProvider).provide(base,
						filteredCommand.getArgument());
// Path: src/test/java/com/asolutions/MockTestCase.java
// public class MockTestCase {
// 
// 	protected Mockery context = new JUnit4Mockery();
// 
// 	@Before
// 	public void setupMockery() {
// 		context.setImposteriser(ClassImposteriser.INSTANCE);
// 	}
// 	
// 	@After
// 	public void mockeryAssertIsSatisfied(){
// 		context.assertIsSatisfied();
// 	}
// 
// 	protected void checking(Expectations expectations) {
// 		context.checking(expectations);
// 	}
// 
// }
// 
// Path: src/main/java/com/asolutions/scmsshd/authorizors/AuthorizationLevel.java
// public enum AuthorizationLevel {
// 	AUTH_LEVEL_READ_ONLY, 
// 	AUTH_LEVEL_READ_WRITE;
// }
// 
// Path: src/main/java/com/asolutions/scmsshd/commands/FilteredCommand.java
// public class FilteredCommand {
// 	
// 	private String command;
// 	private String argument;
// 
// 	public FilteredCommand() {
// 	}
// 	
// 	public FilteredCommand(String command, String argument) {
// 		this.command = command;
// 		this.argument = argument;
// 	}
// 
// 	public void setArgument(String argument) {
// 		this.argument = argument;
// 	}
// 	
// 	public void setCommand(String command) {
// 		this.command = command;
// 	}
// 
// 	public String getCommand() {
// 		return this.command;
// 	}
// 
// 	public String getArgument() {
// 		return this.argument;
// 	}
// 	
// 	@Override
// 	public String toString()
// 	{
// 		return "Filtered Command: " + getCommand() + ", " + getArgument();
// 	}
// 
// }
// 
// Path: src/main/java/com/asolutions/scmsshd/commands/factories/GitSCMCommandFactory.java
// public class GitSCMCommandFactory implements ISCMCommandFactory {
// 
// 	public static final String REPOSITORY_BASE = "repositoryBase";
// 
// 	public Command create(FilteredCommand filteredCommand,
// 			IProjectAuthorizer projectAuthorizer,
// 			IPathToProjectNameConverter pathToProjectNameConverter,
// 			Properties configuration) {
// 		SCMCommand retVal = new SCMCommand(filteredCommand, projectAuthorizer, new GitSCMCommandHandler(), pathToProjectNameConverter, configuration);
// 		return retVal;
// 	}
// 
// }


// Path: src/test/java/com/asolutions/scmsshd/commands/git/GitUploadPackSCMCommandHandlerTest.java
import java.io.File;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Properties;
import org.apache.sshd.server.CommandFactory.ExitCallback;
import org.jmock.Expectations;
import org.junit.Test;
import org.spearce.jgit.lib.Repository;
import org.spearce.jgit.transport.UploadPack;
import com.asolutions.MockTestCase;
import com.asolutions.scmsshd.authorizors.AuthorizationLevel;
import com.asolutions.scmsshd.commands.FilteredCommand;
import com.asolutions.scmsshd.commands.factories.GitSCMCommandFactory;

package com.asolutions.scmsshd.commands.git;




public class GitUploadPackSCMCommandHandlerTest extends MockTestCase {

	@Test
	public void testUploadPackPassesCorrectStuffToJGIT() throws Exception {
		final String pathtobasedir = "pathtobasedir";

		final FilteredCommand filteredCommand = new FilteredCommand(
				"git-upload-pack", "proj-2/git.git");
		final InputStream mockInputStream = context.mock(InputStream.class);
		final OutputStream mockOutputStream = context.mock(OutputStream.class,
				"mockOutputStream");
		final OutputStream mockErrorStream = context.mock(OutputStream.class,
				"mockErrorStream");
		final ExitCallback mockExitCallback = context.mock(ExitCallback.class);

		final GitSCMRepositoryProvider mockRepoProvider = context
				.mock(GitSCMRepositoryProvider.class);
		final Repository mockRepoistory = context.mock(Repository.class);
		final File base = new File(pathtobasedir);
		final GitUploadPackProvider mockUploadPackProvider = context
				.mock(GitUploadPackProvider.class);
		final UploadPack mockUploadPack = context.mock(UploadPack.class);
		final Properties mockConfig = context.mock(Properties.class);

		checking(new Expectations() {
			{
				one(mockRepoProvider).provide(base,
						filteredCommand.getArgument());
				will(returnValue(mockRepoistory));