Search in sources :

Example 11 with Settings

use of org.apache.maven.scm.providers.clearcase.settings.Settings in project maven-scm by apache.

the class ClearCaseScmProviderRepositoryTest method testParsingUrlClearCaseUCMWithPipe.

public void testParsingUrlClearCaseUCMWithPipe() throws ScmRepositoryException {
    Settings settings = new Settings();
    settings.setClearcaseType(ClearCaseScmProviderRepository.CLEARCASE_UCM);
    String delimiter = "|";
    String viewName = "my_module_view";
    String configSpecPath = "//myserver/ClearCase/ConfigSpecs/mymodule.txt";
    String vobName = "pvob_alliance";
    String streamName = "INT_COMMUN_V1.0";
    String url = viewName + delimiter + configSpecPath + delimiter + vobName + delimiter + streamName;
    ClearCaseScmProviderRepository repository = new ClearCaseScmProviderRepository(new DefaultLog(), url, settings);
    assertEquals(new File(configSpecPath).getPath(), repository.getConfigSpec().getPath());
    assertEquals(viewName, repository.getViewName("bla"));
    assertNull(repository.getLoadDirectory());
    assertEquals(streamName, repository.getStreamName());
    assertEquals(vobName, repository.getVobName());
}
Also used : DefaultLog(org.apache.maven.scm.log.DefaultLog) File(java.io.File) Settings(org.apache.maven.scm.providers.clearcase.settings.Settings)

Example 12 with Settings

use of org.apache.maven.scm.providers.clearcase.settings.Settings in project maven-scm by apache.

the class ClearCaseScmProviderRepositoryTest method testAutoConfigSpecWithoutViewName.

public void testAutoConfigSpecWithoutViewName() throws Exception {
    Settings settings = new Settings();
    String url = "load /VOB/some/dir";
    ClearCaseScmProviderRepository repository = new ClearCaseScmProviderRepository(new DefaultLog(), url, settings);
    assertNull(repository.getConfigSpec());
    assertTrue(repository.isAutoConfigSpec());
    assertNotNull(repository.getViewName("15"));
    assertTrue(repository.getViewName("15").indexOf("15") != -1);
    assertEquals("/VOB/some/dir", repository.getLoadDirectory());
    assertNull(repository.getStreamName());
    assertNull(repository.getVobName());
}
Also used : DefaultLog(org.apache.maven.scm.log.DefaultLog) Settings(org.apache.maven.scm.providers.clearcase.settings.Settings)

Example 13 with Settings

use of org.apache.maven.scm.providers.clearcase.settings.Settings in project maven-scm by apache.

the class ClearCaseScmProviderRepositoryTest method testParsingUrlClearCaseUCMWithoutViewnameWithColonAndElement.

public void testParsingUrlClearCaseUCMWithoutViewnameWithColonAndElement() throws ScmRepositoryException {
    Settings settings = new Settings();
    settings.setClearcaseType(ClearCaseScmProviderRepository.CLEARCASE_UCM);
    String delimiter = ":";
    String configSpecPath = "//myserver/ClearCase/ConfigSpecs/mymodule.txt";
    String vobName = "pvob_alliance";
    String streamName = "INT_COMMUN_V1.0";
    String elementName = "/main/element/LATEST";
    String url = configSpecPath + delimiter + vobName + delimiter + streamName + delimiter + elementName;
    ClearCaseScmProviderRepository repository = new ClearCaseScmProviderRepository(new DefaultLog(), url, settings);
    assertEquals(new File(configSpecPath).getPath(), repository.getConfigSpec().getPath());
    assertNotNull(repository.getViewName("bla"));
    assertNull(repository.getLoadDirectory());
    assertEquals(streamName, repository.getStreamName());
    assertEquals(vobName, repository.getVobName());
    assertEquals(elementName, repository.getElementName());
}
Also used : DefaultLog(org.apache.maven.scm.log.DefaultLog) File(java.io.File) Settings(org.apache.maven.scm.providers.clearcase.settings.Settings)

Example 14 with Settings

use of org.apache.maven.scm.providers.clearcase.settings.Settings in project maven-scm by apache.

the class ClearCaseChangeLogCommand method createCommandLine.

// ----------------------------------------------------------------------
// 
// ----------------------------------------------------------------------
/**
 * ClearCase LT version doesn't support the attribut -fmt and -since for command lhistory.
 *
 * @param workingDirectory
 * @param branch
 * @param startDate
 * @return The command line
 */
public static Commandline createCommandLine(File workingDirectory, ScmBranch branch, Date startDate) {
    Commandline command = new Commandline();
    command.setExecutable("cleartool");
    command.createArg().setValue("lshistory");
    command.setWorkingDirectory(workingDirectory.getAbsolutePath());
    Settings settings = ClearCaseUtil.getSettings();
    String userFormat = StringUtils.isEmpty(settings.getChangelogUserFormat()) ? "" : settings.getChangelogUserFormat();
    StringBuilder format = new StringBuilder();
    format.append("NAME:%En\\n");
    format.append("DATE:%Nd\\n");
    format.append("COMM:%-12.12o - %o - %c - Activity: %[activity]p\\n");
    format.append("USER:%" + userFormat + "u\\n");
    format.append("REVI:%Ln\\n");
    command.createArg().setValue("-fmt");
    command.createArg().setValue(format.toString());
    command.createArg().setValue("-recurse");
    command.createArg().setValue("-nco");
    if (startDate != null) {
        SimpleDateFormat sdf = new SimpleDateFormat("dd-MMM-yyyy", Locale.ENGLISH);
        String start = sdf.format(startDate);
        command.createArg().setValue("-since");
        command.createArg().setValue(start);
    }
    if (branch != null && StringUtils.isNotEmpty(branch.getName())) {
        command.createArg().setValue("-branch");
        command.createArg().setValue(branch.getName());
    }
    return command;
}
Also used : Commandline(org.codehaus.plexus.util.cli.Commandline) SimpleDateFormat(java.text.SimpleDateFormat) Settings(org.apache.maven.scm.providers.clearcase.settings.Settings)

Aggregations

Settings (org.apache.maven.scm.providers.clearcase.settings.Settings)14 DefaultLog (org.apache.maven.scm.log.DefaultLog)12 File (java.io.File)7 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 SimpleDateFormat (java.text.SimpleDateFormat)1 ClearcaseXpp3Reader (org.apache.maven.scm.providers.clearcase.settings.io.xpp3.ClearcaseXpp3Reader)1 Commandline (org.codehaus.plexus.util.cli.Commandline)1 XmlPullParserException (org.codehaus.plexus.util.xml.pull.XmlPullParserException)1