// Path: server/core/src/main/java/org/kercoin/magrit/core/Configuration.java
// public class Configuration {
// 
// 	private static final String DEFAULT_BASE_DIR = System.getProperty("java.io.tmpdir") + "/magrit";
// 
// 	private int sshPort = 2022;
// 	
// 	private File repositoriesHomeDir = new File(DEFAULT_BASE_DIR, "repos");
// 	
// 	private File publickeysRepositoryDir = new File(DEFAULT_BASE_DIR, "keys");
// 	
// 	private File workHomeDir = new File(DEFAULT_BASE_DIR, "builds");
// 
// 	private Authentication authentication = Authentication.SSH_PUBLIC_KEYS;
// 
// 	private boolean remoteAllowed;
// 	
// 	public static enum Authentication {
// 		SSH_PUBLIC_KEYS { public String external() { return "ssh-public-keys"; } },
// 		NONE { public String external() { return "none"; } };
// 		
// 		public abstract String external();
// 
// 		/**
// 		 * @param authValue
// 		 * @return
// 		 */
// 		public static Authentication fromExternalValue(String authValue) {
// 			for (Authentication auth : Authentication.values()) {
// 				if (auth.external().equals(authValue)) {
// 					return auth;
// 				}
// 			}
// 			return Authentication.NONE;
// 		}
// 	}
// 
// 	public int getSshPort() {
// 		return sshPort;
// 	}
// 
// 	public void setSshPort(int sshPort) {
// 		this.sshPort = sshPort;
// 	}
// 	
// 	public Authentication getAuthentication() {
// 		return authentication;
// 	}
// 	
// 	public void setAuthentication(Authentication authentication) {
// 		this.authentication = authentication;
// 	}
// 	
// 	public File getRepositoriesHomeDir() {
// 		return repositoriesHomeDir;
// 	}
// 
// 	public void setRepositoriesHomeDir(File repositoriesHomeDir) {
// 		this.repositoriesHomeDir = repositoriesHomeDir;
// 	}
// 	
// 	public File getWorkHomeDir() {
// 		return workHomeDir;
// 	}
// 	
// 	public void setWorkHomeDir(File workHomeDir) {
// 		this.workHomeDir = workHomeDir;
// 	}
// 
// 	public File getPublickeyRepositoryDir() {
// 		return publickeysRepositoryDir;
// 	}
// 	
// 	public void setPublickeysRepositoryDir(File publickeysRepositoryDir) {
// 		this.publickeysRepositoryDir = publickeysRepositoryDir;
// 	}
// 
// 	public void applyStandardLayout(String dir) {
// 		repositoriesHomeDir = new File(dir, "bares");
// 		workHomeDir = new File(dir, "builds");
// 		publickeysRepositoryDir = new File(dir, "keys");
// 	}
// 
// 	public boolean isRemoteAllowed() {
// 		return remoteAllowed;
// 	}
// 
// 	public void setRemoteAllowed(boolean remoteAllowed) {
// 		this.remoteAllowed = remoteAllowed;
// 	}
// 
// 	public int getSlots() {
// 		return Runtime.getRuntime().availableProcessors();
// 	}
// 	
// }
// 
// Path: server/core/src/main/java/org/kercoin/magrit/core/Configuration.java
// public static enum Authentication {
// 	SSH_PUBLIC_KEYS { public String external() { return "ssh-public-keys"; } },
// 	NONE { public String external() { return "none"; } };
// 		
// 	public abstract String external();
// 
// 	/**
// 	 * @param authValue
// 	 * @return
// 	 */
// 	public static Authentication fromExternalValue(String authValue) {
// 		for (Authentication auth : Authentication.values()) {
// 			if (auth.external().equals(authValue)) {
// 				return auth;
// 			}
// 		}
// 		return Authentication.NONE;
// 	}
// }


import static org.fest.assertions.Assertions.assertThat;
import java.io.File;
import org.fest.assertions.GenericAssert;
import org.kercoin.magrit.core.Configuration;
import org.kercoin.magrit.core.Configuration.Authentication;
/*
Copyright 2011-2012 Frederic Menou and others referred in AUTHORS file.

This file is part of Magrit.

Magrit is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later version.

Magrit is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public
License along with Magrit.
If not, see <http://www.gnu.org/licenses/>.
*/
package tests;




public class ConfigurationAssert extends GenericAssert<ConfigurationAssert, Configuration> {

	ConfigurationAssert(Class<ConfigurationAssert> selfType,
			Configuration actual) {
		super(selfType, actual);
	}
	
	public ConfigurationAssert onPort(int expected) {
		assertThat(actual.getSshPort()).isEqualTo(expected);
		return this;
	}

	public ConfigurationAssert hasHomeDir(String absolutePath) {
		assertThat(actual.getRepositoriesHomeDir().getAbsolutePath()).isEqualTo(cleanPath(absolutePath));
		return this;
	}
	
	public ConfigurationAssert hasWorkDir(String absolutePath) {
		assertThat(actual.getWorkHomeDir().getAbsolutePath()).isEqualTo(cleanPath(absolutePath));
		return this;
	}

