root / trunk / tests / test_download_queue_two_servers.c @ 1847
History | View | Annotate | Download (14.8 KB)
| 1 | 
                  /* 
                 | 
              
|---|---|
| 2 | 
                  Copyright (C) 2005-2011 Erik van Pienbroek  | 
              
| 3 | 
                   | 
              
| 4 | 
                  This program is free software; you can redistribute it and/or modify  | 
              
| 5 | 
                  it under the terms of the GNU General Public License as published by  | 
              
| 6 | 
                  the Free Software Foundation; either version 2 of the License, or  | 
              
| 7 | 
                  (at your option) any later version.  | 
              
| 8 | 
                   | 
              
| 9 | 
                  This program is distributed in the hope that it will be useful,  | 
              
| 10 | 
                  but WITHOUT ANY WARRANTY; without even the implied warranty of  | 
              
| 11 | 
                  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  | 
              
| 12 | 
                  GNU General Public License for more details.  | 
              
| 13 | 
                   | 
              
| 14 | 
                  You should have received a copy of the GNU General Public License  | 
              
| 15 | 
                  along with this program; if not, write to the Free Software  | 
              
| 16 | 
                  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA  | 
              
| 17 | 
                  */  | 
              
| 18 | 
                   | 
              
| 19 | 
                  #include  | 
              
| 20 | 
                  #include  | 
              
| 21 | 
                  #include  | 
              
| 22 | 
                   | 
              
| 23 | 
                  #include "common.h"  | 
              
| 24 | 
                  #include "test_download_queue.h"  | 
              
| 25 | 
                   | 
              
| 26 | 
                  #include "nntpgrab_utils.h"  | 
              
| 27 | 
                  #include "download_queue.h"  | 
              
| 28 | 
                   | 
              
| 29 | 
                  static void  | 
              
| 30 | 
                  add_servers(gboolean add_server_before, gboolean equal_priority)  | 
              
| 31 | 
                  {
                 | 
              
| 32 | 
                  char *errmsg = NULL;  | 
              
| 33 | 
                  NGConfigServer server;  | 
              
| 34 | 
                   | 
              
| 35 | 
                      g_assert(configuration_get_avail_servers(config) == NULL);
                 | 
              
| 36 | 
                   | 
              
| 37 | 
                      if (!add_server_before) fill_queue_with_dummy_data();
                 | 
              
| 38 | 
                   | 
              
| 39 | 
                  memset(&server, 0, sizeof(server));  | 
              
| 40 | 
                      strcpy(server.servername, "server1");
                 | 
              
| 41 | 
                      strcpy(server.hostname, "host1");
                 | 
              
| 42 | 
                      server.port = 119;
                 | 
              
| 43 | 
                  server.enabled = TRUE;  | 
              
| 44 | 
                      server.max_threads = 3;
                 | 
              
| 45 | 
                  server.priority = SERVER_PRIORITY_HIGH;  | 
              
| 46 | 
                   | 
              
| 47 | 
                      if (!configuration_add_server(config, server, &errmsg)) {
                 | 
              
| 48 | 
                          FAIL_TEST("Unable to add server: %s\n", errmsg);
                 | 
              
| 49 | 
                  g_free(errmsg);  | 
              
| 50 | 
                          return;
                 | 
              
| 51 | 
                  }  | 
              
| 52 | 
                   | 
              
| 53 | 
                  memset(&server, 0, sizeof(server));  | 
              
| 54 | 
                      strcpy(server.servername, "server2");
                 | 
              
| 55 | 
                      strcpy(server.hostname, "host2");
                 | 
              
| 56 | 
                      server.port = 119;
                 | 
              
| 57 | 
                  server.enabled = TRUE;  | 
              
| 58 | 
                      server.max_threads = 3;
                 | 
              
| 59 | 
                  server.priority = (equal_priority ? SERVER_PRIORITY_HIGH : SERVER_PRIORITY_NORMAL);  | 
              
| 60 | 
                   | 
              
| 61 | 
                      if (!configuration_add_server(config, server, &errmsg)) {
                 | 
              
| 62 | 
                          FAIL_TEST("Unable to add server: %s\n", errmsg);
                 | 
              
| 63 | 
                  g_free(errmsg);  | 
              
| 64 | 
                          return;
                 | 
              
| 65 | 
                  }  | 
              
| 66 | 
                   | 
              
| 67 | 
                      if (add_server_before) fill_queue_with_dummy_data();
                 | 
              
| 68 | 
                  }  | 
              
