@Test public void testFrameworkInfoNoRevocableWithAnnouncedPrincipal() { Protos.FrameworkInfo info = CommandLineDriverSettingsModule.buildFrameworkInfo( "user", Optional.of("auroraprincipal"), Amount.of(1L, Time.MINUTES), false); assertEquals("auroraprincipal", info.getPrincipal()); assertEquals(0, info.getCapabilitiesCount()); }
@Test public void testFrameworkInfoRevocable() { Protos.FrameworkInfo info = CommandLineDriverSettingsModule.buildFrameworkInfo( "user", Optional.absent(), Amount.of(1L, Time.MINUTES), true); assertEquals("", info.getPrincipal()); assertEquals(1, info.getCapabilitiesCount()); assertEquals(REVOCABLE_RESOURCES, info.getCapabilities(0).getType()); }
@Test(expected = IllegalStateException.class) public void testMissingPropertiesParsing() { Properties testProperties = new Properties(); testProperties.put(CommandLineDriverSettingsModule.PRINCIPAL_KEY, "aurora-scheduler"); ByteArrayOutputStream propertiesStream = new ByteArrayOutputStream(); try { testProperties.store(propertiesStream, ""); } catch (IOException e) { throw Throwables.propagate(e); } CommandLineDriverSettingsModule.parseCredentials( new ByteArrayInputStream(propertiesStream.toByteArray())); }
@Test public void testPropertiesParsing() { Properties testProperties = new Properties(); testProperties.put(CommandLineDriverSettingsModule.PRINCIPAL_KEY, "aurora-scheduler"); testProperties.put(CommandLineDriverSettingsModule.SECRET_KEY, "secret"); ByteArrayOutputStream propertiesStream = new ByteArrayOutputStream(); try { testProperties.store(propertiesStream, ""); } catch (IOException e) { throw Throwables.propagate(e); } assertEquals( testProperties, CommandLineDriverSettingsModule.parseCredentials( new ByteArrayInputStream(propertiesStream.toByteArray()))); }