Permalink
Browse files

Added posted delivery handling & filtering on mastership

  • Loading branch information...
1 parent b4cc1db commit 4a7409146ec9c5deb4656620463fa0ef3243900f @les-praqma les-praqma committed Mar 15, 2012
View
59 bin/TestPostedDelivery.bat
@@ -0,0 +1,59 @@
+
+@echo OFF
+
+set program=%1
+set args=%*
+set package=net.praqma.cli
+echo set COOL_HOME=C:\Users\les\workspace\cool
+
+IF NOT "%program%"=="" GOTO programok
+
+echo.
+echo The program was not given
+echo.
+
+EXIT /B 1
+
+:programok
+
+IF NOT "%COOL_HOME%"=="" GOTO coolhomeok
+
+echo.
+echo COOL_HOME is not set
+echo.
+
+EXIT /B 1
+
+:coolhomeok
+
+set COOL_JAR=%COOL_HOME%\build\COOL.jar
+echo set COOL_JAR=%COOL_HOME%\build\COOL-0.3.41-jar-with-dependencies.jar
+
+if exist "%COOL_JAR%" goto start
+
+
+echo.
+echo %COOL_JAR% was not found
+echo.
+
+EXIT /B 1
+
+:start
+
+echo cool=java -Dtest="1" -classpath %COOL_JAR% %package%.%program% %args%
+set cool=java -Dcleartool=mock -classpath %COOL_JAR% %package%.%program% %args%
+
+rem echo %cool%
+
+call %cool%
+
+
+@GOTO :EOF
+
+
+:WRONG_PARAMS
+ECHO %1 is missing
+
+
+EXIT /B
+GOTO :EOF
View
42 src/main/java/net/praqma/clearcase/cleartool/CommandLineMock.java
@@ -4,16 +4,22 @@
import java.util.ArrayList;
import java.util.Map;
-import net.praqma.util.debug.Logger;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+
+import net.praqma.clearcase.ucm.entities.UCM;
+import net.praqma.util.debug.*;
+import net.praqma.util.debug.Logger.LogLevel;
+import net.praqma.util.debug.appenders.*;
import net.praqma.util.execute.AbnormalProcessTerminationException;
import net.praqma.util.execute.CmdResult;
import net.praqma.util.execute.CommandLineException;
import net.praqma.util.execute.CommandLineInterface;
public class CommandLineMock implements CommandLineInterface {
- private Logger logger = Logger.getLogger();
-
- private CommandLineMock() {
+ private static Logger logger = Logger.getLogger();
+
+ private CommandLineMock() {
}
@@ -80,7 +86,17 @@ public CmdResult run( String cmd, File dir, boolean merge, boolean ignore ) thro
if( cmd.equals( "cleartool desc -fmt %n::%X[component]p::%X[bl_stream]p::%[plevel]p::%u::%Nd::%[label_status]p baseline:CHW_BASELINE_51_no@\\Cool_PVOB" ) ) {
throw new AbnormalProcessTerminationException( "cleartool: Error: Baseline not found: \"CHW_BASELINE_51_no\"." );
}
-
+
+ if( cmd.equals( "cleartool desc -fmt %n::%X[component]p::%X[bl_stream]p::%[plevel]p::%u::%Nd::%[label_status]p baseline:CHW_BASELINE_51_posted_delivery@\\Cool_PVOB" ) ) {
+ res.stdoutBuffer.append( "CHW_BASELINE_51::_System::Server_int::TESTED::chw::20110810.232400::full" );
+ }
+ /*
+ if( cmd.equals( "cleartool desc -fmt %n::%X[component]p::%X[bl_stream]p::%[plevel]p::%u::%Nd::%[label_status]p baseline:CHW_BASELINE_51_posted_delivery@\\Cool_PVOB" ) ) {
+ res.stdoutBuffer.append( "Deliver operation in progress on stream astream. Dadada. Operation posted from replica xxxx is ready to integrate at replica yyyy. DaDa ");
+ }
+ */
+
+
if( cmd.equals( "cleartool chbl -level RELEASED baseline baseline:CHW_BASELINE_51@\\Cool_PVOB" ) ) {
}
@@ -143,6 +159,7 @@ public CmdResult run( String cmd, File dir, boolean merge, boolean ignore ) thro
*/
/* STREAMS */
+ //logger.debug("CMD = " + cmd);
if( cmd.equals( "cleartool desc -fmt %[rec_bls]p stream:bn_stream@\\Cool_PVOB" ) ) {
res.stdoutBuffer.append( "rec_baseline000001" );
}
@@ -155,6 +172,14 @@ public CmdResult run( String cmd, File dir, boolean merge, boolean ignore ) thro
res.stdoutBuffer.append( "rec_baseline000001" );
}
+ //logger.debug("CMD = " + "cleartool describe -fmt %[name]p\\n%[project]Xp\\n%X[def_deliver_tgt]p\\n%[read_only]p\\n%[found_bls]Xp stream:bn_stream@\\Cool_PVOB");
+ if( cmd.contains( "cleartool describe -fmt %[name]p\\n%[project]Xp\\n%X[def_deliver_tgt]p\\n%[read_only]p\\n%[found_bls]Xp stream:bn_stream@\\Cool_PVOB" ) ) {
+ res.stdoutList.add( "rec_baseline7" );
+ res.stdoutList.add( "bn_project@\\Cool_PVOB" );
+ res.stdoutList.add( "" );
+ res.stdoutList.add( "" );
+ }
+
/* Baselines */
/*
@@ -208,6 +233,13 @@ public CmdResult run( String cmd, File dir, boolean merge, boolean ignore ) thro
res.stdoutList.add( " nobuildnumber.file@1234@\\Cool_PVOB -> " + ( versionDotH != null ? versionDotH.getAbsolutePath() : "version.h" ) + " " );
}
+ // cleartool deliver
+ //
+ logger.debug("CMD = " + cmd);
+ if( cmd.equals( "cleartool deliver -baseline baseline:CHW_BASELINE_51_posted_delivery@\\Cool_PVOB -stream stream:bn_stream@\\Cool_PVOB -target stream:bn_stream@\\Cool_PVOB -to viewtag" ) ) {
+ logger.debug( "CMD = " + cmd );
+ res.stdoutBuffer.append( "Deliver operation in progress on stream astream. Dadada. Operation posted from replica xxxx is ready to integrate at replica yyyy. DaDa ");
+ }
return res;
}
View
26 src/main/java/net/praqma/clearcase/ucm/entities/Baseline.java
@@ -204,14 +204,7 @@ public Stream getStream() throws UCMException {
public boolean deliverForced(Stream stream, Stream target, File viewcontext, String viewtag) throws UCMException {
//logger.info( "Trying to deliver the Baseline " + this.GetFQName() + " from " + stream.GetFQName() + " to " + target.GetFQName() );
- try {
- context.deliver(this, stream, target, viewcontext, viewtag, true, true, true);
- } catch (UCMException e) {
- logger.warning("Could not deliver baseline: " + e.getMessage());
- throw e;
- }
-
- return true;
+ return this.deliver(stream, target, viewcontext, viewtag, true, true, true);
}
/**
@@ -228,8 +221,23 @@ public boolean deliverForced(Stream stream, Stream target, File viewcontext, Str
*/
public boolean deliver(Stream stream, Stream target, File viewcontext, String viewtag, boolean force, boolean complete, boolean abort) throws UCMException {
try {
- return context.deliver(this, stream, target, viewcontext, viewtag, force, complete, abort);
+ return context.deliver(this, stream, target, viewcontext, viewtag, force, complete, abort, false);
} catch (UCMException e) {
+ if (e.type == UCMType.DELIVER_IN_PROGRESS) { //could be a posted delivery
+ String status = context.deliverStatus(stream);
+ if(status.replace( System.getProperty( "line.separator" ), " " ).contains( "Operation posted from" ) ) {
+ try {
+ return context.deliver(null, stream, null, viewcontext, viewtag, force, complete, abort, true);
+ } catch (UCMException e1) {
+ logger.warning("Could not resume posted delivery: " + e1.getMessage());
+ logger.warning(e1);
+ throw e1;
+ }
+
+ }
+
+ }
+
logger.warning("Could not deliver baseline: " + e.getMessage());
logger.warning(e);
throw e;
View
18 src/main/java/net/praqma/clearcase/ucm/entities/Component.java
@@ -45,14 +45,26 @@ public String getRootDir() throws UCMException {
public List<Baseline> getBaselines( Stream stream ) throws UCMException {
logger.debug( "Getting Baselines from " + stream.getFullyQualifiedName() + " and " + getFullyQualifiedName() );
- return UCM.context.getBaselines( stream, this, null, getPvobString() );
- //return new BaselineList( this, stream, null );
+ return this.getBaselines(stream, null, false);
}
public List<Baseline> getBaselines( Stream stream, Project.Plevel plevel ) throws UCMException {
+ logger.debug( "Getting Baselines from " + stream.getFullyQualifiedName() + " and " + getFullyQualifiedName() );
+
+ return this.getBaselines(stream, plevel, false);
+ }
+
+ public List<Baseline> getBaselines( Stream stream, boolean multisitePolling ) throws UCMException {
+ logger.debug( "Getting Baselines from " + stream.getFullyQualifiedName() + " and " + getFullyQualifiedName() );
+
+ return this.getBaselines(stream, null, multisitePolling);
+ //return new BaselineList( this, stream, null );
+ }
+
+ public List<Baseline> getBaselines( Stream stream, Project.Plevel plevel, boolean multisitePolling ) throws UCMException {
logger.debug( "Getting Baselines from " + stream.getFullyQualifiedName() + " and " + this.getFullyQualifiedName() + " with plevel " + plevel );
- return UCM.context.getBaselines( stream, this, plevel, getPvobString() );
+ return stream.getBaselines(this, plevel, multisitePolling);
//return new BaselineList( this, stream, plevel );
}
View
96 src/main/java/net/praqma/clearcase/ucm/entities/Stream.java
@@ -6,9 +6,12 @@
import java.util.Date;
import java.util.Iterator;
import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import net.praqma.clearcase.interfaces.Diffable;
import net.praqma.clearcase.ucm.UCMException;
+import net.praqma.clearcase.ucm.UCMException.UCMType;
import net.praqma.clearcase.ucm.entities.Project.Plevel;
import net.praqma.clearcase.ucm.view.SnapshotView;
import net.praqma.util.debug.Logger;
@@ -31,6 +34,8 @@
private Stream defaultTarget = null;
private boolean readOnly = true;
private Baseline foundation;
+
+ private String status = null;
private Stream parent;
@@ -91,16 +96,26 @@ public void load() throws UCMException {
this.loaded = true;
}
- public List<Baseline> getBaselines( Plevel plevel ) throws UCMException {
- return context.getBaselines( this, getSingleTopComponent(), plevel, pvob );
+ public List<Baseline> getBaselines( Plevel plevel, boolean multisitePolling ) throws UCMException {
+ return this.getBaselines(getSingleTopComponent(), plevel, multisitePolling);
}
- public List<Baseline> getBaselines( Component component, Plevel plevel ) throws UCMException {
- return context.getBaselines( this, component, plevel, pvob );
+ public List<Baseline> getBaselines( Component component, Plevel plevel, boolean multisitePolling ) throws UCMException {
+ return this.getBaselines( component, plevel, null, multisitePolling );
}
- public List<Baseline> getBaselines( Component component, Plevel plevel, Date date ) throws UCMException {
- List<Baseline> baselines = context.getBaselines( this, component, plevel, pvob );
+ public List<Baseline> getBaselines( Component component, Plevel plevel, Date date, boolean multisitePolling ) throws UCMException {
+
+ List<Baseline> baselines = null;
+
+ if(this.hasPostedDelivery()) {
+ if(multisitePolling)
+ baselines = this.getPostedBaselines(component, plevel);
+ else
+ baselines = new ArrayList<Baseline>();
+ }
+ else
+ baselines = context.getBaselines( this, component, plevel, pvob );
if( date == null ) {
return baselines;
@@ -119,14 +134,31 @@ public void load() throws UCMException {
return baselines;
}
- public List<Stream> getChildStreams() throws UCMException {
+ public List<Stream> getChildStreams(boolean multisitePolling) throws UCMException {
List<Stream> res = new ArrayList<Stream>();
try {
res = context.getChildStreams( this );
} catch (UCMException e) {
logger.debug( "The Stream has no child streams" );
}
+
+ Iterator<Stream> it = res.iterator();
+ String mastership = this.getMastership();
+ while( it.hasNext() ) {
+ Stream stream = it.next();
+ String childMastership = stream.getMastership();
+ logger.debug( "Child Mastership = %s" + childMastership );
+
+ if(stream.hasPostedDelivery() && !multisitePolling) {
+ logger.debug( "Removing [" + stream.getShortname() + "] due to non-supported posted delivery" );
+ it.remove();
+ }
+ else if(!mastership.equals(childMastership)) {
+ logger.debug( "Removing [" + stream.getShortname() + "] due to different mastership" );
+ it.remove();
+ }
+ }
return res;
}
@@ -261,14 +293,50 @@ public Stream getDefaultTarget() throws UCMException {
return this.defaultTarget;
}
- public boolean deliver( Baseline baseline, Stream target, File viewcontext, String viewtag, boolean force, boolean complete, boolean abort ) throws UCMException {
- try {
- return context.deliver( baseline, this, target, viewcontext, viewtag, force, complete, abort );
- } catch (UCMException e) {
- logger.warning( "Could not deliver baseline: " + e.getMessage() );
- logger.warning( e );
- throw e;
+ public boolean hasPostedDelivery() throws UCMException {
+ if( status == null )
+ status = context.deliverStatus(this);
+ return status.contains( "Operation posted from" );
+ }
+
+ public List<Baseline> getPostedBaselines( Component component, Plevel plevel) throws UCMException {
+ List<Baseline> res = new ArrayList<Baseline>();
+ if( status == null )
+ status = context.deliverStatus(this);
+ Matcher m = Pattern.compile(".*baseline:(\\S*).*").matcher(status);
+ if (m.find()) {
+ logger.warning("Posted baseline : " + m.group(1));
+ //should maybe also select on component
+ Baseline b = UCMEntity.getBaseline( m.group(1), true );
+ if(b.getPromotionLevel(true) == plevel)
+ res.add(b);
}
+ return res;
+ }
+
+
+ public boolean deliver( Baseline baseline, Stream target, File viewcontext, String viewtag, boolean force, boolean complete, boolean abort ) throws UCMException {
+ try {
+ return context.deliver(baseline, this, target, viewcontext, viewtag, force, complete, abort, false);
+ } catch (UCMException e) {
+ if (e.type == UCMType.DELIVER_IN_PROGRESS) { //could be a posted delivery
+ if(this.hasPostedDelivery()) {
+ try {
+ return context.deliver(null, this, null, viewcontext, viewtag, force, complete, abort, true);
+ } catch (UCMException e1) {
+ logger.warning("Could not resume posted delivery: " + e1.getMessage());
+ logger.warning(e1);
+ throw e1;
+ }
+
+ }
+
+ }
+
+ logger.warning("Could not deliver baseline: " + e.getMessage());
+ logger.warning(e);
+ throw e;
+ }
}
public void cancelDeliver( File viewcontext ) throws UCMException {
View
9 src/main/java/net/praqma/clearcase/ucm/persistence/UCMContext.java
@@ -353,15 +353,15 @@ public void recommendBaseline( Stream stream, Baseline baseline ) throws UCMExce
private static final Pattern rx_deliver_find_baseline = Pattern.compile( "Baselines to be delivered:\\s*baseline:", Pattern.MULTILINE | Pattern.CASE_INSENSITIVE );
private static final Pattern rx_deliver_find_nobaseline = Pattern.compile( "Baselines to be delivered:\\s*baseline:", Pattern.MULTILINE | Pattern.CASE_INSENSITIVE );
- public boolean deliver( Baseline baseline, Stream stream, Stream target, File context, String viewtag, boolean force, boolean complete, boolean abort ) throws UCMException {
+ public boolean deliver( Baseline baseline, Stream stream, Stream target, File context, String viewtag, boolean force, boolean complete, boolean abort, boolean resume ) throws UCMException {
logger.debug( "Delivering " + baseline + ", " + stream + ", " + target + ", " + context + ", " + viewtag );
String bl = baseline != null ? baseline.getFullyQualifiedName() : null;
String st = stream != null ? stream.getFullyQualifiedName() : null;
String ta = target != null ? target.getFullyQualifiedName() : null;
// strategy.deliver( baseline.GetFQName(), stream.GetFQName(),
// target.GetFQName(), view.GetViewRoot(), view.GetViewtag(), force,
// complete, abort );
- String result = strategy.deliver( bl, st, ta, context, viewtag, force, complete, abort );
+ String result = strategy.deliver( bl, st, ta, context, viewtag, force, complete, abort, resume );
// System.out.println( "I GOT: \n\"" + result + "\"\n" );
@@ -383,6 +383,11 @@ public boolean deliver( Baseline baseline, Stream stream, Stream target, File co
return true;
}
+ public String deliverStatus(Stream stream ) throws UCMException {
+ String st = stream != null ? stream.getFullyQualifiedName() : null;
+ return strategy.deliverStatus( st );
+ }
+
public void cancelDeliver( File viewcontext, Stream stream ) throws UCMException {
strategy.cancelDeliver( viewcontext, stream );
}
View
4 src/main/java/net/praqma/clearcase/ucm/persistence/UCMStrategyCleartool.java
@@ -546,8 +546,8 @@ public String getBaselineActivities( String baseline ) {
private static final Pattern rx_checkDeliverDenied = Pattern.compile( "does not allow deliver operations from streams in other", Pattern.DOTALL );
private static final Pattern rx_checkProgress = Pattern.compile( "which is currently involved in an.*?active deliver or rebase operation", Pattern.DOTALL );
- public String deliver( String baseline, String stream, String target, File context, String viewtag, boolean force, boolean complete, boolean abort ) throws UCMException {
- String cmd = "deliver" + ( force ? " -force" : "" ) + ( complete ? " -complete" : "" ) + ( abort ? " -abort" : "" );
+ public String deliver( String baseline, String stream, String target, File context, String viewtag, boolean force, boolean complete, boolean abort, boolean resume ) throws UCMException {
+ String cmd = "deliver" + ( force ? " -force" : "" ) + ( complete ? " -complete" : "" ) + ( abort ? " -abort" : "" ) + ( resume ? " -resume" : "" );
cmd += ( baseline != null ? " -baseline " + baseline : "" );
cmd += ( stream != null ? " -stream " + stream : "" );
cmd += ( target != null ? " -target " + target : "" );
View
2 src/main/java/net/praqma/clearcase/ucm/persistence/UCMStrategyInterface.java
@@ -59,7 +59,7 @@
public String getBaselineActivities( String baseline );
- public String deliver( String baseline, String stream, String target, File viewroot, String viewtag, boolean force, boolean complete, boolean abort ) throws UCMException;
+ public String deliver( String baseline, String stream, String target, File viewroot, String viewtag, boolean force, boolean complete, boolean abort, boolean resume ) throws UCMException;
public void cancelDeliver( File viewcontext, Stream stream ) throws UCMException;
public String deliverStatus( String stream ) throws UCMException;
View
2 src/main/java/net/praqma/clearcase/ucm/persistence/UCMStrategyXML.java
@@ -838,7 +838,7 @@ public String getBaselineActivities(String baseline) {
}
@Override
- public String deliver(String baseline, String stream, String target, File viewroot, String viewtag, boolean force, boolean complete, boolean abort)
+ public String deliver(String baseline, String stream, String target, File viewroot, String viewtag, boolean force, boolean complete, boolean abort, boolean resume)
throws UCMException {
// TODO Auto-generated method stub
return null;
View
57 src/main/java/net/praqma/cli/PostedDelivery.java
@@ -0,0 +1,57 @@
+package net.praqma.cli;
+
+import static org.junit.Assert.assertNotNull;
+
+import java.io.File;
+import java.util.Map;
+
+import net.praqma.clearcase.ucm.UCMException;
+import net.praqma.clearcase.ucm.entities.Baseline;
+import net.praqma.clearcase.ucm.entities.Stream;
+import net.praqma.clearcase.ucm.entities.UCM;
+import net.praqma.clearcase.ucm.entities.UCMEntity;
+import net.praqma.clearcase.ucm.view.SnapshotView;
+import net.praqma.util.debug.Logger;
+import net.praqma.util.debug.Logger.LogLevel;
+import net.praqma.util.debug.appenders.StreamAppender;
+import net.praqma.util.option.Option;
+import net.praqma.util.option.Options;
+
+public class PostedDelivery {
+
+ private static Logger logger = Logger.getLogger();
+ private static StreamAppender app = new StreamAppender( System.out );
+
+ public static void main( String[] args ) throws UCMException {
+ try {
+ run( args );
+ } catch( UCMException e ) {
+ System.err.println( UCM.getMessagesAsString() );
+ throw e;
+ }
+ }
+
+ public static void run( String[] args ) throws UCMException {
+
+ //app.setTemplate( "[%level]%space %message%newline" );
+ Logger.addAppender( app );
+ app.setMinimumLevel( LogLevel.DEBUG );
+
+ /* Do the ClearCase thing... */
+ UCM.setContext( UCM.ContextType.CLEARTOOL );
+
+ try {
+ Baseline bl = null; //UCMEntity.getBaseline( "CHW_BASELINE_51_posted_delivery@\\Cool_PVOB", true );
+ Stream source = UCMEntity.getStream("stream:moon-vobadmin_Client@\\Cool_PVOB");
+ Stream target = null;
+ //bl.deliver(source, target, (File) null, "viewtag", false, false, false);
+ source.deliver(bl, target, (File) null, "night-vobadmin_Client_int", true, false, false);
+ } catch( Exception e ) {
+ logger.error( "Error: " + e.getMessage() );
+ System.exit( 1 );
+ }
+
+ logger.debug( "Done");
+ }
+
+}
View
34 src/test/java/net/praqma/clearcase/ucm/entities/BaselineTest.java
@@ -2,18 +2,34 @@
import static org.junit.Assert.*;
+import java.io.File;
+
import org.junit.*;
import net.praqma.clearcase.ucm.UCMException;
+import net.praqma.util.debug.Logger;
+import net.praqma.util.debug.Logger.LogLevel;
+import net.praqma.util.debug.appenders.Appender;
+import net.praqma.util.debug.appenders.ConsoleAppender;
public class BaselineTest
{
+ private static Appender app;
+
@BeforeClass
- public static void startup()
- {
+ public static void startup() {
UCM.setContext( UCM.ContextType.CLEARTOOL );
+
+ app = new ConsoleAppender();
+ app.setMinimumLevel( LogLevel.DEBUG );
+ Logger.addAppender( app );
}
-
+
+ @AfterClass
+ public static void end() {
+ Logger.removeAppender( app );
+ }
+
@Test
public void testLoad()
{
@@ -90,6 +106,18 @@ public void testPromote() throws UCMException
bl.promote();
}
+ @Test
+ public void testDeliver() throws UCMException
+ {
+ Baseline bl = UCMEntity.getBaseline( "CHW_BASELINE_51_posted_delivery@\\Cool_PVOB", true );
+ Stream source = UCMEntity.getStream("stream:bn_stream@\\Cool_PVOB");
+ Stream target = UCMEntity.getStream("stream:bn_stream@\\Cool_PVOB");
+ assertNotNull( bl.stringify() );
+ assertNotNull( source.stringify() );
+ assertNotNull( target.stringify() );
+ bl.deliver(source, target, (File) null, "viewtag", false, false, false);
+ }
+
/*
@Test
public void testDemote()
View
17 src/test/java/net/praqma/clearcase/ucm/entities/ComponentTest.java
@@ -9,13 +9,28 @@
import net.praqma.clearcase.ucm.UCMException;
import net.praqma.clearcase.ucm.entities.Project.Plevel;
import net.praqma.clearcase.ucm.utils.BaselineList;
+import net.praqma.util.debug.Logger;
+import net.praqma.util.debug.Logger.LogLevel;
+import net.praqma.util.debug.appenders.Appender;
+import net.praqma.util.debug.appenders.ConsoleAppender;
public class ComponentTest {
-
+ private static Appender app;
+
@BeforeClass
public static void startup() {
UCM.setContext( UCM.ContextType.CLEARTOOL );
+
+ app = new ConsoleAppender();
+ app.setMinimumLevel( LogLevel.DEBUG );
+ Logger.addAppender( app );
}
+
+ @AfterClass
+ public static void end() {
+ Logger.removeAppender( app );
+ }
+
@Test
public void testLoad() throws UCMException {
View
18 src/test/java/net/praqma/clearcase/ucm/entities/StreamTest.java
@@ -7,12 +7,26 @@
import org.junit.*;
import net.praqma.clearcase.ucm.UCMException;
+import net.praqma.util.debug.Logger;
+import net.praqma.util.debug.Logger.LogLevel;
+import net.praqma.util.debug.appenders.Appender;
+import net.praqma.util.debug.appenders.ConsoleAppender;
public class StreamTest {
+ private static Appender app;
+
@BeforeClass
- public static void startup()
- {
+ public static void startup() {
UCM.setContext( UCM.ContextType.CLEARTOOL );
+
+ app = new ConsoleAppender();
+ app.setMinimumLevel( LogLevel.DEBUG );
+ Logger.addAppender( app );
}
+
+ @AfterClass
+ public static void end() {
+ Logger.removeAppender( app );
+ }
}
View
17 src/test/java/net/praqma/clearcase/ucm/entities/TagTest.java
@@ -8,14 +8,31 @@
import net.praqma.clearcase.Cool;
import net.praqma.clearcase.ucm.UCMException;
+import net.praqma.util.debug.Logger;
+import net.praqma.util.debug.Logger.LogLevel;
+import net.praqma.util.debug.appenders.Appender;
+import net.praqma.util.debug.appenders.ConsoleAppender;
+
+import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
public class TagTest extends Cool {
+ private static Appender app;
+
@BeforeClass
public static void startup() {
UCM.setContext( UCM.ContextType.CLEARTOOL );
+
+ app = new ConsoleAppender();
+ app.setMinimumLevel( LogLevel.DEBUG );
+ Logger.addAppender( app );
}
+
+ @AfterClass
+ public static void end() {
+ Logger.removeAppender( app );
+ }
/*
* @Test public void testPostProcess() { fail( "Not yet implemented" ); }

0 comments on commit 4a74091

Please sign in to comment.