test_class.declarator: mockContext
test_class.modifier: private
test_class.original_string: private Context mockContext;
test_class.type: Context
test_class.var_name: mockContext
test_class.declarator: file
test_class.modifier: private
test_class.original_string: private File file;
test_class.type: File
test_class.var_name: file
test_class.declarator: singleWriterMultipleReaderFile
test_class.modifier: private
test_class.original_string: private SingleWriterMultipleReaderFile singleWriterMultipleReaderFile;
test_class.type: SingleWriterMultipleReaderFile
test_class.var_name: singleWriterMultipleReaderFile
test_class.declarator: connection
test_class.modifier: private
test_class.original_string: private HttpURLConnection connection;
test_class.type: HttpURLConnection
test_class.var_name: connection
test_class.declarator: finishAnswer
test_class.modifier: private
test_class.original_string: private CountingAnswer finishAnswer;
test_class.type: CountingAnswer
test_class.var_name: finishAnswer
test_class.declarator: failAnswer
test_class.modifier: private
test_class.original_string: private CountingAnswer failAnswer;
test_class.type: CountingAnswer
test_class.var_name: failAnswer
test_class.declarator: url
test_class.modifier: private
test_class.original_string: private URL url;
test_class.type: URL
test_class.var_name: url
test_class.declarator: realTask
test_class.modifier: private
test_class.original_string: private RuleDatabaseUpdateTask realTask;
test_class.type: RuleDatabaseUpdateTask
test_class.var_name: realTask
test_class.declarator: mockTask
test_class.modifier: private
test_class.original_string: private RuleDatabaseUpdateTask mockTask;
test_class.type: RuleDatabaseUpdateTask
test_class.var_name: mockTask
test_class.declarator: mockResolver
test_class.modifier: private
test_class.original_string: private ContentResolver mockResolver;
test_class.type: ContentResolver
test_class.var_name: mockResolver
test_class.file: app/src/test/java/org/jak_linux/dns66/db/RuleDatabaseItemUpdateRunnableTest.java
test_class.identifier: RuleDatabaseItemUpdateRunnableTest
test_case.body: @Test
      public void testShouldDownload() throws Exception {
          Configuration.Item item = new Configuration.Item();
          item.state = Configuration.Item.STATE_DENY;
          item.location = "example.com";
          item.title = "host-uri";
  
          RuleDatabaseItemUpdateRunnable itemUpdateRunnable = new RuleDatabaseItemUpdateRunnable(mockTask, mockContext, item);
  
          // File should not be downloaded
          assertFalse(itemUpdateRunnable.shouldDownload());
  
          // Content URI should
          item.location = "content://foo";
          assertTrue(itemUpdateRunnable.shouldDownload());
  
          // Do not download ignored URIs
          item.state = Configuration.Item.STATE_IGNORE;
          assertFalse(itemUpdateRunnable.shouldDownload());
          item.state = Configuration.Item.STATE_DENY;
  
          item.location = "https://foo";
          assertTrue(itemUpdateRunnable.shouldDownload());
  
          item.location = "http://foo";
          assertTrue(itemUpdateRunnable.shouldDownload());
      }
