@Test public void testLogin() throws Exception { URI identityUri = URI.create("http: OpenstackIdentityClient identityClient = OpenstackIdentityClient.build(identityUri); String username = "admin"; String password = "secret"; String project = "__system__"; runSshCommand("id-passwordrecovery-create", "-o", workdir.resolve("passwordrecovery").toString()); runSshCommand("id-user-create", "-u", username, "-p", password); runSshCommand("id-domainrole-grant", "-touser", username, "-r", "admin"); runSshCommand("id-project-create", "-u", username, "-p", password, "-proj", project); runSshCommand("id-role-grant", "-u", username, "-p", password, "-touser", username, "-proj", project, "-r", "admin"); { TokenProvider tokenProvider = AuthTokenProvider.build(identityClient, project, username, password); OpenstackClient client = OpenstackClient.build(tokenProvider); V2ProjectList projects = client.getIdentity().listProjects(); assertEquals(1, projects.tenants.size()); assertEquals(project, projects.tenants.get(0).name); assertEquals(true, projects.tenants.get(0).enabled); } String password2 = "moresecrets"; runSshCommand("id-password-change", "-u", username, "-p", password2, "-o", workdir.resolve("passwordrecovery") .toString()); { TokenProvider tokenProvider = AuthTokenProvider.build(identityClient, project, username, password2); OpenstackClient client = OpenstackClient.build(tokenProvider); V2ProjectList projects = client.getIdentity().listProjects(); assertEquals(1, projects.tenants.size()); assertEquals(project, projects.tenants.get(0).name); assertEquals(true, projects.tenants.get(0).enabled); } }
public static CloudServer build(Configuration configuration) throws Exception { TimeZone.setDefault(TimeZone.getTimeZone("UTC")); System.setProperty("user.timezone", "UTC"); LogbackHook.attachToRootLogger(); Discovery discovery = new ClasspathDiscovery("com.fathomdb.", "io.fathom."); Extensions extensions = new Extensions(configuration, discovery); List<Module> modules = Lists.newArrayList(); modules.add(new NullMetricsModule()); modules.add(new DiscoveryModule(discovery)); modules.add(new FathomCloudGuiceModule(configuration)); modules.add(new OpenstackServerServletModule(configuration, extensions)); modules.add(new ZookeeperPersistModule()); modules.add(new WinkGuiceModule()); Injector injector = extensions.createInjector(configuration, modules); CloudServer server = injector.getInstance(CloudServer.class); return server; }
CloudServer { public static CloudServer build(Configuration configuration) throws Exception { TimeZone.setDefault(TimeZone.getTimeZone("UTC")); System.setProperty("user.timezone", "UTC"); LogbackHook.attachToRootLogger(); Discovery discovery = new ClasspathDiscovery("com.fathomdb.", "io.fathom."); Extensions extensions = new Extensions(configuration, discovery); List<Module> modules = Lists.newArrayList(); modules.add(new NullMetricsModule()); modules.add(new DiscoveryModule(discovery)); modules.add(new FathomCloudGuiceModule(configuration)); modules.add(new OpenstackServerServletModule(configuration, extensions)); modules.add(new ZookeeperPersistModule()); modules.add(new WinkGuiceModule()); Injector injector = extensions.createInjector(configuration, modules); CloudServer server = injector.getInstance(CloudServer.class); return server; } }
CloudServer { public static CloudServer build(Configuration configuration) throws Exception { TimeZone.setDefault(TimeZone.getTimeZone("UTC")); System.setProperty("user.timezone", "UTC"); LogbackHook.attachToRootLogger(); Discovery discovery = new ClasspathDiscovery("com.fathomdb.", "io.fathom."); Extensions extensions = new Extensions(configuration, discovery); List<Module> modules = Lists.newArrayList(); modules.add(new NullMetricsModule()); modules.add(new DiscoveryModule(discovery)); modules.add(new FathomCloudGuiceModule(configuration)); modules.add(new OpenstackServerServletModule(configuration, extensions)); modules.add(new ZookeeperPersistModule()); modules.add(new WinkGuiceModule()); Injector injector = extensions.createInjector(configuration, modules); CloudServer server = injector.getInstance(CloudServer.class); return server; }  }
CloudServer { public static CloudServer build(Configuration configuration) throws Exception { TimeZone.setDefault(TimeZone.getTimeZone("UTC")); System.setProperty("user.timezone", "UTC"); LogbackHook.attachToRootLogger(); Discovery discovery = new ClasspathDiscovery("com.fathomdb.", "io.fathom."); Extensions extensions = new Extensions(configuration, discovery); List<Module> modules = Lists.newArrayList(); modules.add(new NullMetricsModule()); modules.add(new DiscoveryModule(discovery)); modules.add(new FathomCloudGuiceModule(configuration)); modules.add(new OpenstackServerServletModule(configuration, extensions)); modules.add(new ZookeeperPersistModule()); modules.add(new WinkGuiceModule()); Injector injector = extensions.createInjector(configuration, modules); CloudServer server = injector.getInstance(CloudServer.class); return server; }  static void main(String[] args); static CloudServer build(Configuration configuration); void startHttp(); void stop(); }
CloudServer { public static CloudServer build(Configuration configuration) throws Exception { TimeZone.setDefault(TimeZone.getTimeZone("UTC")); System.setProperty("user.timezone", "UTC"); LogbackHook.attachToRootLogger(); Discovery discovery = new ClasspathDiscovery("com.fathomdb.", "io.fathom."); Extensions extensions = new Extensions(configuration, discovery); List<Module> modules = Lists.newArrayList(); modules.add(new NullMetricsModule()); modules.add(new DiscoveryModule(discovery)); modules.add(new FathomCloudGuiceModule(configuration)); modules.add(new OpenstackServerServletModule(configuration, extensions)); modules.add(new ZookeeperPersistModule()); modules.add(new WinkGuiceModule()); Injector injector = extensions.createInjector(configuration, modules); CloudServer server = injector.getInstance(CloudServer.class); return server; }  static void main(String[] args); static CloudServer build(Configuration configuration); void startHttp(); void stop();  }