コード例 #1
0
 public void test() {
   InputStream is = getClass().getResourceAsStream("/firewallService.xml");
   Injector injector = Guice.createInjector(new SaxParserModule());
   Factory factory = injector.getInstance(ParseSax.Factory.class);
   FirewallService result =
       factory.create(injector.getInstance(FirewallServiceHandler.class)).parse(is);
   assertEquals(result.isEnabled(), false);
   assertEquals(
       result.getFirewallRules(),
       ImmutableSet.<FirewallRule>of(
           FirewallRule.builder()
               .firewallType("SERVER_TIER_FIREWALL")
               .isEnabled(false)
               .source("internet")
               .destination("VM Tier01")
               .port("22")
               .protocol("Tcp")
               .policy("allow")
               .description("Server Tier Firewall Rule")
               .isLogged(false)
               .build(),
           FirewallRule.builder()
               .firewallType("SERVER_TIER_FIREWALL")
               .isEnabled(true)
               .source("VM Tier03")
               .destination("VM Tier03")
               .protocol("Icmp-ping")
               .policy("allow")
               .description("Server Tier Firewall Rule")
               .isLogged(false)
               .build()));
 }
コード例 #2
0
ファイル: FirewallService.java プロジェクト: pbkwee/jclouds
 public static Builder fromFirewallService(FirewallService in) {
   return new Builder()
       .id(in.getId())
       .name(in.getName())
       .type(in.getType())
       .href(in.getHref())
       .isEnabled(in.isEnabled())
       .firewallRules(in.getFirewallRules());
 }