public static Builder builder() { return new Builder(); }
public void testToJsonStringWithMultipleRoles() { RunList runlist = RunList.builder().role("webserver").role("firewall").build(); Role role = Role.builder().name("foo").runlist(runlist).build(); assertEquals(role.toJsonString(), "{\"name\": \"foo\",\"description\":\"\",\"default_attributes\":{},\"override_attributes\":{}," + "\"json_class\":\"Chef::Role\",\"chef_type\":\"role\"," + "\"run_list\":[\"role[webserver]\",\"role[firewall]\"]}"); }
public void testToJsonStringWithOverrideAttributes() { Role role = Role.builder().name("foo").jsonOverrideAttributes("{\"foo\":\"bar\"}").build(); assertEquals(role.toJsonString(), "{\"name\": \"foo\",\"description\":\"\",\"default_attributes\":{}," + "\"override_attributes\":{\"foo\":\"bar\"},\"json_class\":\"Chef::Role\",\"chef_type\":\"role\"," + "\"run_list\":[]}"); }
public void testToJsonStringWithRolesAndRecipes() { RunList runlist = RunList.builder().role("webserver").recipe("git").build(); Role role = Role.builder().name("foo").runlist(runlist).build(); assertEquals(role.toJsonString(), "{\"name\": \"foo\",\"description\":\"\",\"default_attributes\":{},\"override_attributes\":{}," + "\"json_class\":\"Chef::Role\",\"chef_type\":\"role\"," + "\"run_list\":[\"role[webserver]\",\"recipe[git]\"]}"); } }
public void testToJsonStringWithDescription() { Role role = Role.builder().name("foo").description("Foo role").build(); assertEquals(role.toJsonString(), "{\"name\": \"foo\",\"description\":\"Foo role\",\"default_attributes\":{}," + "\"override_attributes\":{},\"json_class\":\"Chef::Role\",\"chef_type\":\"role\",\"run_list\":[]}"); }
public void testToJsonStringWithSingleRole() { RunList runlist = RunList.builder().role("webserver").build(); Role role = Role.builder().name("foo").runlist(runlist).build(); assertEquals(role.toJsonString(), "{\"name\": \"foo\",\"description\":\"\",\"default_attributes\":{},\"override_attributes\":{}," + "\"json_class\":\"Chef::Role\",\"chef_type\":\"role\",\"run_list\":[\"role[webserver]\"]}"); }
public void testToJsonStringWithDefaultAttributes() { Role role = Role.builder().name("foo").jsonDefaultAttributes("{\"foo\":\"bar\"}").build(); assertEquals(role.toJsonString(), "{\"name\": \"foo\",\"description\":\"\",\"default_attributes\":{\"foo\":\"bar\"}," + "\"override_attributes\":{},\"json_class\":\"Chef::Role\",\"chef_type\":\"role\"," + "\"run_list\":[]}"); }
public void testToJsonStringWithMultipleRecipes() { RunList runlist = RunList.builder().recipe("apache2").recipe("git").build(); Role role = Role.builder().name("foo").runlist(runlist).build(); assertEquals(role.toJsonString(), "{\"name\": \"foo\",\"description\":\"\",\"default_attributes\":{},\"override_attributes\":{}," + "\"json_class\":\"Chef::Role\",\"chef_type\":\"role\"," + "\"run_list\":[\"recipe[apache2]\",\"recipe[git]\"]}"); }
public void testToJsonStringWithOnlyName() { Role role = Role.builder().name("foo").build(); assertEquals(role.toJsonString(), "{\"name\": \"foo\",\"description\":\"\",\"default_attributes\":{}," + "\"override_attributes\":{},\"json_class\":\"Chef::Role\",\"chef_type\":\"role\",\"run_list\":[]}"); }
public void testToJsonStringWithSingleRecipe() { RunList runlist = RunList.builder().recipe("apache2").build(); Role role = Role.builder().name("foo").runlist(runlist).build(); assertEquals(role.toJsonString(), "{\"name\": \"foo\",\"description\":\"\",\"default_attributes\":{},\"override_attributes\":{}," + "\"json_class\":\"Chef::Role\",\"chef_type\":\"role\",\"run_list\":[\"recipe[apache2]\"]}"); }
public void testToJsonStringWithOverrideAttributes() { Role role = Role.builder().name("foo").jsonOverrideAttributes("{\"foo\":\"bar\"}").build(); assertEquals(role.toJsonString(), "{\"name\": \"foo\",\"description\":\"\",\"default_attributes\":{}," + "\"override_attributes\":{\"foo\":\"bar\"},\"json_class\":\"Chef::Role\",\"chef_type\":\"role\"," + "\"run_list\":[]}"); }
public void testToJsonStringWithSingleRole() { RunList runlist = RunList.builder().role("webserver").build(); Role role = Role.builder().name("foo").runlist(runlist).build(); assertEquals(role.toJsonString(), "{\"name\": \"foo\",\"description\":\"\",\"default_attributes\":{},\"override_attributes\":{}," + "\"json_class\":\"Chef::Role\",\"chef_type\":\"role\",\"run_list\":[\"role[webserver]\"]}"); }
public void testToJsonStringWithDescription() { Role role = Role.builder().name("foo").description("Foo role").build(); assertEquals(role.toJsonString(), "{\"name\": \"foo\",\"description\":\"Foo role\",\"default_attributes\":{}," + "\"override_attributes\":{},\"json_class\":\"Chef::Role\",\"chef_type\":\"role\",\"run_list\":[]}"); }
public void testToJsonStringWithMultipleRoles() { RunList runlist = RunList.builder().role("webserver").role("firewall").build(); Role role = Role.builder().name("foo").runlist(runlist).build(); assertEquals(role.toJsonString(), "{\"name\": \"foo\",\"description\":\"\",\"default_attributes\":{},\"override_attributes\":{}," + "\"json_class\":\"Chef::Role\",\"chef_type\":\"role\"," + "\"run_list\":[\"role[webserver]\",\"role[firewall]\"]}"); }
public void testToJsonStringWithRolesAndRecipes() { RunList runlist = RunList.builder().role("webserver").recipe("git").build(); Role role = Role.builder().name("foo").runlist(runlist).build(); assertEquals(role.toJsonString(), "{\"name\": \"foo\",\"description\":\"\",\"default_attributes\":{},\"override_attributes\":{}," + "\"json_class\":\"Chef::Role\",\"chef_type\":\"role\"," + "\"run_list\":[\"role[webserver]\",\"recipe[git]\"]}"); } }
public void testToJsonStringWithSingleRecipe() { RunList runlist = RunList.builder().recipe("apache2").build(); Role role = Role.builder().name("foo").runlist(runlist).build(); assertEquals(role.toJsonString(), "{\"name\": \"foo\",\"description\":\"\",\"default_attributes\":{},\"override_attributes\":{}," + "\"json_class\":\"Chef::Role\",\"chef_type\":\"role\",\"run_list\":[\"recipe[apache2]\"]}"); }
public void testToJsonStringWithMultipleRecipes() { RunList runlist = RunList.builder().recipe("apache2").recipe("git").build(); Role role = Role.builder().name("foo").runlist(runlist).build(); assertEquals(role.toJsonString(), "{\"name\": \"foo\",\"description\":\"\",\"default_attributes\":{},\"override_attributes\":{}," + "\"json_class\":\"Chef::Role\",\"chef_type\":\"role\"," + "\"run_list\":[\"recipe[apache2]\",\"recipe[git]\"]}"); }