| 69 | 
                   | 
              
| 70 | 
                  void
                 | 
              
| 71 | 
                  test_download_queue_setup_two_servers_equal_prio_before(void *data, gconstpointer user_data)
                 | 
              
| 72 | 
                  {
                 | 
              
| 73 | 
                  add_servers(TRUE, TRUE);  | 
              
| 74 | 
                  }  | 
              
| 75 | 
                   | 
              
| 76 | 
                  void
                 | 
              
| 77 | 
                  test_download_queue_setup_two_servers_different_prio_before(void *data, gconstpointer user_data)
                 | 
              
| 78 | 
                  {
                 | 
              
| 79 | 
                  add_servers(TRUE, FALSE);  | 
              
| 80 | 
                  }  | 
              
| 81 | 
                   | 
              
| 82 | 
                  void
                 | 
              
| 83 | 
                  test_download_queue_setup_two_servers_equal_prio_after(void *data, gconstpointer user_data)
                 | 
              
| 84 | 
                  {
                 | 
              
| 85 | 
                  add_servers(FALSE, TRUE);  | 
              
| 86 | 
                  }  | 
              
| 87 | 
                   | 
              
| 88 | 
                  void
                 | 
              
| 89 | 
                  test_download_queue_setup_two_servers_different_prio_after(void *data, gconstpointer user_data)
                 | 
              
| 90 | 
                  {
                 | 
              
| 91 | 
                  add_servers(FALSE, FALSE);  | 
              
| 92 | 
                  }  | 
              
| 93 | 
                   | 
              
| 94 | 
                  void
                 | 
              
| 95 | 
                  test_download_queue_setup_two_servers_before_one_initial(void *data, gconstpointer user_data)
                 | 
              
| 96 | 
                  {
                 | 
              
| 97 | 
                  test_download_queue_setup_one_server_before(data, user_data);  | 
              
| 98 | 
                  }  | 
              
| 99 | 
                   | 
              
| 100 | 
                  void
                 | 
              
| 101 | 
                  test_download_queue_setup_two_servers_after_one_initial(void *data, gconstpointer user_data)
                 | 
              
| 102 | 
                  {
                 | 
              
| 103 | 
                  test_download_queue_setup_one_server_after(data, user_data);  | 
              
| 104 | 
                  }  | 
              
| 105 | 
                   | 
              
| 106 | 
                  void
                 | 
              
| 107 | 
                  test_download_queue_teardown_two_servers(void *data, gconstpointer user_data)
                 | 
              
| 108 | 
                  {
                 | 
              
| 109 | 
                  char *errmsg = NULL;  | 
              
| 110 | 
                   | 
              
| 111 | 
                      g_assert(configuration_get_avail_servers(config) != NULL);
                 | 
              
| 112 | 
                   | 
              
| 113 | 
                  drop_dummy_data_from_queue();  | 
              
| 114 | 
                   | 
              
| 115 | 
                  if (!configuration_del_server(config, "server2", &errmsg)) {  | 
              
| 116 | 
                          FAIL_TEST("Unable to remove server: %s\n", errmsg);
                 | 
              
| 117 | 
                  g_free(errmsg);  | 
              
| 118 | 
                          return;
                 | 
              
| 119 | 
                  }  | 
              
| 120 | 
                   | 
              
| 121 | 
                  if (!configuration_del_server(config, "server1", &errmsg)) {  | 
              
| 122 | 
                          FAIL_TEST("Unable to remove server: %s\n", errmsg);
                 | 
              
| 123 | 
                  g_free(errmsg);  | 
              
| 124 | 
                          return;
                 | 
              
| 125 | 
                  }  | 
              
| 126 | 
                  }  | 
              
