Search in sources :

Example 1 with WorkSpace

use of org.apache.maven.scm.provider.accurev.WorkSpace in project maven-scm by apache.

the class WorkSpaceConsumer method startTag.

@Override
protected void startTag(List<String> tagPath, Map<String, String> attributes) {
    if ("Element".equals(getTagName(tagPath))) {
        String name = attributes.get("Name");
        long transactionId = Long.valueOf(attributes.get("Trans"));
        WorkSpace ws = new WorkSpace(name, transactionId);
        workSpaces.put(name, ws);
    }
}
Also used : WorkSpace(org.apache.maven.scm.provider.accurev.WorkSpace)

Example 2 with WorkSpace

use of org.apache.maven.scm.provider.accurev.WorkSpace in project maven-scm by apache.

the class AccurevUpdateCommandTest method testUpdateWithChangeLog.

@Test
public void testUpdateWithChangeLog() throws Exception {
    final WorkSpace wsBefore = new WorkSpace("theWorkSpace", 123);
    Map<String, WorkSpace> workspaces = Collections.singletonMap("theWorkSpace", wsBefore);
    when(accurev.showWorkSpaces()).thenReturn(workspaces);
    List<File> emptyList = Collections.emptyList();
    when(accurev.update(eq(basedir), any(String.class))).thenReturn(emptyList);
    final Date currentDate = new Date();
    List<Transaction> transactions = Collections.singletonList(new Transaction(197L, currentDate, "type", "user"));
    when(accurev.history(any(String.class), any(String.class), any(String.class), eq(1), eq(true), eq(true))).thenReturn(transactions);
    AccuRevUpdateCommand command = new AccuRevUpdateCommand(getLogger());
    CommandParameters commandParameters = new CommandParameters();
    commandParameters.setString(CommandParameter.RUN_CHANGELOG_WITH_UPDATE, Boolean.toString(true));
    UpdateScmResult result = command.update(repo, testFileSet, commandParameters);
    assertThat(result.isSuccess(), is(true));
    assertThat(result, IsInstanceOf.instanceOf(AccuRevUpdateScmResult.class));
    AccuRevUpdateScmResult accuRevResult = (AccuRevUpdateScmResult) result;
    assertThat(accuRevResult.getFromRevision(), is("theWorkSpace/123"));
    assertThat(accuRevResult.getToRevision(), is("theWorkSpace/197"));
}
Also used : WorkSpace(org.apache.maven.scm.provider.accurev.WorkSpace) Transaction(org.apache.maven.scm.provider.accurev.Transaction) UpdateScmResult(org.apache.maven.scm.command.update.UpdateScmResult) CommandParameters(org.apache.maven.scm.CommandParameters) File(java.io.File) ScmFileMatcher.assertHasScmFile(org.apache.maven.scm.ScmFileMatcher.assertHasScmFile) Date(java.util.Date) Test(org.junit.Test) AbstractAccuRevCommandTest(org.apache.maven.scm.provider.accurev.command.AbstractAccuRevCommandTest)

Example 3 with WorkSpace

use of org.apache.maven.scm.provider.accurev.WorkSpace in project maven-scm by apache.

the class WorkSpaceConsumerTest method testConsumeShowWorkSpaces.

@Test
public void testConsumeShowWorkSpaces() throws IOException {
    Map<String, WorkSpace> wsMap = new HashMap<String, WorkSpace>();
    XppStreamConsumer consumer = new WorkSpaceConsumer(logger, wsMap);
    AccuRevJUnitUtil.consume("/showworkspaces.xml", consumer);
    WorkSpace ws = wsMap.get("maventst_ggardner");
    assertThat(ws, notNullValue());
    assertThat(ws.getTransactionId(), is(49L));
}
Also used : WorkSpace(org.apache.maven.scm.provider.accurev.WorkSpace) HashMap(java.util.HashMap) Test(org.junit.Test)

Example 4 with WorkSpace

use of org.apache.maven.scm.provider.accurev.WorkSpace in project maven-scm by apache.

the class WorkSpaceConsumerTest method testConsumeShowRefTrees.

@Test
public void testConsumeShowRefTrees() throws IOException {
    Map<String, WorkSpace> wsMap = new HashMap<String, WorkSpace>();
    XppStreamConsumer consumer = new WorkSpaceConsumer(logger, wsMap);
    AccuRevJUnitUtil.consume("/showrefs.xml", consumer);
    WorkSpace ws = wsMap.get("maven-scm-INT-reftree");
    assertThat(ws, notNullValue());
    assertThat(ws.getTransactionId(), is(12L));
}
Also used : WorkSpace(org.apache.maven.scm.provider.accurev.WorkSpace) HashMap(java.util.HashMap) Test(org.junit.Test)

Aggregations

WorkSpace (org.apache.maven.scm.provider.accurev.WorkSpace)4 Test (org.junit.Test)3 HashMap (java.util.HashMap)2 File (java.io.File)1 Date (java.util.Date)1 CommandParameters (org.apache.maven.scm.CommandParameters)1 ScmFileMatcher.assertHasScmFile (org.apache.maven.scm.ScmFileMatcher.assertHasScmFile)1 UpdateScmResult (org.apache.maven.scm.command.update.UpdateScmResult)1 Transaction (org.apache.maven.scm.provider.accurev.Transaction)1 AbstractAccuRevCommandTest (org.apache.maven.scm.provider.accurev.command.AbstractAccuRevCommandTest)1