private void extractWorkspace(String line) { // With no stream (flow target): // Workspace: (1000) "BogusRepositoryWorkspace" <-> (1000) "BogusRepositoryWorkspace" // With a stream: // Workspace: (1156) "GPDBWorkspace" <-> (1157) "GPDBStream" Matcher matcher = WORKSPACE_PATTERN.matcher(line); if (matcher.find()) { JazzScmProviderRepository jazzRepository = (JazzScmProviderRepository) getRepository(); int workspaceAlias = Integer.parseInt(matcher.group(1)); String workspace = matcher.group(2); int streamAlias = Integer.parseInt(matcher.group(3)); String stream = matcher.group(4); if (getLogger().isDebugEnabled()) { getLogger().debug("Successfully parsed \"Workspace:\" line:"); getLogger().debug(" workspaceAlias = " + workspaceAlias); getLogger().debug(" workspace = " + workspace); getLogger().debug(" streamAlias = " + streamAlias); getLogger().debug(" stream = " + stream); } jazzRepository.setWorkspaceAlias(workspaceAlias); jazzRepository.setWorkspace(workspace); jazzRepository.setFlowTargetAlias(streamAlias); jazzRepository.setFlowTarget(stream); } }
/** * Process one line of output from the execution of the "scm status" command. * * @param line The line of output from the external command that has been pumped to us. * @see org.codehaus.plexus.util.cli.StreamConsumer#consumeLine(java.lang.String) */ public void consumeLine(String line) { super.consumeLine(line); if (containsWorkspace(line)) { extractWorkspace(line); } if (containsComponent(line)) { extractComponent(line); } if (containsBaseline(line)) { extractBaseline(line); } if (containsStatusFlag(line)) { extractChangedFile(line); } if (containsOutgoing(line)) { // Now looking for outgoing, not incoming seenOutgoingChangeSets = true; seenIncomingChangeSets = false; } if (containsIncoming(line)) { // Now looking for incoming, not outgoing seenOutgoingChangeSets = false; seenIncomingChangeSets = true; } if (containsBaselines(line)) { // Got to baselines, stop looking for all changesets seenOutgoingChangeSets = false; seenIncomingChangeSets = false; } if (seenOutgoingChangeSets) { Integer changeSetAlias = extractChangeSetAlias(line); if (changeSetAlias != null) { // We are now supporting multiple change sets, as this allows // us to cater for multiple changeset caused by previous failed // release attempts. // Our starting point should always be a clean slate of a workspace // or sandbox, however, if something fails, then we will have some // changesets already created, so we need to be able to deal with them effectively. JazzScmProviderRepository jazzRepository = (JazzScmProviderRepository) getRepository(); jazzRepository.getOutgoingChangeSetAliases().add(new Integer(changeSetAlias)); } } if (seenIncomingChangeSets) { Integer changeSetAlias = extractChangeSetAlias(line); if (changeSetAlias != null) { // We are now supporting multiple change sets, as this allows // us to cater for multiple changeset caused by previous failed // release attempts. // Our starting point should always be a clean slate of a workspace // or sandbox, however, if something fails, then we will have some // changesets already created, so we need to be able to deal with them effectively. JazzScmProviderRepository jazzRepository = (JazzScmProviderRepository) getRepository(); jazzRepository.getIncomingChangeSetAliases().add(new Integer(changeSetAlias)); } } }
protected void setUp() throws Exception { super.setUp(); repo = getScmProviderRepository(); // Simulate the output of the parsing of the "scm status" command. // IE, fill in the workspace and stream details // Only needed for tests that require "pushChanges" type operations. repo.setWorkspace("Dave's Repository Workspace"); repo.setFlowTarget("Dave's Stream"); }
private void extractBaseline(String line) { // Baseline: (1128) 27 "BogusTestJazz-3.0.0.40" Matcher matcher = BASELINE_PATTERN.matcher(line); if (matcher.find()) { JazzScmProviderRepository jazzRepository = (JazzScmProviderRepository) getRepository(); int baselineAlias = Integer.parseInt(matcher.group(1)); int baselineId = Integer.parseInt(matcher.group(2)); String baseline = matcher.group(3); if (getLogger().isDebugEnabled()) { getLogger().debug("Successfully parsed \"Baseline:\" line:"); getLogger().debug(" baselineAlias = " + baselineAlias); getLogger().debug(" baselineId = " + baselineId); getLogger().debug(" baseline = " + baseline); } jazzRepository.setBaseline(baseline); } }
private void extractComponent(String line) { // With no stream (flow target): // Component: (1001) "BogusComponent" // With a stream: // Component: (1158) "GPDB" <-> (1157) "GPDBStream" // With some additional information: // Component: (1002) "FireDragon" <-> (1005) "MavenR3Stream Workspace" (outgoing addition) Matcher matcher = COMPONENT_PATTERN1.matcher(line); if (matcher.find()) { // Component: (1001) "BogusComponent" JazzScmProviderRepository jazzRepository = (JazzScmProviderRepository) getRepository(); int componentAlias = Integer.parseInt(matcher.group(1)); String component = matcher.group(2); if (getLogger().isDebugEnabled()) { getLogger().debug("Successfully parsed \"Component:\" line:"); getLogger().debug(" componentAlias = " + componentAlias); getLogger().debug(" component = " + component); } jazzRepository.setComponent(component); } matcher = COMPONENT_PATTERN2.matcher(line); if (matcher.find()) { // Component: (1158) "GPDB" <-> (1157) "GPDBStream" JazzScmProviderRepository jazzRepository = (JazzScmProviderRepository) getRepository(); int componentAlias = Integer.parseInt(matcher.group(1)); String component = matcher.group(2); if (getLogger().isDebugEnabled()) { getLogger().debug("Successfully parsed \"Component:\" line:"); getLogger().debug(" componentAlias = " + componentAlias); getLogger().debug(" component = " + component); } jazzRepository.setComponent(component); } }