| 127 | 
                  static void  | 
              
| 128 | 
                  test_download_queue_two_servers_generic(gboolean all_available_on_one, gboolean all_available_on_two, gboolean equal_priority, gboolean server_added_between)  | 
              
| 129 | 
                  {
                 | 
              
| 130 | 
                      /* There should be 10 files with 4 parts each in the download queue now */
                 | 
              
| 131 | 
                      int i, server_id;
                 | 
              
| 132 | 
                      int num_iterations, num_iterations_server1, num_servers;
                 | 
              
| 133 | 
                   | 
              
| 134 | 
                      NNTPCollection *prev_collection = NULL;
                 | 
              
| 135 | 
                      NNTPFile *prev_file = NULL;
                 | 
              
| 136 | 
                   | 
              
| 137 | 
                      NNTPCollection *collection = NULL;
                 | 
              
| 138 | 
                      NNTPFile *file = NULL;
                 | 
              
| 139 | 
                      NNTPPart *part = NULL;
                 | 
              
| 140 | 
                  gboolean nothing_to_download_or_active = FALSE;  | 
              
| 141 | 
                  gboolean task_returned;  | 
              
| 142 | 
                   | 
              
| 143 | 
                  gboolean server2_available = !server_added_between;  | 
              
| 144 | 
                      GList *list, *files = NULL;
                 | 
              
| 145 | 
                   | 
              
| 146 | 
                      if (equal_priority && all_available_on_one) {
                 | 
              
| 147 | 
                          num_iterations = 40;
                 | 
              
| 148 | 
                  } else if (equal_priority && !all_available_on_one) {  | 
              
| 149 | 
                          num_iterations = 54;
                 | 
              
| 150 | 
                      } else {
                 | 
              
| 151 | 
                          num_iterations = 80;
                 | 
              
| 152 | 
                  }  | 
              
| 153 | 
                   | 
              
| 154 | 
                      num_iterations_server1 = 0;
                 | 
              
| 155 | 
                  num_servers = (server_added_between ? 1 : 2);  | 
              
| 156 | 
                   | 
              
| 157 | 
                      g_test_message("Num iterations for this testcase = %i", num_iterations);
                 | 
              
| 158 | 
                      g_test_message("Server2 available = %i", server2_available);
                 | 
              
| 159 | 
                   | 
              
| 160 | 
                  for (i = 0; i < num_iterations; i++) {  | 
              
| 161 | 
                          g_test_message("Iteration %i", i);
                 | 
              
| 162 | 
                   | 
              
| 163 | 
                          /* Try server 1 first, then server 2 (if it's available), then server 1, etc */
                 | 
              
| 164 | 
                  if (num_iterations_server1 == 40) { /* Don't try to consult server 1 anymore once it has been tried for all files+parts */  | 
              
| 165 | 
                              server_id = 1;
                 | 
              
| 166 | 
                  } else if (server2_available) {  | 
              
| 167 | 
                              server_id = i % 2;
                 | 
              
| 168 | 
                          } else {
                 | 
              
| 169 | 
                              server_id = 0;
                 | 
              
| 170 | 
                  }  | 
              
| 171 | 
                   | 
              
| 172 | 
                  task_returned = download_queue_get_next_part_to_download(&collection, &file, &part, server_id, ¬hing_to_download_or_active);  | 
              
| 173 | 
                          if (!task_returned) {
                 | 
              
| 174 | 
                  if (server_id == 1) {  | 
              
| 175 | 
                                  /* This is okay */
                 | 
              
| 176 | 
                                  /* TODO: Implement */
                 | 
              
| 177 | 
                                  g_test_message("Nothing was returned for server_id %i", server_id);
                 | 
              
| 178 | 
                                  continue;
                 | 
              
| 179 | 
                              } else {
                 | 
              
| 180 | 
                                  g_test_message("i = %i", i);
                 | 
              
| 181 | 
                                  g_test_message("server_id = %i", server_id);
                 | 
              
| 182 | 
                                  g_test_message("nothing_to_download = %i", nothing_to_download_or_active);
                 | 
              
| 183 | 
                                  FAIL_TEST("download_queue_get_next_part_to_download returned FALSE while it isn't expected");
                 | 
              
| 184 | 
                                  return;
                 | 
              
| 185 | 
                  }  | 
              
| 186 | 
                          } else {
                 | 
              
| 187 | 
                  g_assert_cmpint(nothing_to_download_or_active, ==, FALSE);  | 
              
| 188 | 
                              g_assert(collection != NULL);
                 | 
              
| 189 | 
                              g_assert(file != NULL);
                 | 
              
| 190 | 
                              g_assert(part != NULL);
                 | 
              
| 191 | 
                   | 
              
| 192 | 
                              if (equal_priority) {
                 | 
              
| 193 | 
                                  if (all_available_on_one) {
                 | 
              
| 194 | 
                  char *expected_subject = g_strdup_printf("file %i", (int) (i / 4) + 1);  | 
              
| 195 | 
                  g_assert_cmpint(part->part_num, ==, (i % 4) + 1);  | 
              
| 196 | 
                  g_assert_cmpstr(file->subject, ==, expected_subject);  | 
              
| 197 | 
                  g_free(expected_subject);  | 
              
| 198 | 
                                  } else {
                 | 
              
| 199 | 
                                      /* The first server has marked each 2nd file as being unavailable so it will 
                 | 
              
| 200 | 
                  * be retried by the second server */  | 
              
| 201 | 
                                      /* TODO: Implement */
                 | 
              
| 202 | 
                  }  | 
              
| 203 | 
                              } else {
                 | 
              
| 204 | 
                                  /* TODO: Implement */
                 | 
              
| 205 | 
                  }  | 
              
| 206 | 
                   | 
              
| 207 | 
                  if (prev_collection == NULL) {  | 
              
| 208 | 
                  prev_collection = collection;  | 
              
| 209 | 
                              } else {
                 | 
              
| 210 | 
                  g_assert(prev_collection == collection);  | 
              
| 211 | 
                  }  | 
              
| 212 | 
                   | 
              
| 213 | 
                              if (prev_file != file) {
                 | 
              
| 214 | 
                  prev_file = file;  | 
              
| 215 | 
                  files = g_list_append(files, file);  | 
              
| 216 | 
                  }  | 
              
| 217 | 
                  }  | 
              
| 218 | 
                   | 
              
| 219 | 
                          /* Update the status of the part */
                 | 
              
| 220 | 
                  if ((server_id == 0 && !all_available_on_one && num_iterations_server1 % 2 == 0) ||  | 
              
| 221 | 
                  (server_id == 1 && !all_available_on_two && i % 4 == 0)) {  | 
              
| 222 | 
                   | 
              
| 223 | 
                              /* Indicate the every second part isn't available on the server and it shouldn't be retried again */
                 | 
              
| 224 | 
                              g_test_message("Subject '%s' part %i was marked as being unavailable for server_id %i", file->subject, part->part_num, server_id);
                 | 
              
| 225 | 
                  download_queue_update_part_status("dummy", 0, collection, file, part, server_id, FALSE, FALSE, TRUE);  | 
              
| 226 | 
                          } else {
                 | 
              
| 227 | 
                              /* Indicate that the file was downloaded succesfully */
                 | 
              
| 228 | 
                              g_test_message("Subject '%s' part %i was marked as download successfully for server_id %i", file->subject, part->part_num, server_id);
                 | 
              
| 229 | 
                  download_queue_update_part_status("dummy", 0, collection, file, part, server_id, TRUE, FALSE, FALSE);  | 
              
| 230 | 
                  }  | 
              
| 231 | 
                   | 
              
| 232 | 
                          /* If we're halfway, add a new server if necessary */
                 | 
              
| 233 | 
                  if (server_added_between && i == 10) {  | 
              
| 234 | 
                  char *errmsg = NULL;  | 
              
| 235 | 
                  NGConfigServer server;  | 
              
| 236 | 
                   | 
              
| 237 | 
                  memset(&server, 0, sizeof(server));  | 
              
| 238 | 
                              strcpy(server.servername, "server2");
                 | 
              
| 239 | 
                              strcpy(server.hostname, "host2");
                 | 
              
| 240 | 
                              server.port = 119;
                 | 
              
| 241 | 
                  server.enabled = TRUE;  | 
              
| 242 | 
                              server.max_threads = 1;
                 | 
              
| 243 | 
                   | 
              
| 244 | 
                              if (!configuration_add_server(config, server, &errmsg)) {
                 | 
              
| 245 | 
                                  FAIL_TEST("Unable to add server: %s\n", errmsg);
                 | 
              
| 246 | 
                  g_free(errmsg);  | 
              
| 247 | 
                                  return;
                 | 
              
| 248 | 
                  }  | 
              
| 249 | 
                  }  | 
              
| 250 | 
                   | 
              
| 251 | 
                  if (server_id == 0) {  | 
              
| 252 | 
                  num_iterations_server1++;  | 
              
| 253 | 
                  }  | 
              
| 254 | 
                  }  | 
              
| 255 | 
                   | 
              
| 256 | 
                      /* We processed all files now. If we try to request another part it should indicate that there's nothing to download anymore */
                 | 
              
| 257 | 
                  if (!download_queue_get_next_part_to_download(&collection, &file, &part, 0, ¬hing_to_download_or_active)) {  | 
              
| 258 | 
                          /* Nothing is returned which is good */
                 | 
              
| 259 | 
                          /* The flag nothing_to_download_or_active should be FALSE as all files are downloaded, but not decoded yet */
                 | 
              
| 260 | 
                  g_assert_cmpint(nothing_to_download_or_active, ==, FALSE);  | 
              
| 261 | 
                          g_assert(collection == NULL);
                 | 
              
| 262 | 
                          g_assert(file == NULL);
                 | 
              
| 263 | 
                          g_assert(part == NULL);
                 | 
              
| 264 | 
                      } else {
                 | 
              
| 265 | 
                          FAIL_TEST("download_queue_get_next_part_to_download returned TRUE while it isn't expected");
                 | 
              
| 266 | 
                          return;
                 | 
              
| 267 | 
                  }  | 
              
| 268 | 
                   | 
              
| 269 | 
                      /* Mark all files as finished (downloaded+decoded) */
                 | 
              
| 270 | 
                  list = files;  | 
              
| 271 | 
                      while (list) {
                 | 
              
| 272 | 
                  file = (NNTPFile*) list->data;  | 
              
| 273 | 
                   | 
              
| 274 | 
                  if (!all_available_on_one && g_list_index(files, file) % 2 == 0) {  | 
              
| 275 | 
                              /* Indicate that not all parts were available */
                 | 
              
| 276 | 
                              download_queue_mark_file_as_decoded_and_unref(prev_collection, file, "somefilename", TASK_STATE_FINISHED_INCOMPLETE);
                 | 
              
| 277 | 
                          } else {
                 | 
              
| 278 | 
                              /* Indicate that all parts were decoded succesfully */
                 | 
              
| 279 | 
                              download_queue_mark_file_as_decoded_and_unref(prev_collection, file, "somefilename", TASK_STATE_FINISHED_COMPLETE);
                 | 
              
| 280 | 
                  }  | 
              
| 281 | 
                   | 
              
| 282 | 
                  list = g_list_next(list);  | 
              
| 283 | 
                  }  | 
              
| 284 | 
                  g_list_free(files);  | 
              
| 285 | 
                   | 
              
| 286 | 
                      /* Verify that nothing_to_download_or_active is TRUE now */
                 | 
              
| 287 | 
                  if (!download_queue_get_next_part_to_download(&collection, &file, &part, 0, ¬hing_to_download_or_active)) {  | 
              
| 288 | 
                          /* Nothing is returned which is good */
                 | 
              
| 289 | 
                  g_assert_cmpint(nothing_to_download_or_active, ==, TRUE);  | 
              
| 290 | 
                          g_assert(collection == NULL);
                 | 
              
| 291 | 
                          g_assert(file == NULL);
                 | 
              
| 292 | 
                          g_assert(part == NULL);
                 | 
              
| 293 | 
                      } else {
                 | 
              
| 294 | 
                          FAIL_TEST("download_queue_get_next_part_to_download returned TRUE while it isn't expected");
                 | 
              
| 295 | 
                          return;
                 | 
              
| 296 | 
                  }  | 
              
| 297 | 
                  }  | 
              
