diff --git a/BankWithAuditors/.classpath b/BankWithAuditors/.classpath index a7a9bf9..b10b8d9 100644 --- a/BankWithAuditors/.classpath +++ b/BankWithAuditors/.classpath @@ -1,7 +1,7 @@ - - - - - - - + + + + + + + diff --git a/BankWithAuditors/.idea/.name b/BankWithAuditors/.idea/.name new file mode 100644 index 0000000..e7aa4d0 --- /dev/null +++ b/BankWithAuditors/.idea/.name @@ -0,0 +1 @@ +Exper \ No newline at end of file diff --git a/BankWithAuditors/.idea/compiler.xml b/BankWithAuditors/.idea/compiler.xml new file mode 100644 index 0000000..01e8c07 --- /dev/null +++ b/BankWithAuditors/.idea/compiler.xml @@ -0,0 +1,21 @@ + + + + + + diff --git a/BankWithAuditors/.idea/encodings.xml b/BankWithAuditors/.idea/encodings.xml new file mode 100644 index 0000000..7c62b52 --- /dev/null +++ b/BankWithAuditors/.idea/encodings.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/BankWithAuditors/.idea/misc.xml b/BankWithAuditors/.idea/misc.xml new file mode 100644 index 0000000..9fc8feb --- /dev/null +++ b/BankWithAuditors/.idea/misc.xml @@ -0,0 +1,13 @@ + + + + + + + http://www.w3.org/1999/xhtml + + + + + + diff --git a/BankWithAuditors/.idea/modules.xml b/BankWithAuditors/.idea/modules.xml new file mode 100644 index 0000000..1d371c5 --- /dev/null +++ b/BankWithAuditors/.idea/modules.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/BankWithAuditors/.idea/scopes/scope_settings.xml b/BankWithAuditors/.idea/scopes/scope_settings.xml new file mode 100644 index 0000000..0d5175c --- /dev/null +++ b/BankWithAuditors/.idea/scopes/scope_settings.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/BankWithAuditors/.idea/vcs.xml b/BankWithAuditors/.idea/vcs.xml new file mode 100644 index 0000000..7332f6d --- /dev/null +++ b/BankWithAuditors/.idea/vcs.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/BankWithAuditors/.idea/workspace.xml b/BankWithAuditors/.idea/workspace.xml new file mode 100644 index 0000000..c38b4cb --- /dev/null +++ b/BankWithAuditors/.idea/workspace.xml @@ -0,0 +1,795 @@ + + + + + + + + + + + + + + + + + + + + + tests.* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + localhost + 5050 + + + + + + + 1353860528612 + 1353860528612 + + + 1353862967942 + 1353862967942 + + + 1353863268881 + 1353863268881 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Exper + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BankWithAuditors/.project b/BankWithAuditors/.project index 2ff10d8..4562dd8 100644 --- a/BankWithAuditors/.project +++ b/BankWithAuditors/.project @@ -1,17 +1,17 @@ - - - Exper - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - - + + + Exper + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/BankWithAuditors/Exper.iml b/BankWithAuditors/Exper.iml new file mode 100644 index 0000000..6f45654 --- /dev/null +++ b/BankWithAuditors/Exper.iml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/BankWithAuditors/bin/code/ChainFactory.class b/BankWithAuditors/bin/code/ChainFactory.class new file mode 100644 index 0000000..b540ca0 Binary files /dev/null and b/BankWithAuditors/bin/code/ChainFactory.class differ diff --git a/BankWithAuditors/bin/code/Handler.class b/BankWithAuditors/bin/code/Handler.class index 57229ee..cc426ac 100644 Binary files a/BankWithAuditors/bin/code/Handler.class and b/BankWithAuditors/bin/code/Handler.class differ diff --git a/BankWithAuditors/bin/code/JHandler.class b/BankWithAuditors/bin/code/JHandler.class new file mode 100644 index 0000000..bcbf7fd Binary files /dev/null and b/BankWithAuditors/bin/code/JHandler.class differ diff --git a/BankWithAuditors/bin/code/OHandler.class b/BankWithAuditors/bin/code/OHandler.class new file mode 100644 index 0000000..cd13289 Binary files /dev/null and b/BankWithAuditors/bin/code/OHandler.class differ diff --git a/BankWithAuditors/bin/code/Request.class b/BankWithAuditors/bin/code/Request.class index 46f040a..c0e2d05 100644 Binary files a/BankWithAuditors/bin/code/Request.class and b/BankWithAuditors/bin/code/Request.class differ diff --git a/BankWithAuditors/bin/tests/ChainFactoryTest.class b/BankWithAuditors/bin/tests/ChainFactoryTest.class new file mode 100644 index 0000000..54dcbbb Binary files /dev/null and b/BankWithAuditors/bin/tests/ChainFactoryTest.class differ diff --git a/BankWithAuditors/bin/tests/OHandlerTest.class b/BankWithAuditors/bin/tests/OHandlerTest.class new file mode 100644 index 0000000..8fc7df1 Binary files /dev/null and b/BankWithAuditors/bin/tests/OHandlerTest.class differ diff --git a/BankWithAuditors/bin/tests/RequestTest.class b/BankWithAuditors/bin/tests/RequestTest.class new file mode 100644 index 0000000..3c00c0f Binary files /dev/null and b/BankWithAuditors/bin/tests/RequestTest.class differ diff --git a/BankWithAuditors/review/4096-tristian o'brien.review b/BankWithAuditors/review/4096-tristian o'brien.review new file mode 100644 index 0000000..20c2372 --- /dev/null +++ b/BankWithAuditors/review/4096-tristian o'brien.review @@ -0,0 +1,20 @@ + + + + + 2012-11-17 :: 13:27:05:892 GMT + 2012-11-17 :: 13:27:41:070 GMT + + tristian o'brien + tristian o'brien + src/code/ChainFactory.java + item.type.label.codingStandards + item.label.unset + checkstyle issues + checkstyle found 149 code review issues for all files + + + item.label.unset + item.status.label.open + + \ No newline at end of file diff --git a/BankWithAuditors/src/code/ChainFactory.java b/BankWithAuditors/src/code/ChainFactory.java index 24deb1a..1155fd5 100644 --- a/BankWithAuditors/src/code/ChainFactory.java +++ b/BankWithAuditors/src/code/ChainFactory.java @@ -1,37 +1,37 @@ -/** - * - */ -package code; - -import java.util.ArrayList; - -/** - * @author oded - * - */ -public class ChainFactory { - - private ArrayList handlers = new ArrayList(); - - - - public void registerHandler(Handler handler){ - handlers.add(handler); - } - - public void removeHandler(Handler handler) { - handlers.remove(handler); - } - - public Handler getChain() { - Handler obP = null; - for (Handler ob : handlers) { - if(obP != null){ - obP.setHandler(ob); - } - obP = ob; - } - return handlers.get(0); - } - -} +/** + * + */ +package code; + +import java.util.ArrayList; + +/** + * @author oded + * + */ +public class ChainFactory { + + private ArrayList handlers = new ArrayList(); + + + + public void registerHandler(Handler handler){ + handlers.add(handler); + } + + public void removeHandler(Handler handler) { + handlers.remove(handler); + } + + public Handler getChain() { + Handler obP = null; + for (Handler ob : handlers) { + if(obP != null){ + obP.setHandler(ob); + } + obP = ob; + } + return handlers.get(0); + } + +} diff --git a/BankWithAuditors/src/code/Handler.java b/BankWithAuditors/src/code/Handler.java index ceee43b..601bc40 100644 --- a/BankWithAuditors/src/code/Handler.java +++ b/BankWithAuditors/src/code/Handler.java @@ -1,24 +1,24 @@ -/** - * - */ -package code; - -/** - * @author Oded - * - */ -public abstract class Handler { - - protected Handler handler; - - public Handler() { - this.handler = null; - } - - public void setHandler(Handler handler){ - this.handler = handler; - } - - public abstract Boolean handleRequest(Request request); - -} +/** + * + */ +package code; + +/** + * @author Oded + * + */ +public abstract class Handler { + + protected Handler handler; + + public Handler() { + this.handler = null; + } + + public void setHandler(Handler handler){ + this.handler = handler; + } + + public abstract Boolean handleRequest(Request request); + +} diff --git a/BankWithAuditors/src/code/JHandler.java b/BankWithAuditors/src/code/JHandler.java index 24301cb..3ddc86f 100644 --- a/BankWithAuditors/src/code/JHandler.java +++ b/BankWithAuditors/src/code/JHandler.java @@ -1,32 +1,32 @@ -/** - * - */ -package code; - -/** - * @author oded - * - */ -public class JHandler extends Handler { - - /* (non-Javadoc) - * @see code.Handler#handleRequest(code.Request) - */ - @Override - public Boolean handleRequest(Request request) { - String requestType = "Jack"; - - if (requestType.equals(request.getRequestType())){ - String instruction = request.getInstruction(); - String instructionField = request.getInstructionField(); - System.out.println(requestType + " " + instruction + " " + instructionField); - return true; - } else { - if(handler != null){ - return this.handler.handleRequest(request); - } - } - return false; - } - -} +/** + * + */ +package code; + +/** + * @author oded + * + */ +public class JHandler extends Handler { + + /* (non-Javadoc) + * @see code.Handler#handleRequest(code.Request) + */ + @Override + public Boolean handleRequest(Request request) { + String requestType = "Jack"; + + if (requestType.equals(request.getRequestType())){ + String instruction = request.getInstruction(); + String instructionField = request.getInstructionField(); + System.out.println(requestType + " " + instruction + " " + instructionField); + return true; + } else { + if(handler != null){ + return this.handler.handleRequest(request); + } + } + return false; + } + +} diff --git a/BankWithAuditors/src/code/OHandler.java b/BankWithAuditors/src/code/OHandler.java index 8ab6a04..1abd30d 100644 --- a/BankWithAuditors/src/code/OHandler.java +++ b/BankWithAuditors/src/code/OHandler.java @@ -1,32 +1,32 @@ -/** - * - */ -package code; - -/** - * @author oded - * - */ -public class OHandler extends Handler { - - /* (non-Javadoc) - * @see code.Handler#handleRequest(code.Request) - */ - @Override - public Boolean handleRequest(Request request) { - String requestType = "Oded"; - - if (requestType.equals(request.getRequestType())){ - String instruction = request.getInstruction(); - String instructionField = request.getInstructionField(); - System.out.println(requestType + " " + instruction + " " + instructionField); - return true; - } else { - if(handler != null){ - return this.handler.handleRequest(request); - } - } - return false; - } - -} +/** + * + */ +package code; + +/** + * @author oded + * + */ +public class OHandler extends Handler { + + /* (non-Javadoc) + * @see code.Handler#handleRequest(code.Request) + */ + @Override + public Boolean handleRequest(Request request) { + String requestType = "Oded"; + + if (requestType.equals(request.getRequestType())){ + String instruction = request.getInstruction(); + String instructionField = request.getInstructionField(); + System.out.println(requestType + " " + instruction + " " + instructionField); + return true; + } else { + if(handler != null){ + return this.handler.handleRequest(request); + } + } + return false; + } + +} diff --git a/BankWithAuditors/src/code/Request.java b/BankWithAuditors/src/code/Request.java index 44a5409..a2bff5d 100644 --- a/BankWithAuditors/src/code/Request.java +++ b/BankWithAuditors/src/code/Request.java @@ -1,49 +1,49 @@ -package code; - -import java.util.Map; - -public class Request { - - Map instructions; - - - private String requestType; - - private String instruction; - private String instructionField; - - public Request(String requestType,String inst, String instF) { - super(); - this.requestType = requestType; - this.instruction = inst; - this.instructionField = instF; - } - - - - /** - * @return the instruction - */ - public String getInstruction() { - return instruction; - } - - - /** - * @return the instructionField - */ - public String getInstructionField() { - return instructionField; - } - - - /** - * @return the requestType - */ - - public String getRequestType() { - return requestType; - } - - -} +package code; + +import java.util.Map; + +public class Request { + + Map instructions; + + + private String requestType; + + private String instruction; + private String instructionField; + + public Request(String requestType,String inst, String instF) { + super(); + this.requestType = requestType; + this.instruction = inst; + this.instructionField = instF; + } + + + + /** + * @return the instruction + */ + public String getInstruction() { + return instruction; + } + + + /** + * @return the instructionField + */ + public String getInstructionField() { + return instructionField; + } + + + /** + * @return the requestType + */ + + public String getRequestType() { + return requestType; + } + + +} diff --git a/BankWithAuditors/src/code/THandler.java b/BankWithAuditors/src/code/THandler.java new file mode 100644 index 0000000..5587127 --- /dev/null +++ b/BankWithAuditors/src/code/THandler.java @@ -0,0 +1,32 @@ +/** + * + */ +package code; + +/** + * @author tristian + * + */ +public class THandler extends Handler { + + /* (non-Javadoc) + * @see code.Handler#handleRequest(code.Request) + */ + @Override + public Boolean handleRequest(Request request) { + String requestType = "Tristian"; + + if (requestType.equals(request.getRequestType())){ + String instruction = request.getInstruction(); + String instructionField = request.getInstructionField(); + System.out.println(requestType + " " + instruction + " " + instructionField); + return true; + } else { + if(handler != null){ + return this.handler.handleRequest(request); + } + } + return false; + } + +} diff --git a/BankWithAuditors/src/tests/ChainFactoryTest.java b/BankWithAuditors/src/tests/ChainFactoryTest.java index 7e33cd1..e1f6d50 100644 --- a/BankWithAuditors/src/tests/ChainFactoryTest.java +++ b/BankWithAuditors/src/tests/ChainFactoryTest.java @@ -1,66 +1,81 @@ -/** - * - */ -package tests; - -import static org.junit.Assert.*; - -import org.junit.Test; - -import code.ChainFactory; -import code.Handler; -import code.JHandler; -import code.OHandler; -import code.Request; - -/** - * @author oded - * - */ -public class ChainFactoryTest { - - @Test - public void test() { - Request request = new Request("Jack","7","8"); - - Handler firstHandler = new OHandler(); - Handler secondHandler = new JHandler(); - Handler headHandler; - - ChainFactory classUnderTest = new ChainFactory(); - - classUnderTest.registerHandler(firstHandler); - classUnderTest.registerHandler(secondHandler); - - headHandler= classUnderTest.getChain(); - - - - Boolean actualOutput = headHandler.handleRequest(request); - - assertTrue("Handler failed to grab",actualOutput); - } - - @Test - public void test2() { - Request request = new Request("Oded","9","108"); - - Handler firstHandler = new OHandler(); - // Handler secondHandler = new JHandler(); - Handler headHandler; - - ChainFactory classUnderTest = new ChainFactory(); - - classUnderTest.registerHandler(firstHandler); - //classUnderTest.registerHandler(secondHandler); - - headHandler= classUnderTest.getChain(); - - - - Boolean actualOutput = headHandler.handleRequest(request); - - assertTrue("Handler failed to grab",actualOutput); - } - -} +/** + * + */ +package tests; + +import static org.junit.Assert.*; + +import code.*; +import org.junit.Test; + +/** + * @author oded + * + */ +public class ChainFactoryTest { + + @Test + public void test() { + Request request = new Request("Jack","7","8"); + + Handler firstHandler = new OHandler(); + Handler secondHandler = new JHandler(); + Handler headHandler; + + ChainFactory classUnderTest = new ChainFactory(); + + classUnderTest.registerHandler(firstHandler); + classUnderTest.registerHandler(secondHandler); + + headHandler= classUnderTest.getChain(); + + + + Boolean actualOutput = headHandler.handleRequest(request); + + assertTrue("Handler failed to grab",actualOutput); + } + + @Test + public void test2() { + Request request = new Request("Oded","9","108"); + + Handler firstHandler = new OHandler(); + // Handler secondHandler = new JHandler(); + Handler headHandler; + + ChainFactory classUnderTest = new ChainFactory(); + + classUnderTest.registerHandler(firstHandler); + //classUnderTest.registerHandler(secondHandler); + + headHandler= classUnderTest.getChain(); + + + + Boolean actualOutput = headHandler.handleRequest(request); + + assertTrue("Handler failed to grab",actualOutput); + } + @Test + public void test3() { + Request request = new Request("Car","9","108"); + + Handler firstHandler = new THandler(); + // Handler secondHandler = new JHandler(); + Handler headHandler; + + ChainFactory classUnderTest = new ChainFactory(); + + classUnderTest.registerHandler(firstHandler); + //classUnderTest.registerHandler(secondHandler); + + headHandler= classUnderTest.getChain(); + + + + Boolean actualOutput = headHandler.handleRequest(request); + + assertTrue("Handler failed to grab",actualOutput); + } +} diff --git a/BankWithAuditors/src/tests/OHandlerTest.java b/BankWithAuditors/src/tests/OHandlerTest.java index 0cf7ea5..a270c4b 100644 --- a/BankWithAuditors/src/tests/OHandlerTest.java +++ b/BankWithAuditors/src/tests/OHandlerTest.java @@ -1,32 +1,32 @@ -package tests; - -import static org.junit.Assert.*; - - - -import org.junit.Test; - -import code.*; - -public class OHandlerTest { - - @Test - public void test() { - Handler classUnderTest = new OHandler(); - Request request = new Request("Oded","5","10"); - - Boolean actualOutput = classUnderTest.handleRequest(request); - - assertTrue("Handler failed to grab",actualOutput); - } - - @Test - public void test2() { - Handler classUnderTest = new OHandler(); - Request request = new Request("Ode","5","10"); - - Boolean actualOutput = classUnderTest.handleRequest(request); - - assertFalse("Handler failed to grab",actualOutput); - } -} +package tests; + +import static org.junit.Assert.*; + + + +import org.junit.Test; + +import code.*; + +public class OHandlerTest { + + @Test + public void test() { + Handler classUnderTest = new OHandler(); + Request request = new Request("Oded","5","10"); + + Boolean actualOutput = classUnderTest.handleRequest(request); + + assertTrue("Handler failed to grab",actualOutput); + } + + @Test + public void test2() { + Handler classUnderTest = new OHandler(); + Request request = new Request("Ode","5","10"); + + Boolean actualOutput = classUnderTest.handleRequest(request); + + assertFalse("Handler failed to grab",actualOutput); + } +} diff --git a/BankWithAuditors/src/tests/RequestTest.java b/BankWithAuditors/src/tests/RequestTest.java index de7dd73..b45866b 100644 --- a/BankWithAuditors/src/tests/RequestTest.java +++ b/BankWithAuditors/src/tests/RequestTest.java @@ -1,59 +1,107 @@ -package tests; - -import static org.junit.Assert.*; -import org.junit.Test; - -import code.Request; - -public class RequestTest { - - @Test - public void test() { - - String instruction = "10"; - String instructionField = "5"; - String expectedOutput = "Oded"; - String actualOutput; - String input = "Oded"; - Request classUnderTest = new Request(input, instruction, instructionField); - - actualOutput = classUnderTest.getRequestType(); - - - assertEquals("Not equal",expectedOutput,actualOutput); - } - - @Test - public void test2() { - - String instruction = "10"; - String instructionField = "5"; - String expectedOutput = "10"; - String actualOutput; - String input = "Oded"; - Request classUnderTest = new Request(input, instruction, instructionField); - - - actualOutput = classUnderTest.getInstruction(); - - assertEquals("Not equal",expectedOutput,actualOutput); - } - - @Test - public void test3() { - - String instruction = "10"; - String instructionField = "5"; - String expectedOutput = "5"; - String actualOutput; - String input = "Oded"; - Request classUnderTest = new Request(input, instruction, instructionField); - - - actualOutput = classUnderTest.getInstructionField(); - - assertEquals("Not equal",expectedOutput,actualOutput); - } - - -} +package tests; + +import static org.junit.Assert.*; +import org.junit.Test; + +import code.Request; + +public class RequestTest { + + @Test + public void test() { + + String instruction = "10"; + String instructionField = "5"; + String expectedOutput = "Oded"; + String actualOutput; + String input = "Oded"; + Request classUnderTest = new Request(input, instruction, instructionField); + + actualOutput = classUnderTest.getRequestType(); + + + assertEquals("Not equal",expectedOutput,actualOutput); + } + + @Test + public void test2() { + + String instruction = "10"; + String instructionField = "5"; + String expectedOutput = "10"; + String actualOutput; + String input = "Oded"; + Request classUnderTest = new Request(input, instruction, instructionField); + + + actualOutput = classUnderTest.getInstruction(); + + assertEquals("Not equal",expectedOutput,actualOutput); + } + + @Test + public void test3() { + + String instruction = "10"; + String instructionField = "5"; + String expectedOutput = "5"; + String actualOutput; + String input = "Oded"; + Request classUnderTest = new Request(input, instruction, instructionField); + + + actualOutput = classUnderTest.getInstructionField(); + + assertEquals("Not equal",expectedOutput,actualOutput); + } + + + @Test + public void test4() { + + String instruction = "10"; + String instructionField = "5"; + String expectedOutput = "Tristian"; + String actualOutput; + String input = "Tristian"; + Request classUnderTest = new Request(input, instruction, instructionField); + + actualOutput = classUnderTest.getRequestType(); + + + assertEquals("Not equal",expectedOutput,actualOutput); + } + + @Test + public void test5() { + + String instruction = "10"; + String instructionField = "5"; + String expectedOutput = "10"; + String actualOutput; + String input = "Tristian"; + Request classUnderTest = new Request(input, instruction, instructionField); + + + actualOutput = classUnderTest.getInstruction(); + + assertEquals("Not equal",expectedOutput,actualOutput); + } + + @Test + public void test6() { + + String instruction = "10"; + String instructionField = "5"; + String expectedOutput = "5"; + String actualOutput; + String input = "Tristian"; + Request classUnderTest = new Request(input, instruction, instructionField); + + + actualOutput = classUnderTest.getInstructionField(); + + assertEquals("Not equal",expectedOutput,actualOutput); + } + +}