This repository has been archived by the owner on Feb 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Added negative project import tests #64
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
62c7df2
Added negative project import tests
IgorYasko121 524771b
Changed gitignore file for Bazel build result
IgorYasko121 c743746
Changed test project for build with subpackage test case
IgorYasko121 ead1ac9
Changed tests structure
IgorYasko121 26b49b1
Changed structure of test projects
IgorYasko121 e77ff0e
Changed module names test project build-with-subpackage
IgorYasko121 2d5997e
Changed structure BuildWithSubPackageBazelImportTest
IgorYasko121 d9e7656
Changed B2EPreferncesManager
IgorYasko121 049cd8c
Changed structure tests
IgorYasko121 bf9d8a0
MapFlattener replaced with getOrDefault native map method
IgorYasko121 fd21200
Got back to MapFlattener
IgorYasko121 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
13 changes: 13 additions & 0 deletions
13
com.salesforce.b2eclipse.tests/projects/build-with-class/module1/java/src/example/BUILD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
load("@rules_java//java:defs.bzl", "java_binary") | ||
|
||
java_binary( | ||
name = "ProjectRunner", | ||
srcs = glob(["*.java"]), | ||
main_class = "com.example.ProjectRunner", | ||
deps = [":greeter"], | ||
) | ||
|
||
java_library( | ||
name = "greeter", | ||
srcs = ["Greeting.java"], | ||
) |
7 changes: 7 additions & 0 deletions
7
...lesforce.b2eclipse.tests/projects/build-with-class/module1/java/src/example/Greeting.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.example; | ||
|
||
public class Greeting { | ||
public static void sayHi() { | ||
System.out.println("Hi!"); | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
...rce.b2eclipse.tests/projects/build-with-class/module1/java/src/example/ProjectRunner.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.example; | ||
|
||
public class ProjectRunner { | ||
public static void main(String args[]) { | ||
Greeting.sayHi(); | ||
} | ||
} |
Empty file.
8 changes: 8 additions & 0 deletions
8
com.salesforce.b2eclipse.tests/projects/build-with-subpackage/module/BUILD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
load("@rules_java//java:defs.bzl", "java_binary") | ||
|
||
java_binary( | ||
name = "ProjectRunner", | ||
srcs = glob(["java/src/example/ProjectRunner.java"]), | ||
main_class = "example.ProjectRunner", | ||
deps = ["//module/submodule:greeter"], | ||
) |
9 changes: 9 additions & 0 deletions
9
...b2eclipse.tests/projects/build-with-subpackage/module/java/src/example/ProjectRunner.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package example; | ||
|
||
import greeting.SayHi; | ||
|
||
public class ProjectRunner { | ||
public static void main(String args[]) { | ||
SayHi.sayHi(); | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
com.salesforce.b2eclipse.tests/projects/build-with-subpackage/module/submodule/BUILD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
load("@rules_java//java:defs.bzl", "java_library") | ||
|
||
java_library( | ||
name = "greeter", | ||
srcs = glob(["java/src/greeting/SayHi.java"]), | ||
visibility = ["//visibility:public"], | ||
) |
7 changes: 7 additions & 0 deletions
7
...clipse.tests/projects/build-with-subpackage/module/submodule/java/src/greeting/SayHi.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package greeting; | ||
|
||
public class SayHi { | ||
public static void sayHi() { | ||
System.out.println("Hi!"); | ||
} | ||
} |
Empty file.
Empty file.
13 changes: 13 additions & 0 deletions
13
com.salesforce.b2eclipse.tests/projects/build-with-workspace/module1/BUILD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
load("@rules_java//java:defs.bzl", "java_binary") | ||
|
||
java_binary( | ||
name = "ProjectRunner", | ||
srcs = glob(["src/main/java/com/example/ProjectRunner.java"]), | ||
main_class = "com.example.ProjectRunner", | ||
deps = [":greeter"], | ||
) | ||
|
||
java_library( | ||
name = "greeter", | ||
srcs = ["src/main/java/com/example/Greeting.java"], | ||
) |
7 changes: 7 additions & 0 deletions
7
...orce.b2eclipse.tests/projects/build-with-workspace/module1/java/src/example/Greeting.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.example; | ||
|
||
public class Greeting { | ||
public static void sayHi() { | ||
System.out.println("Hi!"); | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
...b2eclipse.tests/projects/build-with-workspace/module1/java/src/example/ProjectRunner.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.example; | ||
|
||
public class ProjectRunner { | ||
public static void main(String args[]) { | ||
Greeting.sayHi(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
...orce.b2eclipse.tests/src/main/java/com/salesforce/b2eclipse/importer/BazelImportTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/** | ||
* Copyright (c) 2020, Salesforce.com, Inc. All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the | ||
* following conditions are met: | ||
* | ||
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following | ||
* disclaimer. | ||
* | ||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the | ||
* following disclaimer in the documentation and/or other materials provided with the distribution. | ||
* | ||
* 3. Neither the name of Salesforce.com nor the names of its contributors may be used to endorse or promote products | ||
* derived from this software without specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, | ||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | ||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
* | ||
*/ | ||
|
||
package com.salesforce.b2eclipse.importer; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertTrue; | ||
|
||
import java.util.Arrays; | ||
|
||
import org.eclipse.core.resources.IProject; | ||
|
||
import org.eclipse.core.runtime.CoreException; | ||
|
||
import org.junit.Before; | ||
import org.junit.Test; | ||
|
||
/** | ||
* Test class for importing a general Bazel test project. | ||
*/ | ||
public class BazelImportTest extends BaseBazelImproterTest { | ||
|
||
public BazelImportTest() { | ||
super.setWorkspaceRootPackage(getScanner().getProjects("projects/bazel-ls-demo-project")); | ||
} | ||
|
||
@Before | ||
public void setup() { | ||
setSettings(BAZEL_SRC_PATH_VALUE); | ||
importProject(); | ||
} | ||
|
||
@Test | ||
public void testImport() throws CoreException { | ||
IProject module1Proj = getWorkspaceRoot().getProject("module1"); | ||
IProject module2Proj = getWorkspaceRoot().getProject("module2"); | ||
IProject module3Proj = getWorkspaceRoot().getProject("module3"); | ||
|
||
IProject[] referencedProjects = module1Proj.getReferencedProjects(); | ||
|
||
assertEquals(2, referencedProjects.length); | ||
|
||
assertTrue("Didn't find module2 in the referenced projects list", | ||
Arrays.stream(referencedProjects).anyMatch(proj -> proj.equals(module2Proj))); | ||
|
||
assertTrue("Didn't find module3 in the referenced projects list", | ||
Arrays.stream(referencedProjects).anyMatch(proj -> proj.equals(module3Proj))); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo BaseBazelImpROterTest