| 298 | 
                   | 
              
| 299 | 
                  void
                 | 
              
| 300 | 
                  test_download_queue_two_servers_equal_prio_all_available_on_one(void *data, gconstpointer user_data)
                 | 
              
| 301 | 
                  {
                 | 
              
| 302 | 
                      /* Assume for this testcase that all parts are available on server one. 
                 | 
              
| 303 | 
                  * Both servers have an equal priority */  | 
              
| 304 | 
                  test_download_queue_two_servers_generic(TRUE, FALSE, TRUE, FALSE);  | 
              
| 305 | 
                  }  | 
              
| 306 | 
                   | 
              
| 307 | 
                  void
                 | 
              
| 308 | 
                  test_download_queue_two_servers_equal_prio_all_available_on_one_server_two_added_between(void *data, gconstpointer user_data)
                 | 
              
| 309 | 
                  {
                 | 
              
| 310 | 
                      /* Assume for this testcase that all parts are available on server one 
                 | 
              
| 311 | 
                  * and that a new server is added halfway. Both servers have an equal priority */  | 
              
| 312 | 
                  test_download_queue_two_servers_generic(TRUE, FALSE, TRUE, TRUE);  | 
              
| 313 | 
                  }  | 
              
| 314 | 
                   | 
              
| 315 | 
                  void
                 | 
              
