Fixing if statement for the constructBasePath() function of ResourceQuery.java

Had forgotten to invert the result, which would have the nodeid appended
to the rrddir for the basepath when storeByForeignSource is enabled. Nothing
would work with this.
Adding a test function to check the foreignSource and foreignId additions

- Adding a private function getResourceQueryWithForeignSource() that returns
  a resourceQuery string, like the one in the function getResourceQuery() with
  the addition of --foreignsource and --foreignid arguments
- Adding a test function testCommandParsingWithForeignSource() that parses the
  query string from getResourceQueryWithForeignSource() and asserts that the
  foreignsource and foreignid argument values are what they should be