test_case.class_method_signature: RuleDatabaseItemUpdateRunnableTest.testShouldDownload()
test_case.full_signature: @Test public void testShouldDownload()
test_case.identifier: testShouldDownload
test_case.invocations: assertFalse shouldDownload assertTrue shouldDownload assertFalse shouldDownload assertTrue shouldDownload assertTrue shouldDownload
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testShouldDownload()
focal_class.declarator: CONNECT_TIMEOUT_MILLIS = 30000
focal_class.modifier: private static final
focal_class.original_string: private static final int CONNECT_TIMEOUT_MILLIS = 30000;
focal_class.type: int
focal_class.var_name: CONNECT_TIMEOUT_MILLIS
focal_class.declarator: READ_TIMEOUT_MILLIS = 10000
focal_class.modifier: private static final
focal_class.original_string: private static final int READ_TIMEOUT_MILLIS = 10000;
focal_class.type: int
focal_class.var_name: READ_TIMEOUT_MILLIS
focal_class.declarator: TAG = "RuleDbItemUpdate"
focal_class.modifier: private static final
focal_class.original_string: private static final String TAG = "RuleDbItemUpdate";
focal_class.type: String
focal_class.var_name: TAG
focal_class.declarator: parentTask
focal_class.original_string: RuleDatabaseUpdateTask parentTask;
focal_class.type: RuleDatabaseUpdateTask
focal_class.var_name: parentTask
focal_class.declarator: item
focal_class.original_string: Configuration.Item item;
focal_class.type: Configuration.Item
focal_class.var_name: item
focal_class.declarator: context
focal_class.original_string: Context context;
focal_class.type: Context
focal_class.var_name: context
focal_class.declarator: url
focal_class.modifier: private
focal_class.original_string: private URL url;
focal_class.type: URL
focal_class.var_name: url
focal_class.declarator: file
focal_class.modifier: private
focal_class.original_string: private File file;
focal_class.type: File
focal_class.var_name: file
focal_class.file: app/src/main/java/org/jak_linux/dns66/db/RuleDatabaseItemUpdateRunnable.java
focal_class.identifier: RuleDatabaseItemUpdateRunnable
focal_class.interfaces: implements Runnable
focal_class.class_method_signature: RuleDatabaseItemUpdateRunnable.RuleDatabaseItemUpdateRunnable(@NonNull RuleDatabaseUpdateTask parentTask, @NonNull Context context, @NonNull Configuration.Item item)
focal_class.full_signature:   RuleDatabaseItemUpdateRunnable(@NonNull RuleDatabaseUpdateTask parentTask, @NonNull Context context, @NonNull Configuration.Item item)
focal_class.identifier: RuleDatabaseItemUpdateRunnable
focal_class.parameters: (@NonNull RuleDatabaseUpdateTask parentTask, @NonNull Context context, @NonNull Configuration.Item item)
focal_class.signature:  RuleDatabaseItemUpdateRunnable(@NonNull RuleDatabaseUpdateTask parentTask, @NonNull Context context, @NonNull Configuration.Item item)
focal_class.class_method_signature: RuleDatabaseItemUpdateRunnable.shouldDownload()
focal_class.full_signature:  boolean shouldDownload()
focal_class.identifier: shouldDownload
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean shouldDownload()
focal_class.class_method_signature: RuleDatabaseItemUpdateRunnable.run()
focal_class.full_signature: @Override public void run()
focal_class.identifier: run
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void run()
focal_class.class_method_signature: RuleDatabaseItemUpdateRunnable.parseUri(String uri)
focal_class.full_signature:  Uri parseUri(String uri)
focal_class.identifier: parseUri
focal_class.parameters: (String uri)
focal_class.return: Uri
focal_class.signature: Uri parseUri(String uri)
focal_class.class_method_signature: RuleDatabaseItemUpdateRunnable.getHttpURLConnection(File file, SingleWriterMultipleReaderFile singleWriterMultipleReaderFile, URL url)
focal_class.full_signature: @NonNull HttpURLConnection getHttpURLConnection(File file, SingleWriterMultipleReaderFile singleWriterMultipleReaderFile, URL url)
focal_class.identifier: getHttpURLConnection
focal_class.modifiers: @NonNull
focal_class.parameters: (File file, SingleWriterMultipleReaderFile singleWriterMultipleReaderFile, URL url)
focal_class.return: HttpURLConnection
focal_class.signature: HttpURLConnection getHttpURLConnection(File file, SingleWriterMultipleReaderFile singleWriterMultipleReaderFile, URL url)
focal_class.class_method_signature: RuleDatabaseItemUpdateRunnable.internalOpenHttpConnection(URL url)
focal_class.full_signature:  HttpURLConnection internalOpenHttpConnection(URL url)
focal_class.identifier: internalOpenHttpConnection
focal_class.parameters: (URL url)
focal_class.return: HttpURLConnection
focal_class.signature: HttpURLConnection internalOpenHttpConnection(URL url)
focal_class.class_method_signature: RuleDatabaseItemUpdateRunnable.validateResponse(HttpURLConnection connection)
focal_class.full_signature:  boolean validateResponse(HttpURLConnection connection)
focal_class.identifier: validateResponse
focal_class.parameters: (HttpURLConnection connection)
focal_class.return: boolean
focal_class.signature: boolean validateResponse(HttpURLConnection connection)
focal_class.class_method_signature: RuleDatabaseItemUpdateRunnable.downloadFile(File file, SingleWriterMultipleReaderFile singleWriterMultipleReaderFile, HttpURLConnection connection)
focal_class.full_signature:  void downloadFile(File file, SingleWriterMultipleReaderFile singleWriterMultipleReaderFile, HttpURLConnection connection)
focal_class.identifier: downloadFile
focal_class.parameters: (File file, SingleWriterMultipleReaderFile singleWriterMultipleReaderFile, HttpURLConnection connection)
focal_class.return: void
focal_class.signature: void downloadFile(File file, SingleWriterMultipleReaderFile singleWriterMultipleReaderFile, HttpURLConnection connection)
focal_class.class_method_signature: RuleDatabaseItemUpdateRunnable.copyStream(InputStream inStream, OutputStream outStream)
focal_class.full_signature:  void copyStream(InputStream inStream, OutputStream outStream)
focal_class.identifier: copyStream
focal_class.parameters: (InputStream inStream, OutputStream outStream)
focal_class.return: void
focal_class.signature: void copyStream(InputStream inStream, OutputStream outStream)
focal_method.body: boolean shouldDownload() {
          if (item.state == Configuration.Item.STATE_IGNORE) {
              return false;
          }
  
          // Not sure if that is slow or not.
          if (item.location.startsWith("content:/")) {
              return true;
          }
  
          file = FileHelper.getItemFile(context, item);
          if (file == null || !item.isDownloadable()) {
              return false;
          }
  
          try {
              url = new URL(item.location);
          } catch (MalformedURLException e) {
              parentTask.addError(item, context.getString(R.string.invalid_url_s, item.location));
              return false;
          }
  
          return true;
      }
focal_method.class_method_signature: RuleDatabaseItemUpdateRunnable.shouldDownload()
focal_method.full_signature:  boolean shouldDownload()
focal_method.identifier: shouldDownload
focal_method.invocations: startsWith getItemFile isDownloadable addError getString
focal_method.parameters: ()
focal_method.return: boolean
focal_method.signature: boolean shouldDownload()