eliux / megacmd4j Goto Github PK
View Code? Open in Web Editor NEWOpen Source Java library for the mega.co.nz API using the MEGAcmd CLI
Home Page: https://eliux.github.io/MEGAcmd4J
License: MIT License
Open Source Java library for the mega.co.nz API using the MEGAcmd CLI
Home Page: https://eliux.github.io/MEGAcmd4J
License: MIT License
JUnit 5 provides better ways to run tests in Java and it allows some advantages for labeling tests, specify their order and avoid a non deterministic behaviour. Therefore it should be nice to migrate from JUnit4 to this version.
Besides passing, tests should be easier to read and less non-deterministic proof.
Right now, there are too many workarounds for tests to run in a particular order. We could group them in JUnit5 Nested tests and make tests easier to run, maintain and understand.
CI have been running by default in Ubuntu/Debian/Linux. It would be great if it could run in other operative systems like Windows or even Mac, which are supported already by Travis CI.
When calling MegaSession#ls
, files containing a space in their name do not show up
Files with space in their name should show up
Files with space in their name do not show up
touch test123.txt && touch "test 123.txt" && mega-put test\ 123.txt test123.txt /
)mega-ls -la /
)public class Test {
public static void main(String[] args) {
MegaSession session = Mega.init();
session.ls("/").call().forEach(fi -> {
System.out.println(fi.getName());
});
}
}
Ẁhen I try to use the library and use an account that is running low on storage, it crashes with:
Exception in thread "main" io.github.eliux.mega.error.MegaInvalidStateException: Invalid state
at io.github.eliux.mega.MegaUtils.handleResult(MegaUtils.java:84)
at io.github.eliux.mega.cmd.MegaCmdLogin.executeSysCmd(MegaCmdLogin.java:28)
at io.github.eliux.mega.cmd.AbstractMegaCmdRunner.run(AbstractMegaCmdRunner.java:14)
at io.github.eliux.mega.auth.MegaAuthCredentials.login(MegaAuthCredentials.java:43)
at io.github.eliux.mega.Mega.login(Mega.java:33)
at io.github.eliux.mega.Mega.init(Mega.java:28)
It should not crash, even the storage is low
It crashes
It seems to have something to do with the "You are running out of available storage banner" that shows up all the time in mega-cmd:
-----------------------------------------------------------------------------
| You are running out of available storage. |
| You can change your account plan to increase your quota limit. |
| See "help --upgrade" for further details. |
-----------------------------------------------------------------------------
Mega#init
OS: Linux Mint 19.2
Mega-Cmd: MEGAcmd version: 1.4.0.6: code 1040006
I would like to follow a workflow more alike to the Git workflow:
master
and if it gets merged then a release is madeWhenever I run the tests in my local machine (Windows), they keep running but never eventually ends: no response is given. Nonetheless, if you run them again, everything will go smoothly.
It doesnt happen in the tests that runs in Travis CI.
It would be nice to investigate if there is a workaround to solve this.
When the tests are run in Travis CI, a MEGAcmd help command is called before, saying that the server has started:
Initiating server in background. Log: /home/travis/.megaCmd/megacmdserver.log
So for you to reproduce the error more than once, the MEGAcmd server must be stopped before.
Posible workflows to check how to solve this:
People might need and start and a stop command to manage better the MEGAcmdServer that runs as daemon so MEGAcmd client commands can be used:
start
: Starts the MEGAcmdServer. It prevent the lazy initialization when the first command is called.stop
: Stops the MEGAcmdServer.If you reference a folder that uses whitespaces, e.g. <root path>\folder with spaces\my_text_files.txt
, it must be specified between double quotes ("
) or it wont work. Its needed in local source paths and remote dest paths. It can be reproduced with put
command like this:
mega-put -c <root path>\folder with spaces\my_text_files.txt test/folder with spaces
which will fail. Therefore, to make it work, paths should be specified between double quotes, i.e.:
mega-put -c "<root path>\folder with spaces\my_text_files.txt" "test/folder with spaces"
All commands that uses local or remote paths should have this change applied.
ihave this message : is not a valid Download Folder
Please help me
Tests related to the version are failing.
Checkout if the format of the versions has changed or just make the tests with more flexible expectations about the format of the version.
This errors are non deterministic ones.
There is an attribute called io.github.eliux.mega.cmd.AbstractMegaCmdPathHandler#remoteFolderCreatedIfNotPresent
which has the corresponding related functions:
createRemoteIfNotPresent
skipIfRemoteNotPresent
It would be more intuitive if a suffix to remote be added, and instead of folder, path be used, e.g.
remotePathCreatedIfNotPresent
createRemotePathIfNotPresent
skipIfRemotePathNotPresent
isRemotePathCreatedIfNotPresent
I would be nice to handle the dependencies and versioning of the app with gradle and take advantage of Gradle tasks to automate certain things
Allow compilation and testing using Gradle
Right now everything is done with Maven
Create a Gradle configuration that can be capable of generating new versions in Maven Central
Compile and test the project with Gradle. When running CI on master Gradle tasks should be in charge of automating the process of changing the version and publishing it to Maven Central, among other things.
When this project was initiated the MEGAcmd project returned negative values; but at some OS the returned value was translated to positive values. Such issue was reported and it was solved by adding a new command called errorcode.
Due to this issue all tests that expects right now an Exception are using mostly the generic MegaException
instead of an specific one.
MegaException
to a more specific exception in tests.Exception in thread "main" io.github.eliux.mega.error.MegaUnexpectedFailureException: Unexpected failure with code 21
at io.github.eliux.mega.MegaUtils.handleResult(MegaUtils.java:66)
at io.github.eliux.mega.cmd.AbstractMegaCmdRunner.executeSysCmd(AbstractMegaCmdRunner.java:20)
at io.github.eliux.mega.cmd.AbstractMegaCmdRunnerWithParams.run(AbstractMegaCmdRunnerWithParams.java:8)
class MEGA(_file: File) {
private val file: File = _file
fun upload(): String {
val sessionMega: MegaSession = try {
Mega.currentSession()
} catch (e: MegaException) {
Mega.login(MegaAuthCredentials(MAIL, PASSWORD))
}
sessionMega.uploadFile(file.canonicalPath, "test/").run() // ERROR HERE (dir "test" exists)
return sessionMega.export("test/${file.name}").call().publicLink
}
}
Upload doesn't work, creating directories does work.
Using Linux Mint 18, MegaCMD installed.
Thanks in advance ^^
Environment is Android Studio emulator running Android 8.1 (Oreo)
Using maven package com.github.eliux:megacmd4j:1.2.1-alpha
Problem:
As of the time of writing, 1.2.1-alpha does not permit login to MEGA via the "most common way" in the Quick start guide. If this has already been fixed, please update the Maven repo.
Code shown here:
https://pastebin.com/D2qRpQhQ
Stacktrace is:
com.github.eliux.mega.error.MegaLoginException: Error while executing login command in Mega at com.github.eliux.mega.cmd.MegaCmdLogin.executeSysCmd(MegaCmdLogin.java:31) at com.github.eliux.mega.cmd.AbstractMegaCmdRunnerWithParams.run(AbstractMegaCmdRunnerWithParams.java:8) at com.github.eliux.mega.auth.MegaAuthCredentials.login(MegaAuthCredentials.java:24) at com.github.eliux.mega.Mega$$CC.login$$STATIC$$(Unknown Source:28)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.