| 316 | 
                  test_download_queue_two_servers_equal_prio_some_available_on_one_all_on_two(void *data, gconstpointer user_data)
                 | 
              
| 317 | 
                  {
                 | 
              
| 318 | 
                      /* Assume for this testcase that some parts are available on server one 
                 | 
              
| 319 | 
                  * and the rest is all available on server two. Both servers have an equal priority */  | 
              
| 320 | 
                  test_download_queue_two_servers_generic(FALSE, TRUE, TRUE, FALSE);  | 
              
| 321 | 
                  }  | 
              
| 322 | 
                   | 
              
| 323 | 
                  void
                 | 
              
| 324 | 
                  test_download_queue_two_servers_equal_prio_some_available_on_one_all_on_two_server_two_added_between(void *data, gconstpointer user_data)
                 | 
              
| 325 | 
                  {
                 | 
              
| 326 | 
                      /* Assume for this testcase that some parts are available on server one 
                 | 
              
| 327 | 
                  * and the rest is available on server two which is added halfway.  | 
              
| 328 | 
                  * Both servers have an equal priority */  | 
              
| 329 | 
                  test_download_queue_two_servers_generic(FALSE, TRUE, TRUE, TRUE);  | 
              
| 330 | 
                  }  | 
              
| 331 | 
                   | 
              
