This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def 'test get template pages with exception'() { | |
given: | |
when: | |
service.getTemplatePages() | |
then: | |
1 * accountService.validateTemplateAccount() >> { | |
throw new ClientSetupException("Ta da!") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
public class Groups{ | |
private static final List<Character> OPEN = Arrays.asList('(', '{', '['); | |
private static final List<Character> CLOSE = Arrays.asList(')', '}', ']'); | |
public static boolean groupCheck(String s){ | |
if (s == null || s.length() == 0) { | |
return true; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Groups{ | |
public static boolean groupCheck(String s) { | |
int len; | |
do { | |
len = s.length(); | |
s = s.replace("()", ""); | |
s = s.replace("{}", ""); | |
s = s.replace("[]", ""); | |
} while (len != s.length()); | |
return s.length() == 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# stopping web app | |
sudo service tomcat6 stop | |
# upload a jar file | |
wget http://ftp-stud.fht-esslingen.de/pub/Mirrors/eclipse/eclipse/downloads/drops4/R-4.6.2-201611241400/ecj-4.6.2.jar -O /opt/publishthis/ecj-4.6.2.jar | |
# clean up tomcat temp dirs | |
sudo rm -rf /opt/publishthis/api/distrib/ROOT | |
sudo rm -rf /usr/share/tomcat6/work/* | |
sudo rm -rf /usr/share/tomcat6/cache/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# log in as appuser to img01/02 | |
sudo service tomcat6 stop | |
# check | |
ps aux | grep tomcat | |
# log in as root to img01/02 | |
wget http://ftp-stud.fht-esslingen.de/pub/Mirrors/eclipse/eclipse/downloads/drops4/R-4.6.2-201611241400/ecj-4.6.2.jar -O /opt/publishthis/ecj-4.6.2.jar | |
sudo cp /opt/publishthis/ecj-4.6.2.jar /usr/share/java | |
cd /usr/share/tomcat6/lib/ | |
sudo rm jasper-jdt.jar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private class SuccessCallback implements RetryCallback<Boolean, RuntimeException> { | |
@Override | |
public Boolean doWithRetry(RetryContext context) throws RuntimeException { | |
System.out.println("Success callback: attempt " + context.getRetryCount()); | |
return true; | |
} | |
} | |
private class ExceptionCallback implements RetryCallback<Boolean, Exception> { | |
@Override |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
We want to retry on IOException only. | |
Other Exceptions won't be retried. | |
IOException will be retried three times, counting the initial attempt. | |
*/ | |
final ExceptionClassifierRetryPolicy exRetryPolicy = new ExceptionClassifierRetryPolicy(); | |
exRetryPolicy.setPolicyMap(new HashMap<Class<? extends Throwable>, RetryPolicy>() {{ | |
put(IOException.class, new SimpleRetryPolicy(3)); | |
put(Exception.class, new NeverRetryPolicy()); | |
}}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// we do not catch anything here | |
System.out.println("\n*** Executing successfull callback..."); | |
retryTemplate.execute(new SuccessCallback(), new LoggingRecoveryCallback()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// we catch Exception to allow the program to continue | |
System.out.println("\n*** Executing Exception callback..."); | |
try { | |
retryTemplate.execute(new ExceptionCallback(), new LoggingRecoveryCallback()); | |
} catch (Exception e) { | |
System.out.println("Suppressed Exception"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// we catch IOException to allow the program to continue | |
System.out.println("\n*** Executing IO Exception callback..."); | |
try { | |
retryTemplate.execute(new SpecificExceptionCallback(), new LoggingRecoveryCallback()); | |
} catch (IOException e) { | |
System.out.println("Suppressed IO Exception"); | |
} |
OlderNewer