Skip to content

Added inspection to show warnings from explain queries #18

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 10, 2017

Conversation

Metaur
Copy link
Contributor

@Metaur Metaur commented Jan 10, 2017

No description provided.

@Override
public void setUp() throws Exception {
super.setUp();
this.dsApi = dataSource().neo4j31();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to include neo4j30() data source in tests? Some of my tests are doing multi-neo4j-version tests.

This is not a requirement, more like general question.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, dataSource here is used just to get an instance of data source api, so we could easily generate file name for data source specific cypher file.
We could remove it, but then the file name generation would be done somewhere else.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are wrong. Data source is used not only for generation, but also for Query execution. You need to get actual notification somewhere :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, true. Completely forgot about that, while was writing comment :)

import com.neueda.jetbrains.plugin.graphdb.jetbrains.util.NameUtil;
import com.neueda.jetbrains.plugin.graphdb.test.integration.neo4j.util.base.BaseIntegrationTest;

public class CypherExplainWarningInspectionTest extends BaseIntegrationTest {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are go going to add more inspections in future. Let's extract some of the logic in "BaseInspectionTest"

Logic to extract:

  • Inspection class to enable
  • Configure from existing existing file + check highligting
  • Create data source file + add file to project

myFixture.configureFromExistingVirtualFile(psiFile.getVirtualFile());
myFixture.checkHighlighting();
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be test that check behaviour if we are in data source bound file, but there are no actual data source,

if (fileName.startsWith(GraphConstants.BOUND_DATA_SOURCE_PREFIX)) {
DataSourcesComponent component = statement.getProject().getComponent(DataSourcesComponent.class);

component.getDataSourceContainer()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

streams ftw

return null;
}
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this empty line


@Nullable
@Override
public String loadDescription() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this accidentally added code

Copy link
Contributor

@FylmTM FylmTM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's help ourselves in future with writing tests

@Metaur Metaur force-pushed the explaining_inspection branch from b1a040d to 31b1e30 Compare January 10, 2017 13:58
@FylmTM FylmTM merged commit ec91bd2 into master Jan 10, 2017
@FylmTM FylmTM deleted the explaining_inspection branch January 10, 2017 14:06
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