private final CapturingPluginReplySender pluginReplySender = new CapturingPluginReplySender();
public FcpInterfaceTest() {
- fcpInterface.setActive(false);
+ fcpInterface.setActive(true);
fcpInterface.setFullAccessRequired(ALWAYS);
}
@Test
public void testThatAnInactiveFcpInterfaceReturnsAnErrorForDirectAccess() throws PluginNotFoundException {
+ fcpInterface.setActive(false);
SimpleFieldSet fieldSet = new SimpleFieldSetBuilder().get();
fcpInterface.handle(pluginReplySender, fieldSet, null, ACCESS_DIRECT);
verifyErrorWithCode("400");
@Test
public void testThatAnInactiveFcpInterfaceReturnsAnErrorForRestrictedFcpAccess() throws PluginNotFoundException {
+ fcpInterface.setActive(false);
SimpleFieldSet fieldSet = new SimpleFieldSetBuilder().get();
fcpInterface.handle(pluginReplySender, fieldSet, null, ACCESS_FCP_RESTRICTED);
verifyErrorWithCode("400");
@Test
public void testThatAnInactiveFcpInterfaceReturnsAnErrorForFullFcpAccess() throws PluginNotFoundException {
+ fcpInterface.setActive(false);
SimpleFieldSet fieldSet = new SimpleFieldSetBuilder().get();
fcpInterface.handle(pluginReplySender, fieldSet, null, ACCESS_FCP_FULL);
verifyErrorWithCode("400");
@Test
public void testThatAnActiveFcpInterfaceReturnsAnErrorForAnUnknownMessage() {
- fcpInterface.setActive(true);
SimpleFieldSet fieldSet = new SimpleFieldSetBuilder().put("Message", "Foo").get();
fcpInterface.handle(pluginReplySender, fieldSet, null, ACCESS_DIRECT);
verifyError();
@Test
public void testThatAnActiveFcpInterfaceReturnsAnErrorForAMessageWithoutIdentifier() {
- fcpInterface.setActive(true);
fcpInterface.addCommand("ReadOnlyPing", new ReadOnlyPing());
SimpleFieldSet fieldSet = new SimpleFieldSetBuilder().put("Message", "ReadOnlyPing").get();
fcpInterface.handle(pluginReplySender, fieldSet, null, ACCESS_DIRECT);
@Test
public void testThatAnActiveFcpInterfaceRequiringFullAccessAllowsDirectFcpAccessForReadOnlyCommand() {
- fcpInterface.setActive(true);
fcpInterface.addCommand("ReadOnlyPing", new ReadOnlyPing());
SimpleFieldSet fieldSet = new SimpleFieldSetBuilder().put("Message", "ReadOnlyPing").put("Identifier", "foo").get();
fcpInterface.handle(pluginReplySender, fieldSet, null, ACCESS_DIRECT);
@Test
public void testThatAnActiveFcpInterfaceRequiringFullAccessForWritesAllowsDirectFcpAccessForReadOnlyCommand() {
- fcpInterface.setActive(true);
fcpInterface.setFullAccessRequired(WRITING);
fcpInterface.addCommand("ReadOnlyPing", new ReadOnlyPing());
SimpleFieldSet fieldSet = new SimpleFieldSetBuilder().put("Message", "ReadOnlyPing").put("Identifier", "foo").get();
@Test
public void testThatAnActiveFcpInterfaceNotRequiringFullAccessAllowsDirectFcpAccessForReadOnlyCommand() {
- fcpInterface.setActive(true);
fcpInterface.setFullAccessRequired(NO);
fcpInterface.addCommand("ReadOnlyPing", new ReadOnlyPing());
SimpleFieldSet fieldSet = new SimpleFieldSetBuilder().put("Message", "ReadOnlyPing").put("Identifier", "foo").get();
@Test
public void testThatAnActiveFcpInterfaceRequiringFullAccessAllowsDirectFcpAccessForReadWriteCommand() {
- fcpInterface.setActive(true);
fcpInterface.addCommand("ReadWritePing", new ReadWritePing());
SimpleFieldSet fieldSet = new SimpleFieldSetBuilder().put("Message", "ReadWritePing").put("Identifier", "foo").get();
fcpInterface.handle(pluginReplySender, fieldSet, null, ACCESS_DIRECT);
@Test
public void testThatAnActiveFcpInterfaceRequiringFullAccessForWritesAllowsDirectFcpAccessForReadWriteCommand() {
- fcpInterface.setActive(true);
fcpInterface.setFullAccessRequired(WRITING);
fcpInterface.addCommand("ReadWritePing", new ReadWritePing());
SimpleFieldSet fieldSet = new SimpleFieldSetBuilder().put("Message", "ReadWritePing").put("Identifier", "foo").get();
@Test
public void testThatAnActiveFcpInterfaceNotRequiringFullAccessAllowsDirectFcpAccessForReadWriteCommand() {
- fcpInterface.setActive(true);
fcpInterface.setFullAccessRequired(NO);
fcpInterface.addCommand("ReadWritePing", new ReadWritePing());
SimpleFieldSet fieldSet = new SimpleFieldSetBuilder().put("Message", "ReadWritePing").put("Identifier", "foo").get();
@Test
public void testThatAnActiveFcpInterfaceRequiringFullAccessAllowsFullFcpAccessForReadOnlyCommand() {
- fcpInterface.setActive(true);
fcpInterface.addCommand("ReadOnlyPing", new ReadOnlyPing());
SimpleFieldSet fieldSet = new SimpleFieldSetBuilder().put("Message", "ReadOnlyPing").put("Identifier", "foo").get();
fcpInterface.handle(pluginReplySender, fieldSet, null, ACCESS_FCP_FULL);
@Test
public void testThatAnActiveFcpInterfaceRequiringFullAccessForWritesAllowsFullFcpAccessForReadOnlyCommand() {
- fcpInterface.setActive(true);
fcpInterface.setFullAccessRequired(WRITING);
fcpInterface.addCommand("ReadOnlyPing", new ReadOnlyPing());
SimpleFieldSet fieldSet = new SimpleFieldSetBuilder().put("Message", "ReadOnlyPing").put("Identifier", "foo").get();
@Test
public void testThatAnActiveFcpInterfaceNotRequiringFullAccessAllowsFullFcpAccessForReadOnlyCommand() {
- fcpInterface.setActive(true);
fcpInterface.setFullAccessRequired(NO);
fcpInterface.addCommand("ReadOnlyPing", new ReadOnlyPing());
SimpleFieldSet fieldSet = new SimpleFieldSetBuilder().put("Message", "ReadOnlyPing").put("Identifier", "foo").get();
@Test
public void testThatAnActiveFcpInterfaceRequiringFullAccessAllowsFullFcpAccessForReadWriteCommand() {
- fcpInterface.setActive(true);
fcpInterface.addCommand("ReadWritePing", new ReadWritePing());
SimpleFieldSet fieldSet = new SimpleFieldSetBuilder().put("Message", "ReadWritePing").put("Identifier", "foo").get();
fcpInterface.handle(pluginReplySender, fieldSet, null, ACCESS_FCP_FULL);
@Test
public void testThatAnActiveFcpInterfaceRequiringFullAccessForWritesAllowsFullFcpAccessForReadWriteCommand() {
- fcpInterface.setActive(true);
fcpInterface.setFullAccessRequired(WRITING);
fcpInterface.addCommand("ReadWritePing", new ReadWritePing());
SimpleFieldSet fieldSet = new SimpleFieldSetBuilder().put("Message", "ReadWritePing").put("Identifier", "foo").get();
@Test
public void testThatAnActiveFcpInterfaceNotRequiringFullAccessAllowsFullFcpAccessForReadWriteCommand() {
- fcpInterface.setActive(true);
fcpInterface.setFullAccessRequired(NO);
fcpInterface.addCommand("ReadWritePing", new ReadWritePing());
SimpleFieldSet fieldSet = new SimpleFieldSetBuilder().put("Message", "ReadWritePing").put("Identifier", "foo").get();
@Test
public void testThatAnActiveFcpInterfaceRequiringFullAccessDoesNotAllowRestrictedFcpAccessForReadOnlyCommand() {
- fcpInterface.setActive(true);
fcpInterface.addCommand("ReadOnlyPing", new ReadOnlyPing());
SimpleFieldSet fieldSet = new SimpleFieldSetBuilder().put("Message", "ReadOnlyPing").put("Identifier", "foo").get();
fcpInterface.handle(pluginReplySender, fieldSet, null, ACCESS_FCP_RESTRICTED);
@Test
public void testThatAnActiveFcpInterfaceRequiringFullAccessForWritesAllowsRestrictedFcpAccessForReadOnlyCommand() {
- fcpInterface.setActive(true);
fcpInterface.setFullAccessRequired(WRITING);
fcpInterface.addCommand("ReadOnlyPing", new ReadOnlyPing());
SimpleFieldSet fieldSet = new SimpleFieldSetBuilder().put("Message", "ReadOnlyPing").put("Identifier", "foo").get();
@Test
public void testThatAnActiveFcpInterfaceNotRequiringFullAccessAllowsRestrictedFcpAccessForReadOnlyCommand() {
- fcpInterface.setActive(true);
fcpInterface.setFullAccessRequired(NO);
fcpInterface.addCommand("ReadOnlyPing", new ReadOnlyPing());
SimpleFieldSet fieldSet = new SimpleFieldSetBuilder().put("Message", "ReadOnlyPing").put("Identifier", "foo").get();
@Test
public void testThatAnActiveFcpInterfaceRequiringFullAccessDoesNotAllowRestrictedFcpAccessForReadWriteCommand() {
- fcpInterface.setActive(true);
fcpInterface.addCommand("ReadWritePing", new ReadWritePing());
SimpleFieldSet fieldSet = new SimpleFieldSetBuilder().put("Message", "ReadWritePing").put("Identifier", "foo").get();
fcpInterface.handle(pluginReplySender, fieldSet, null, ACCESS_FCP_RESTRICTED);
@Test
public void testThatAnActiveFcpInterfaceRequiringFullAccessForWritesDoesNotAllowRestrictedFcpAccessForReadWriteCommand() {
- fcpInterface.setActive(true);
fcpInterface.setFullAccessRequired(WRITING);
fcpInterface.addCommand("ReadWritePing", new ReadWritePing());
SimpleFieldSet fieldSet = new SimpleFieldSetBuilder().put("Message", "ReadWritePing").put("Identifier", "foo").get();
@Test
public void testThatAnActiveFcpInterfaceNotRequiringFullAccessAllowsRestrictedFcpAccessForReadWriteCommand() {
- fcpInterface.setActive(true);
fcpInterface.setFullAccessRequired(NO);
fcpInterface.addCommand("ReadWritePing", new ReadWritePing());
SimpleFieldSet fieldSet = new SimpleFieldSetBuilder().put("Message", "ReadWritePing").put("Identifier", "foo").get();
@Test
public void testThatAFaultyCommandResultsInAnError() {
- fcpInterface.setActive(true);
fcpInterface.addCommand("Faulty", new FaultyCommand());
SimpleFieldSet fieldSet = new SimpleFieldSetBuilder().put("Message", "Faulty").put("Identifier", "foo").get();
fcpInterface.handle(pluginReplySender, fieldSet, null, ACCESS_FCP_FULL);
@Test
public void testThatAFaultyPluginReplySenderIsHandled() {
- fcpInterface.setActive(true);
SimpleFieldSet fieldSet = new SimpleFieldSetBuilder().put("Message", "Faulty").put("Identifier", "foo").get();
fcpInterface.handle(new FaultyPluginReplySender(), fieldSet, null, ACCESS_FCP_FULL);
}
@Test
public void testThatACommandWithDataIsHandledCorrectly() throws IOException {
- fcpInterface.setActive(true);
fcpInterface.addCommand("CommandWithData", new CommandWithData());
SimpleFieldSet fieldSet = new SimpleFieldSetBuilder().put("Message", "CommandWithData").put("Identifier", "foo").get();
fcpInterface.handle(pluginReplySender, fieldSet, null, ACCESS_FCP_FULL);
@Test
public void testThatACommandWithABucketIsHandledCorrectly() throws IOException {
- fcpInterface.setActive(true);
fcpInterface.addCommand("CommandWithBucket", new CommandWithBucket());
SimpleFieldSet fieldSet = new SimpleFieldSetBuilder().put("Message", "CommandWithBucket").put("Identifier", "foo").get();
fcpInterface.handle(pluginReplySender, fieldSet, null, ACCESS_FCP_FULL);