Permalink
Browse files

initial maven checkin

  • Loading branch information...
1 parent a809a18 commit 5eca1468eac1d77d50e07b76883aa717e0563385 @FaKod committed May 10, 2010
View
@@ -0,0 +1,3 @@
+target*
+.idea*
+*.iml
View
99 pom.xml
@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.circuitbreaker</groupId>
+ <artifactId>circuit-breaker-core</artifactId>
+ <version>0.0.1</version>
+ <packaging>jar</packaging>
+
+ <name>Circuit Breaker for Scala</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.scala-lang</groupId>
+ <artifactId>scala-library</artifactId>
+ <version>2.8.0.RC2</version>
+ </dependency>
+ <dependency>
+ <groupId>org.scala-lang</groupId>
+ <artifactId>scala-compiler</artifactId>
+ <version>2.8.0.RC2</version>
+ </dependency>
+ <dependency>
+ <groupId>org.scala-tools.testing</groupId>
+ <artifactId>specs_2.8.0.RC2</artifactId>
+ <version>1.6.5-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ </dependency>
+ </dependencies>
+
+ <!--
+ ######################################################################################################################
+ Build
+ ######################################################################################################################
+ -->
+
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-source-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.scala-tools</groupId>
+ <artifactId>maven-scala-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>compile</goal>
+ <goal>testCompile</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ </plugins>
+
+ <sourceDirectory>src/main/scala</sourceDirectory>
+ <testSourceDirectory>src/test/scala</testSourceDirectory>
+ </build>
+
+ <repositories>
+ <repository>
+ <id>scala-tools.releases</id>
+ <name>Scala-Tools Dependencies Repository for Releases</name>
+ <url>http://scala-tools.org/repo-releases</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>scala-tools.snapshots</id>
+ <name>Scala-Tools Dependencies Repository for Snapshots</name>
+ <url>http://scala-tools.org/repo-snapshots</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <updatePolicy>never</updatePolicy>
+ </snapshots>
+ </repository>
+ </repositories>
+
+</project>
@@ -1,5 +1,7 @@
+package org.circuitbreaker.test
+
import org.circuitbreaker._
-import org.specs.Specification
+import org.specs.{SpecificationWithJUnit}
/**
* User: FaKod
@@ -8,7 +10,7 @@ import org.specs.Specification
*/
-class Test extends UsingCircuitBreaker {
+class MyClass extends UsingCircuitBreaker {
def myMethod = {
withCircuitBreaker("test") {
@@ -24,7 +26,7 @@ class Test extends UsingCircuitBreaker {
}
import CircuitBreaker._
-object TestCircuitBreaker extends Specification {
+class TestCircuitBreaker extends SpecificationWithJUnit {
"A CircuitBreaker" should {
setSequential()
@@ -35,28 +37,28 @@ object TestCircuitBreaker extends Specification {
"remain closed" in {
for(i <- 1 to 20) {
- new Test().myMethod
+ new MyClass().myMethod
}
}
"be half open" in {
for(i <- 1 to 10) {
println("1: " + i)
- (new Test().my2Method) must throwA[java.lang.IllegalArgumentException]
+ (new MyClass().my2Method) must throwA[java.lang.IllegalArgumentException]
}
for(i <- 1 to 10) {
println("2: " + i)
- (new Test().my2Method) must throwA[CircuitBreakerOpenException]
+ (new MyClass().my2Method) must throwA[CircuitBreakerOpenException]
}
Thread.sleep(200)
- (new Test().my2Method) must throwA[CircuitBreakerHalfOpenException]
+ (new MyClass().my2Method) must throwA[CircuitBreakerHalfOpenException]
for(i <- 1 to 10) {
println("3: " + i)
- (new Test().my2Method) must throwA[CircuitBreakerOpenException]
+ (new MyClass().my2Method) must throwA[CircuitBreakerOpenException]
}
}

0 comments on commit 5eca146

Please sign in to comment.