| 332 | 
                  void
                 | 
              
| 333 | 
                  test_download_queue_two_servers_equal_prio_some_available_on_one_some_on_two(void *data, gconstpointer user_data)
                 | 
              
| 334 | 
                  {
                 | 
              
| 335 | 
                      /* Assume for this testcase that some parts are available on server one 
                 | 
              
| 336 | 
                  * and some are available on server two. Both servers have an equal priority */  | 
              
| 337 | 
                  test_download_queue_two_servers_generic(FALSE, FALSE, TRUE, FALSE);  | 
              
| 338 | 
                  }  | 
              
| 339 | 
                   | 
              
| 340 | 
                  void
                 | 
              
| 341 | 
                  test_download_queue_two_servers_equal_prio_some_available_on_one_some_on_two_server_two_added_between(void *data, gconstpointer user_data)
                 | 
              
| 342 | 
                  {
                 | 
              
| 343 | 
                      /* Assume for this testcase that some parts are available on server one 
                 | 
              
| 344 | 
                  * and some are available on server two which is added halfway.  | 
              
| 345 | 
                  * Both servers have an equal priority */  | 
              
| 346 | 
                  test_download_queue_two_servers_generic(FALSE, FALSE, TRUE, TRUE);  | 
              
| 347 | 
                  }  | 
              
