Skip to content

Add overwrite property#1303

Merged
bilal-alsharifi merged 14 commits intodevelopfrom
add_Overwrite_Property
Mar 11, 2020
Merged

Add overwrite property#1303
bilal-alsharifi merged 14 commits intodevelopfrom
add_Overwrite_Property

Conversation

@JulianKast
Copy link
Copy Markdown
Contributor

@JulianKast JulianKast commented Mar 5, 2020

Fixes #1302

This PR is ready for review.

Risk

This PR makes minor API changes.

Testing Plan

  • I have verified that I have not introduced new warnings in this PR (or explain why below)
  • I have run the unit tests with this PR
  • I have tested this PR against Core and verified behavior (if applicable, if not applicable, explain why below).
  • I have tested Android, Java SE, and Java EE

Unit Tests

Added unit test to test file not overwriting itself in BaseFileManager.uploadfiles as well as BaseFileManager.uploadFiles

Core Tests

Tested using manticore.

Summary

Added overwrite property to SdlFile in Android and JavaSE, added logic to baseFileManager.java to handle the overwrite property when uploading files.

Overwrite property is always set to true, in next major release to align with IOS we need to change it to false

To test I recommend after uploading one file to set the SdlFIle's overwrite property to false and upload it the second time in the completion listener's onComplete of the first upload to verify that the file has uploaded before it tries to upload it again. Ex:

		SdlFile livio = new SdlFile("livio", FileType.GRAPHIC_PNG, R.drawable.sdl, false);

		sdlManager.getFileManager().uploadFile(livio, new CompletionListener() {
			@Override
			public void onComplete(boolean success) {
				SdlFile livio2 = new SdlFile("livio", FileType.GRAPHIC_PNG, R.drawable.sdl, false);
				livio2.setOverwrite(false);
				sdlManager.getFileManager().uploadFile(livio2, new CompletionListener() {
					@Override
					public void onComplete(boolean success) {
					}
				});
			}
		});
Enhancements
  • Added overwrite property to SdlFile

CLA

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 5, 2020

Codecov Report

Merging #1303 into develop will increase coverage by <.01%.
The diff coverage is 83.33%.

Impacted file tree graph

@@              Coverage Diff              @@
##             develop    #1303      +/-   ##
=============================================
+ Coverage      47.55%   47.56%   +<.01%     
- Complexity      4389     4391       +2     
=============================================
  Files            488      488              
  Lines          23727    23735       +8     
  Branches        2735     2737       +2     
=============================================
+ Hits           11284    11290       +6     
  Misses         11755    11755              
- Partials         688      690       +2
Impacted Files Coverage Δ Complexity Δ
...smartdevicelink/managers/file/BaseFileManager.java 66.85% <83.33%> (+0.38%) 29 <0> (+2) ⬆️

Comment thread javaSE/src/main/java/com/smartdevicelink/managers/file/filetypes/SdlFile.java Outdated
Comment thread base/src/main/java/com/smartdevicelink/managers/file/BaseFileManager.java Outdated
Comment thread base/src/main/java/com/smartdevicelink/managers/file/BaseFileManager.java Outdated
Comment thread base/src/main/java/com/smartdevicelink/managers/file/BaseFileManager.java Outdated
Comment thread base/src/main/java/com/smartdevicelink/managers/file/BaseFileManager.java Outdated
@bilal-alsharifi bilal-alsharifi merged commit f8a9b32 into develop Mar 11, 2020
@bilal-alsharifi bilal-alsharifi deleted the add_Overwrite_Property branch March 11, 2020 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants