// 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/handlers/ISCMCommandHandler.java
// public interface ISCMCommandHandler {
// 
// 	void execute(FilteredCommand filteredCommand, InputStream inputStream,
// 			OutputStream outputStream, OutputStream errorStream,
// 			ExitCallback exitCallback, Properties configuration, AuthorizationLevel authorizationLevel);
// 
// }


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 com.asolutions.MockTestCase;
import com.asolutions.scmsshd.authorizors.AuthorizationLevel;
import com.asolutions.scmsshd.commands.FilteredCommand;
import com.asolutions.scmsshd.commands.handlers.ISCMCommandHandler;
package com.asolutions.scmsshd.commands.git;




public class GitSCMCommandHandlerTest extends MockTestCase {
	
	@Test
	public void testExecuteWithUploadPack() throws Exception {
		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 ISCMCommandHandler mockUploadPackHandler = context.mock(ISCMCommandHandler.class, "mockUploadPackHandler");
		final ISCMCommandHandler mockFetchPackHandler = context.mock(ISCMCommandHandler.class, "mockFetchPackHandler");
		
		final Properties mockProperties = context.mock(Properties.class);
		
		checking(new Expectations(){{
			one(mockUploadPackHandler).execute(filteredCommand, mockInputStream, mockOutputStream, mockErrorStream, mockExitCallback, mockProperties, AuthorizationLevel.AUTH_LEVEL_READ_WRITE);
		}});
		
		GitSCMCommandHandler handler = new GitSCMCommandHandler(mockUploadPackHandler, mockFetchPackHandler);
		handler.execute(filteredCommand, mockInputStream, mockOutputStream, mockErrorStream, mockExitCallback, mockProperties, AuthorizationLevel.AUTH_LEVEL_READ_WRITE);
	}
	
	@Test
	public void testWithUploadPackReadOnlyAccessLevelWorks() throws Exception {
		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);
// 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/handlers/ISCMCommandHandler.java
// public interface ISCMCommandHandler {
// 
// 	void execute(FilteredCommand filteredCommand, InputStream inputStream,
// 			OutputStream outputStream, OutputStream errorStream,
// 			ExitCallback exitCallback, Properties configuration, AuthorizationLevel authorizationLevel);
// 
// }


// Path: src/test/java/com/asolutions/scmsshd/commands/git/GitSCMCommandHandlerTest.java
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 com.asolutions.MockTestCase;
import com.asolutions.scmsshd.authorizors.AuthorizationLevel;
import com.asolutions.scmsshd.commands.FilteredCommand;
import com.asolutions.scmsshd.commands.handlers.ISCMCommandHandler;

package com.asolutions.scmsshd.commands.git;




public class GitSCMCommandHandlerTest extends MockTestCase {
	
	@Test
	public void testExecuteWithUploadPack() throws Exception {
		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 ISCMCommandHandler mockUploadPackHandler = context.mock(ISCMCommandHandler.class, "mockUploadPackHandler");
		final ISCMCommandHandler mockFetchPackHandler = context.mock(ISCMCommandHandler.class, "mockFetchPackHandler");
		
		final Properties mockProperties = context.mock(Properties.class);
		
		checking(new Expectations(){{
			one(mockUploadPackHandler).execute(filteredCommand, mockInputStream, mockOutputStream, mockErrorStream, mockExitCallback, mockProperties, AuthorizationLevel.AUTH_LEVEL_READ_WRITE);
		}});
		
		GitSCMCommandHandler handler = new GitSCMCommandHandler(mockUploadPackHandler, mockFetchPackHandler);
		handler.execute(filteredCommand, mockInputStream, mockOutputStream, mockErrorStream, mockExitCallback, mockProperties, AuthorizationLevel.AUTH_LEVEL_READ_WRITE);
	}
	
	@Test
	public void testWithUploadPackReadOnlyAccessLevelWorks() throws Exception {
		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 ISCMCommandHandler mockUploadPackHandler = context.mock(ISCMCommandHandler.class, "mockUploadPackHandler");