| 348 | 
                   | 
              
| 349 | 
                  void
                 | 
              
| 350 | 
                  test_download_queue_two_servers_different_prio_all_available_on_one(void *data, gconstpointer user_data)
                 | 
              
| 351 | 
                  {
                 | 
              
| 352 | 
                      /* Assume for this testcase that all parts are available on server one. 
                 | 
              
| 353 | 
                  * Both servers have a different priority */  | 
              
| 354 | 
                  test_download_queue_two_servers_generic(TRUE, FALSE, FALSE, FALSE);  | 
              
| 355 | 
                  }  | 
              
| 356 | 
                   | 
              
| 357 | 
                  void
                 | 
              
| 358 | 
                  test_download_queue_two_servers_different_prio_all_available_on_one_server_two_added_between(void *data, gconstpointer user_data)
                 | 
              
| 359 | 
                  {
                 | 
              
| 360 | 
                      /* Assume for this testcase that all parts are available on server one 
                 | 
              
| 361 | 
                  * and that a new server is added halfway. Both servers have a different priority */  | 
              
| 362 | 
                  test_download_queue_two_servers_generic(TRUE, FALSE, FALSE, TRUE);  | 
              
| 363 | 
                  }  | 
              
| 364 | 
                   | 
              
| 365 | 
                  void
                 | 
              
| 366 | 
                  test_download_queue_two_servers_different_prio_some_available_on_one_all_on_two(void *data, gconstpointer user_data)
                 | 
              
| 367 | 
                  {
                 | 
              
| 368 | 
                      /* Assume for this testcase that some parts are available on server one 
                 | 
              
| 369 | 
                  * and the rest is all available on server two. Both servers have a different priority */  | 
              
| 370 | 
                  test_download_queue_two_servers_generic(FALSE, TRUE, FALSE, FALSE);  | 
              
| 371 | 
                  }  | 
              
| 372 | 
                   | 
              
| 373 | 
                  void
                 | 
              
| 374 | 
                  test_download_queue_two_servers_different_prio_some_available_on_one_all_on_two_server_two_added_between(void *data, gconstpointer user_data)
                 | 
              
| 375 | 
                  {
                 | 
              
| 376 | 
                      /* Assume for this testcase that some parts are available on server one 
                 | 
              
| 377 | 
                  * and the rest is available on server two which is added halfway.  | 
              
| 378 | 
                  * Both servers have a different priority */  | 
              
| 379 | 
                  test_download_queue_two_servers_generic(FALSE, TRUE, FALSE, TRUE);  | 
              
| 380 | 
                  }  | 
              
| 381 | 
                   | 
              
| 382 | 
                  void
                 | 
              
| 383 | 
                  test_download_queue_two_servers_different_prio_some_available_on_one_some_on_two(void *data, gconstpointer user_data)
                 | 
              
| 384 | 
                  {
                 | 
              
| 385 | 
                      /* Assume for this testcase that some parts are available on server one 
                 | 
              
| 386 | 
                  * and some are available on server two. Both servers have a different priority */  | 
              
| 387 | 
                  test_download_queue_two_servers_generic(FALSE, FALSE, FALSE, FALSE);  | 
              
| 388 | 
                  }  | 
              
| 389 | 
                   | 
              
| 390 | 
                  void
                 | 
              
| 391 | 
                  test_download_queue_two_servers_different_prio_some_available_on_one_some_on_two_server_two_added_between(void *data, gconstpointer user_data)
                 | 
              
| 392 | 
                  {
                 | 
              
| 393 | 
                      /* Assume for this testcase that some parts are available on server one 
                 | 
              
| 394 | 
                  * and some are available on server two which is added halfway.  | 
              
| 395 | 
                  * Both servers have a different priority */  | 
              
| 396 | 
                  test_download_queue_two_servers_generic(FALSE, FALSE, FALSE, TRUE);  | 
              
| 397 | 
                  }  | 
              
NNTPGrab

