use of com.thoughtworks.go.domain.materials.perforce.P4Client in project gocd by gocd.
the class P4TestRepo method createClientWith.
public P4Client createClientWith(String clientName, String view) throws Exception {
String p4view = view == null ? "\n\t//depot/... //" + clientName + "/..." : "\n\t" + view;
P4Client p4Client = P4Client.fromServerAndPort(null, serverAndPort(), user, password, clientName, useTickets, clientFolder, p4view, inMemoryConsumer(), true);
return p4Client;
}
use of com.thoughtworks.go.domain.materials.perforce.P4Client in project gocd by gocd.
the class P4TestRepo method checkInOneFile.
private List<Modification> checkInOneFile(P4Material p4Material1, String fileName, String comment) throws Exception {
File workingDir = TestFileUtil.createTempFolder("p4-working-dir-" + UUID.randomUUID());
P4Client client = createClient();
client.client(clientConfig(clientName, workingDir), inMemoryConsumer(), true);
File dir = new File(workingDir, p4Material1.getFolder());
dir.mkdirs();
checkout(dir);
File newFile = new File(new File(workingDir, p4Material1.getFolder()), fileName);
newFile.createNewFile();
add(workingDir, newFile.getAbsolutePath());
commit(comment, workingDir);
client.removeClient();
List<Modification> modifications = p4Material1.latestModification(workingDir, new TestSubprocessExecutionContext());
return modifications;
}
use of com.thoughtworks.go.domain.materials.perforce.P4Client in project gocd by gocd.
the class P4Material method getP4.
protected P4Client getP4(File baseDir) {
InMemoryStreamConsumer outputConsumer = inMemoryConsumer();
P4Client p4 = null;
try {
p4 = p4(baseDir, outputConsumer);
} catch (Exception e) {
bomb(e.getMessage() + " " + outputConsumer.getStdError(), e);
}
return p4;
}
use of com.thoughtworks.go.domain.materials.perforce.P4Client in project gocd by gocd.
the class P4MaterialTest method shouldGenerateTheSameP4ClientValueForCommandAndEnvironment.
@Test
public void shouldGenerateTheSameP4ClientValueForCommandAndEnvironment() throws Exception {
P4Material p4Material = new P4Material("server:10", "out-of-the-window");
ReflectionUtil.setField(p4Material, "folder", "crapy_dir");
P4Client p4Client = p4Material._p4(tempDir, new InMemoryStreamConsumer(), false);
assertThat(p4Client, is(not(nullValue())));
String client = (String) ReflectionUtil.getField(p4Client, "p4ClientName");
assertThat(client, is(p4Material.clientName(tempDir)));
}
Aggregations