package com.tek42.perforce.parse;

import java.util.List;

import junit.framework.TestCase;

import com.tek42.perforce.Depot;
import com.tek42.perforce.PerforceException;

/*
 * some basic, non-reproducible unit tests, to help learn the p4java library. 
 */
public class ChangesTest extends TestCase {

	private static final String WORKSPACE = "Brian-mcwest5";
	private static final String PATH = "//testfw/...";
	private Depot depot;
	
	boolean depotIsValid = true; 

// These tests are commented out since they assume presence of a local perforce server. 	
	@Override
	protected void setUp() throws Exception {
		super.setUp();
		depot = new Depot();
		depot.setPort("localhost:1666");
		depot.setUser("Brian");
		try { 
		depotIsValid = depot.getStatus().isValid();
		} catch (Exception e) { 
			depotIsValid = false;
		}
	}

	public void testGetChangeNumbersTo() throws PerforceException {
		if (!depotIsValid) { 
			return; 
		}
		
		List<Integer> numbers = depot.getChanges()
			.getChangeNumbersTo(WORKSPACE, PATH, 107);
		assert(numbers != null);
	}
	
	public void testGetChangeNumbers() throws PerforceException { 
		if (!depotIsValid) { 
			return; 
		}
		
		List<Integer> changes = depot.getChanges()
			.getChangeNumbers(PATH, -1, 10);
		assert(changes != null);
	}
	
	public void testGetChangeNumbersToWithMoreThanThreePaths() throws PerforceException {
		if (!depotIsValid) { 
			return; 
		}
		
		List<Integer> numbers = depot.getChanges()
			.getChangeNumbersTo("//testfw/... //testproj/... " +
					"//testfw/... //testfw/src/...", 1);
		assert(numbers != null);
		
	}

	
	
	 

}

@@ -822,16 +822,18 @@
 %09%09%7D%0A%09%7D%0A%0A
+//
 %09public 
@@ -881,32 +881,34 @@
 orceException %7B%0A
+//
 %09%09if (!depotIsVa
@@ -907,32 +907,34 @@
 epotIsValid) %7B %0A
+//
 %09%09%09return; %0A%09%09%7D%0A
@@ -921,39 +921,45 @@
  %0A//%09%09%09return; %0A
+//
 %09%09%7D%0A
+//
 %09%09%0A
+//
 %09%09List%3CInteger%3E 
@@ -979,32 +979,34 @@
 ot.getChanges()%0A
+//
 %09%09%09.getChangeNum
@@ -1035,16 +1035,18 @@
 , 107);%0A
+//
 %09%09assert
@@ -1056,32 +1056,34 @@
 mbers != null);%0A
+//
 %09%7D%0A%09%0A%09public voi

remove method call that's not yet supported by p4java