@Test public void testNoAppIdAnywhere() { assertFalse(connector.isInMatchingCloud()); }
@Before public void useTestUris() { InputStream testUrisProperties = getClass().getClassLoader().getResourceAsStream(PROPERTY_FILE_WITH_URIS); env.setSystemProperty(LocalConfigConnector.PROPERTIES_FILE_PROPERTY, PROPERTY_FILE_WITH_URIS); connector.setFileProvider(StubbedOpenFileLocalConfigConnector.fileContentsFromStream(PROPERTY_FILE_WITH_URIS, testUrisProperties)); assertTrue(connector.isInMatchingCloud()); } }
@Test public void testAppIdInConfigFile() throws IOException { env.setSystemProperty(LocalConfigConnector.PROPERTIES_FILE_PROPERTY, PROPERTY_FILE_NAME); connector.setFileProvider(StubbedOpenFileLocalConfigConnector.fileContentsFromString(PROPERTY_FILE_NAME, APP_ID_PROPERTY)); assertTrue(connector.isInMatchingCloud()); assertEquals(APP_ID, connector.getApplicationInstanceInfo().getAppId()); }
@Test public void testAppIdInFileAndSystem() throws IOException { env.setSystemProperty(LocalConfigConnector.PROPERTIES_FILE_PROPERTY, PROPERTY_FILE_NAME); env.setSystemProperty(LocalConfigConnector.APP_ID_PROPERTY, APP_ID); connector.setFileProvider(StubbedOpenFileLocalConfigConnector.fileContentsFromString(PROPERTY_FILE_NAME, APP_ID_PROPERTY)); assertTrue(connector.isInMatchingCloud()); assertEquals(APP_ID, connector.getApplicationInstanceInfo().getAppId()); } }