Cannot search movies in Neo4j Movies sample application - java

On Ubuntu 16.10 I have followed the instruction from:
https://github.com/neo4j-examples/movies-java-spring-data-neo4j-4
But when I go to http://localhost:8080/ and try to search for e.g. Matrix nothing happens, it just looks empty:
I have verified that the neo4j db has been populated with the required data and I also updated user/pass in the .properties file in the maven project.
Any ideas, and is it possible to find a log somewhere?
Pressing F12 in Firefox gives:
Indicating the error in the sources as described in the below answer, did not manage to get the same error info in Chrome when pressing F12 though.

The code in the GitHub project is not properly updated. The MovieRepository.java class has findByTitleContaining method and #param is missing in this method. If you check the index.html file, javascript code is executing /movies/search/findByTitleLike?title=* URL. The quick fix will be add following method in MovieRepository.java and then execute mvn spring-boot:run command again.
Collection<Movie> findByTitleLike(#Param("title") String title);
In order to have proper source and test classes, you should replace findByTitleContaining method with findByTitleLike method in MovieRepository.java class and also fix the MovieRepositoryTest.java class to use the correct method. Delete testFindByTitleContaining method and add following method in MovieRepositoryTest.java class.
#Test
public void testFindByTitleLike() {
String title = "Matrix";
Collection<Movie> result = instance.findByTitleLike("*"+title+"*");
assertNotNull(result);
assertEquals(1, result.size());
}

Related

Buildfire: use buildfire.navigation.navigateTo (pluginData)

I'm trying to write a second menu to the home folder plugin and I want to write a piece of html in the text block (between the carrousel block and the Plugin Instances) so the user can navigate to another plugins.
How can I use the buildfire.navigation.navigateTo (pluginData) function there? How can I write the function using the ?
Where are the pluginData that the function needs?
- pluginId
- instanceId
- folderName
- title
Because when I'm trying to use it (I'm trying the navigateHome(); function to make sure it works), I get an Access Denied error.
Right now I'm trying this:
<a onclick="javascript:buildfire.navigation.navigateHome();">
and it doesn't work.
How can I navigate to another plugins?
Thanks in advance.
Here is the official documentation on Navigation https://github.com/BuildFire/sdk/wiki/How-to-use-Navigation
Fundamentally javascript:buildfire.navigation.navigateHome() should work. Please post the error you receive so we may review it.
Navigating to another plugin can be done with
buildfire.navigation.navigateTo (pluginData)
pluginData {
pluginId: (string) The id of the plugin type you'd like to navigate to.
,instanceId: (string) The the instance of the plugin you'd like to navigate to.
,folderName (string) The folder name of the plugin that you'd like to navigate to.
,title (string) The title that should show up in the title bar once the plugin is loaded.
,queryString (string) Optional. This is a query string that will be passed to the next plugin's window.location.search. example: "name=Larry&age=36&showDetails=true"
}
Ref: https://github.com/BuildFire/sdk/wiki/How-to-use-Navigation#buildfirenavigationnavigateto-plugindata
You also should take a look at Dynamic Data to make sure you have the latest references to the plugin as they may change
Ref: https://github.com/BuildFire/sdk/wiki/How-to-use-the-Datastore-Dynamic-Data
All this being said, I'd like to draw your attention to ActionItems which are currently implemented in your carousel
Ref: https://github.com/BuildFire/sdk/wiki/BuildFire-Action-Items-Component

Appium driver to get app package name programmatically

I am using:
appiumDriver.findElement(By.id("com.XXX.keyword:id/nextButton"));
but sometimes we have debug version, so we have something like "com.XXX.keyword.debug". So I want to get package name before test runs so the tests can be independent on this.
I tried
driver.currentActivity()
but it only returned something like ".MainActivity"
Is there any way to get package name with Appium?
Thanks a lot.
You don't need package name to locate elements. Simply copy paste id without package name . eg in your case use only 'nextButton' instead of 'com.XXX.keyword:id/nextButton'
To get the current package name use following method:
driver.getCurrentPackage();
The following statement you are using will give you Activity Name.
driver.currentActivity();

Simple Location API This method must return a result of type boolean

I have following problem:
I use BB Eclipse plugin as my IDE and recently I have imported new project easing use of location API on BlackBerry Simple Location API.
I don't know why but in SimpleLocationProvider class in line 593 (which is a comment line) I am getting error:
This method must return a result of type boolean
I am confused a little, because this is downloaded example and method before comment returns BlackBerryLocation and method after comment does not return anything. Here is part of a print screen from my Eclipse
Problem was solved by removing all lines containing //#ifdef and //#endif.
Thanks!

Call Java From Javascript (Birt)

I want to call Java object from within javascript in my rptdesign file (which is under a report project), after i put the jar of my class in /Web-Inf/lib directory and the .class in Web-Inf/classes i tried something like this in the open event of the data set:
gsh = new Packages.de.vogella.birt.stocks.daomock.StockDaoMock();
stock = gsh.getStockValues();
de.vogella.birt.stocks.daomock is the name of a package located in a Java Project (ClassPackage) under /src
StockDaoMock is the name of the class.
getStockValues() is the method.
But I get this error:
cannot evaluate the script. data set script method fetch returned null.expected a boolean value.
What is wrong?
I tried to replace all the code in the fetch method by
"system.out.println("essai");
return true;"
and still have this error
"Data Set script method "Fetch" returned null; expected a Boolean value."
Enable logging to see the stack trace. See the wiki.
Make sure the exception is logged (the example just logs the message) :-)
"Quick and Dirty Logging" might also help.
You might also have a classloader issue. See this blog post for classloader options and how to debug bundle discovery by OSGi when using BIRT.
[EDIT] The error message means that you forgot return true; or return false; at the end of the fetch method.
The java runs on the server, and javascripts runs in the browser, so it is obvious you can't call Java from javascript directly.
There is a library called DWR (Direct Web Remoting). It can expose Java method to Javascript methods. When you call the Javascript it makes a AJAX request, then DWRServlet handles it, executes your desired Java method, and returns the method result to the browser.

Grails redirects to wrong address when using app.context?

I'm noticing some odd behavior with redirect when I set my app.context a certain way. I found a bug in the Grails JIRA which describes my problem perfectly, but it was marked as UTR: http://jira.grails.org/browse/GRAILS-7546
Here is my description of the problem:
I'm currently using Grails 2.0M2. I have the following properties defined in my application.properties file:
app.context=/
app.name=foobar
When I call redirect in a controller, redirect is adding the app name onto the uri I provide, which then causes a 404. Here is how I'm doing this:
String partialUrl = createLink(mapping: 'helloworld') // returns `/hello/world`
redirect(uri: partialUrl) // INCORRECTLY redirects to
// `http://mysite.com/foobar/hello/world`
// instead of `http://mysite.com/hello/world`
Assume that I have a URL mapping named helloworld defined in my UrlMappings.groovy file with a path of /hello/world.
So, long story short, if I set the app.context to /, I would NOT expect the app.name to show up in my final redirect URL.
Is this a bug or expected behavior? Any idea on the easiest way I could build up the redirect URL without doing too many manual steps?
I hate to say it, but I cannot reproduce it either. I created a test project with one controller (named Hello), using your code to create an action that does nothing but redirect:
HelloController.groovy
package test1
class HelloController {
def index() {
def model = [:]
model.content = 'content...'
model
}
def redir() {
String partialUrl = createLink(mapping: 'helloworld') // returns `/hello/world`
redirect(uri: partialUrl) // INCORRECTLY redirects to
// `http://mysite.com/foobar/hello/world`
// instead of `http://mysite.com/hello/world`
}
}
I created an index page, index.gsp in the views/hello
index.gsp
<h1>index.gsp</h1>
<html>
<body>
<p>This data is coming from the model:</p>
<p>content: ${content}</p>
</body>
</html>
Setup helloworld in the UrlMappings to map to the index action of the hello controller:
UrlMappings.groovy
class UrlMappings {
static mappings = {
"/helloworld"(controller: "hello", action: "index")
"/$controller/$action?/$id?"{
constraints {
// apply constraints here
}
}
"/"(view:"/index")
"500"(view:'/error')
}
}
And changed the application.properties to have the app.context=/
application.properties
#Grails Metadata file
#Sun Nov 06 14:51:56 EST 2011
app.grails.version=2.0.0.RC1
app.context=/
app.name=test1
app.servlet.version=2.5
app.version=0.1
When I ran the app, I could go to localhost:8080/hello and it would show my simple GSP. I tried localhost:8080/helloworld and also got it as expected per the mapping. Then I tried localhost:8080/hello/redir and I was properly redirected to localhost:8080/helloworld.
However, if you're still facing this issue, I have a few suggestions
1) Try using the new link generator available in 2.0 instead of createLink. It may not do anything different, but worth a try: grailsLinkGenerator.link(mapping: 'helloworld')
2) If it's only on redirects from within controllers, you could just add the http://mysite.com portion yourself to the partialUrl.
3) Last resort, write a Filter attached to afterView that does a regex search and replace on the contents for mysite.com/foobar. Not sure this will catch redirects though, but if anything would, I'd assume this would be it since filters can be applied at broad level.
def yourAction = {
redirect(uri:"helloworld")
}
That doesnt work for you?
It's not a direct anwser to your question but my practice is : I never modify app.context in the grails properties since tomcat override it on production and I don't care which context it uses on my dev.

Categories

Resources