	public ConfigurationAssert hasPublickeyDir(String absolutePath) {
		assertThat(actual.getPublickeyRepositoryDir().getAbsolutePath()).isEqualTo(cleanPath(absolutePath));
		return this;
	}

// Path: server/core/src/main/java/org/kercoin/magrit/core/Configuration.java
// public class Configuration {
// 
// 	private static final String DEFAULT_BASE_DIR = System.getProperty("java.io.tmpdir") + "/magrit";
// 
// 	private int sshPort = 2022;
// 	
// 	private File repositoriesHomeDir = new File(DEFAULT_BASE_DIR, "repos");
// 	
// 	private File publickeysRepositoryDir = new File(DEFAULT_BASE_DIR, "keys");
// 	
// 	private File workHomeDir = new File(DEFAULT_BASE_DIR, "builds");
// 
// 	private Authentication authentication = Authentication.SSH_PUBLIC_KEYS;
// 
// 	private boolean remoteAllowed;
// 	
// 	public static enum Authentication {
// 		SSH_PUBLIC_KEYS { public String external() { return "ssh-public-keys"; } },
// 		NONE { public String external() { return "none"; } };
// 		
// 		public abstract String external();
// 
// 		/**
// 		 * @param authValue
// 		 * @return
// 		 */
// 		public static Authentication fromExternalValue(String authValue) {
// 			for (Authentication auth : Authentication.values()) {
// 				if (auth.external().equals(authValue)) {
// 					return auth;
// 				}
// 			}
// 			return Authentication.NONE;
// 		}
// 	}
// 
// 	public int getSshPort() {
// 		return sshPort;
// 	}
// 
// 	public void setSshPort(int sshPort) {
// 		this.sshPort = sshPort;
// 	}
// 	
// 	public Authentication getAuthentication() {
// 		return authentication;
// 	}
// 	
// 	public void setAuthentication(Authentication authentication) {
// 		this.authentication = authentication;
// 	}
// 	
// 	public File getRepositoriesHomeDir() {
// 		return repositoriesHomeDir;
// 	}
// 
// 	public void setRepositoriesHomeDir(File repositoriesHomeDir) {
// 		this.repositoriesHomeDir = repositoriesHomeDir;
// 	}
// 	
// 	public File getWorkHomeDir() {
// 		return workHomeDir;
// 	}
// 	
// 	public void setWorkHomeDir(File workHomeDir) {
// 		this.workHomeDir = workHomeDir;
// 	}
// 
// 	public File getPublickeyRepositoryDir() {
// 		return publickeysRepositoryDir;
// 	}
// 	
// 	public void setPublickeysRepositoryDir(File publickeysRepositoryDir) {
// 		this.publickeysRepositoryDir = publickeysRepositoryDir;
// 	}
// 
// 	public void applyStandardLayout(String dir) {
// 		repositoriesHomeDir = new File(dir, "bares");
// 		workHomeDir = new File(dir, "builds");
// 		publickeysRepositoryDir = new File(dir, "keys");
// 	}
// 
// 	public boolean isRemoteAllowed() {
// 		return remoteAllowed;
// 	}
// 
// 	public void setRemoteAllowed(boolean remoteAllowed) {
// 		this.remoteAllowed = remoteAllowed;
// 	}
// 
// 	public int getSlots() {
// 		return Runtime.getRuntime().availableProcessors();
// 	}
// 	
// }
// 
// Path: server/core/src/main/java/org/kercoin/magrit/core/Configuration.java
// public static enum Authentication {
// 	SSH_PUBLIC_KEYS { public String external() { return "ssh-public-keys"; } },
// 	NONE { public String external() { return "none"; } };
// 		
// 	public abstract String external();
// 
// 	/**
// 	 * @param authValue
// 	 * @return
// 	 */
// 	public static Authentication fromExternalValue(String authValue) {
// 		for (Authentication auth : Authentication.values()) {
// 			if (auth.external().equals(authValue)) {
// 				return auth;
// 			}
// 		}
// 		return Authentication.NONE;
// 	}
// }


// Path: server/core/src/test/java/tests/ConfigurationAssert.java
import static org.fest.assertions.Assertions.assertThat;
import java.io.File;
import org.fest.assertions.GenericAssert;
import org.kercoin.magrit.core.Configuration;
import org.kercoin.magrit.core.Configuration.Authentication;

/*
Copyright 2011-2012 Frederic Menou and others referred in AUTHORS file.

This file is part of Magrit.

Magrit is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later version.

Magrit is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public
License along with Magrit.
If not, see <http://www.gnu.org/licenses/>.
*/
package tests;




public class ConfigurationAssert extends GenericAssert<ConfigurationAssert, Configuration> {

	ConfigurationAssert(Class<ConfigurationAssert> selfType,
			Configuration actual) {
		super(selfType, actual);
	}
	
	public ConfigurationAssert onPort(int expected) {
		assertThat(actual.getSshPort()).isEqualTo(expected);
		return this;
	}

	public ConfigurationAssert hasHomeDir(String absolutePath) {
		assertThat(actual.getRepositoriesHomeDir().getAbsolutePath()).isEqualTo(cleanPath(absolutePath));
		return this;
	}
	
	public ConfigurationAssert hasWorkDir(String absolutePath) {
		assertThat(actual.getWorkHomeDir().getAbsolutePath()).isEqualTo(cleanPath(absolutePath));
		return this;
	}

	public ConfigurationAssert hasPublickeyDir(String absolutePath) {
		assertThat(actual.getPublickeyRepositoryDir().getAbsolutePath()).isEqualTo(cleanPath(absolutePath));
		return this;
	}

	public ConfigurationAssert hasAuthentication(Authentication expected) {