I am setting up a Bitrise on an Android app. I have everything set that is related to the flow, the thing is that I have a custom python builder which requires a parameter. My build-flow is triggered through API, which is working as expected - the only thing missing is passing that parameter to the build script.
What I have currently:
I have added an env-variable; named PARAM
My JSON body, that triggers the build
{
"hook_info":{
"type":"bitrise"
},
"build_params":{
"branch":"master",
"workflow_id":"test_args_script",
"commit_message":"Triggered from postman",
"environments":[
{
"mapped_to":"PARAM",
"value":"123456",
"is_expand":true
}
]
}
}
On the Bitrise flow I have a script step which is actually calling the python script as follows: python builder.py $PARAM
EXPECTATIONS:
My expectations are that the value that will be passed to the script will be the same as the one in the API payload (123456).
If anyone has recently worked on something similar, or if any of you guys can point me out to documentation that will help me to achieve the above I will be really thankful!
I actually found the way. The problem on my end was that I had an env-variable already named the same as the one variable that has been passed from the API. After changing the name to a different one, I was able to get the parameter and pass it to the build script. If anyone needs more info, give me a shout and I can post the payload along with the flow settings.
Related
I've successfully written a go mobile library and used it from an Android Java app.
I've also successfully called a c function from JNI. This one has the JNIEnv pointer.
I'd like to pass the context/JNIEnv from Java to Go.
Here's where it seems to get complicated:
Go Mobile does not seem to use JNIEnv at all.
LoadJNI.java does have a context object and claims to pass it to the Go side. But there it isn't visible.
I've been able to include jni.h using the "C" directive
I can transfer the JNIEnv from JNI/C or store it there as a global variable but that's an ugly kludge.
https://github.com/golang/go/issues/16876 talks about a proposal to do reverse binding but it's unclear what the status is.
https://godoc.org/golang.org/x/mobile/cmd/gobind also talks about it but the following code snippet
import "Java/java/lang/System"
t := System.CurrentTimeMillis()
returns
cannot find package "Java/java/lang/System" in any of:
/usr/local/go/src/Java/java/lang/System (from $GOROOT)
/Users/----/go/src/Java/java/lang/System (from $GOPATH)
In C I solved it with a compiler directive: #cgo CFLAGS: -I...
But I'm not sure how to do it for Java
In short, I'm now stuck and would appreciate help. Ideally, I'd just like to pass the object as a parameter, if possible. However, I'd settle for any reverse binding to call Java from Go.
I hate to answer my own question, but I'd hate someone to go through this as well too. I'll update this answer as I go along.
Basic Setup
Edit build.gradle and add GOPATH and GO to gobind (additions in bold):
gobind {
pkg = ".../reverse/reverse"
GOPATH = "/Users/johndoe/go"
GO = "/usr/local/go/bin"
}
How to develop
Start from the reverse example. Get it to compile and run.
Make one modification and recompile.
Missing gobind
It turns out the installation process neglected to build gobind. Run go install golang.org/x/mobile/cmd/gobind
I'm Stuck
Trying to modify the reverse project to do anything other than what it's already doing is failing. Even stuff like passing an object and calling toString will fail.
More to come...
I’m writing the error/failures of my steps to a file with this function:
def addToErrorFile(errorName)
open('error.txt', 'a') { |f| f.puts"#{errorName}"}
end
This function is located in a lot of places in my test flow.
To make it easier to read it in the end, I would like to add the step name (Then /I go to…) and also the scenario (Scenario: login to..).
Is there a way to copy those into the function?
You could put some code in your before and after scenario hooks that writes to the error log. That should break it up a bit and make it easier to read. Something like this.
Before do |scenario|
your_logging_method(scenario.name)
end
After do |scenario|
your_logging_method(scenario.name)
end
And there is an AfterStep hook too, though I haven't used it.
AfterStep do |step|
another_logging_method(step)
end
You may have to call some methods on the step variable to get it in a useful format.
Here's a link to the cucumber hooks documentatioon - https://github.com/cucumber/cucumber/wiki/Hooks
it wouldn't be better to use ruby (begin rescue ensure ) and put the code in there. You save your test session and you can progress your test to next steps, where you can put line of code to save name of next step to file
I am trying to enable push notifications on my application.
I have the client sample code and now i am trying to get some of the code to implement it on my application. For those of you who have already implemented push notifications on your apps i am sure you are familiar with the class GCMIntentService.
So i am copying this class on my project , i configure the Manifest correctly(or i think i do) but i get errors in the file.
The errors are in expressions like R.string."something"
For example I get errors in :
R.string.gcm_registered
R.string.gcm_message
R.string.gcm_deleted
R.string.gcm_error
R.string.gcm_recoverable_error
R.drawable.ic_stat_gcm
The error is always that gcm cannot be resolved or is not a field.
But what exactly is this expression?! Is it a class or something?
Is it something on the Manifest that I haven't configured correctly?
It are strings, probably in the example app you're using, in /res/values/strings.xml
You put strings in there to have a localized place to put your user visible Strings in, so you have
1. One place to find all your strings, if you ever want to change and/or re-use
2. Easy access to translation by putting translations in per example /res/values-de/strings.xml
Look for that file in whatever example you're using, you'll find some XML defined strings. Copy them into your own project, in the same place.
this may helps you ,define all Reuired String in your strings.xml and save
R.string.gcm_registered
R.string.gcm_message
R.string.gcm_deleted
R.string.gcm_error
I am trying to create unit tests for a REST client that does some API calls. The client works fine in the live application, but I can't get it to run in the test case.
Apparantly, LoaderTestCase.getLoaderResultSynchronously() could be used here (at least according to Android reference, but it will not accept my loader. The code:
public void testGetEventInfo() {
// Init some vars
...
// Create & execute loader
RESTLoader loader = new RESTLoader(getContext(),
RESTLoader.HTTPVerb.GET, action, params, LOADER_GET_NEWS);
getLoaderResultSynchronously(loader);
}
This yields the error getLoaderResultSynchronously(Loader) in the type LoaderTestCase is not applicable for the arguments (RESTLoader).
RESTLoader extends AsyncLoader. Note that I'm using the supportlibrary, maybe the Loader in there is incompatible? The documentation gives no information on this.
I've tried to solve this in several ways, though none seem to work:
Registered a listener to loader. However, the callback never triggers
Using CountdownLatch (also with a listener). Again, no trigger/countdown timeout.
Playing around with the type template (), without success.
Similar solutions on SO, though again failing to reach the listener.
Does anybody know why getLoaderResultSynchronously will not accept the loader? Or another clean way of testing the Loader, including a way to test return data? I can test handling the return data in a separate case, but I would also like to test the actual data.
Sincerely,
Have you taken a look at the source code? You'll find the following import statements:
import android.content.Loader;
import android.content.Loader.OnLoadCompleteListener;
It doesn't look like Android offers a support version for LoaderTestCase. The easiest solution would be to temporarily change to the non-support LoaderManager (that is, have your class make use of the android.content.Loader instead), test your app, and then switch back to the support implementation. You might also consider copying the testing source code into your project, import the support LoaderManager, and execute it directly. I'm not familiar with the test libraries for Loaders but it doesn't seem outwardly obvious that this would cause any major issues.
You can get sources from LoaderTestCase here, create SupportLoaderTestCase class from that sources in your test project and modify all namespaces to support library namespaces (e.g. change android.content.Loader with android.support.v4.content.Loader). Than you can extend your test case from SupportLoaderTestCase (not from LoaderTestCase) and use it without problems
The method you are trying to call (getLoaderResultSynchronously) accepts an object of type android.content.Loader. If your RESTLoader class is not of that EXACT type then you will get this error. I suspect your class directly or indirectly extends android.support.v4.content.Loader, which would explain the error.
I am not aware of a back-port of LoaderTestCase that would support testing of this type of class.
I am using SSL_Connect() and return code is "-1" , with SSL_get_error() i can see that error is SSL_ERROR_WANT_READ.
As per suggestion on one forum, where it suggested to keep calling SSL_connect() until this error goes. With this modification for first call i am getting error WANT_READ and for second call i am getting SSL_ERROR_SSL. After that for all subsequent calls it is SSL_ERROR_SSL only and as per description of this error it looks something went wrong in SSL library.
Can some one who resolved SSL_connect successfully provide some help.
My code is a plain sequence of calling :
1. SSL_library_init()
2. Creating methods(v23) and context using this meth
3. context has not been modified and it plain as created.
4. SSL object is created using this plain ctx and ssl_connect is called on this ssl after calling SSL_set_fd()
Please let me know if i am doing some thing wrong in this sequence or if i am missing something ?
Is it required to load various things to ctx like certificates and verify locations before using it , if yes what are the bare minimum things required.
Thanks in advance for help.
If it wants a read you have to do a read, or block in select() until OP_READ fires if non-blocking, and then call SSL_Connect() again.
If it wants a write you have to do a write, or block in select() until OP_WRITE fires if non-blocking, and then call SSL_Connect() again.
See here.