cannot find symbol sshCloneUrl for cloning repository in bamboo-specs - bamboo

I am working on writing Bamboo Specs for a build plan where i am trying to clone the repository from bitbucket. Here is my Spec code for Java
package tutorial;
import com.atlassian.bamboo.specs.api.BambooSpec;
import com.atlassian.bamboo.specs.api.builders.AtlassianModule;
import com.atlassian.bamboo.specs.api.builders.BambooKey;
import com.atlassian.bamboo.specs.api.builders.BambooOid;
import com.atlassian.bamboo.specs.api.builders.Variable;
import com.atlassian.bamboo.specs.api.builders.applink.ApplicationLink;
import com.atlassian.bamboo.specs.api.builders.permission.PermissionType;
import com.atlassian.bamboo.specs.api.builders.permission.Permissions;
import com.atlassian.bamboo.specs.api.builders.permission.PlanPermissions;
import com.atlassian.bamboo.specs.api.builders.plan.Job;
import com.atlassian.bamboo.specs.api.builders.plan.Plan;
import com.atlassian.bamboo.specs.api.builders.plan.PlanIdentifier;
import com.atlassian.bamboo.specs.api.builders.plan.Stage;
import com.atlassian.bamboo.specs.api.builders.plan.artifact.Artifact;
import com.atlassian.bamboo.specs.api.builders.plan.artifact.ArtifactSubscription;
import com.atlassian.bamboo.specs.api.builders.plan.branches.BranchCleanup;
import com.atlassian.bamboo.specs.api.builders.plan.branches.PlanBranchManagement;
import com.atlassian.bamboo.specs.api.builders.plan.configuration.AllOtherPluginsConfiguration;
import com.atlassian.bamboo.specs.api.builders.plan.configuration.ConcurrentBuilds;
import com.atlassian.bamboo.specs.api.builders.project.Project;
import com.atlassian.bamboo.specs.api.builders.repository.VcsChangeDetection;
import com.atlassian.bamboo.specs.api.builders.task.AnyTask;
import com.atlassian.bamboo.specs.builders.repository.bitbucket.server.BitbucketServerRepository;
import com.atlassian.bamboo.specs.builders.repository.viewer.BitbucketServerRepositoryViewer;
import com.atlassian.bamboo.specs.builders.task.CheckoutItem;
import com.atlassian.bamboo.specs.builders.task.CommandTask;
import com.atlassian.bamboo.specs.builders.task.MsBuildTask;
import com.atlassian.bamboo.specs.builders.task.ScriptTask;
import com.atlassian.bamboo.specs.builders.task.VcsCheckoutTask;
import com.atlassian.bamboo.specs.builders.trigger.BitbucketServerTrigger;
import com.atlassian.bamboo.specs.model.task.ScriptTaskProperties;
import com.atlassian.bamboo.specs.util.BambooServer;
import com.atlassian.bamboo.specs.util.MapBuilder;
import com.atlassian.bamboo.specs.api.builders.deployment.*;
/**
* Plan configuration for Bamboo.
* Learn more on: https://confluence.atlassian.com/display/BAMBOO/Bamboo+Specs
*/
#BambooSpec
public class PlanSpec {
/**
* Run main to publish plan on Bamboo
*/
public static void main(final String[] args) throws Exception {
//By default credentials are read from the '.credentials' file.
BambooServer bambooServer = new BambooServer("http://localhost:8085");
Plan plan = new PlanSpec().createPlan();
Deployment deploy = new PlanSpec().createDeployment();
bambooServer.publish(plan);
bambooServer.publish(deploy);
PlanPermissions planPermission = new PlanSpec().createPlanPermission(plan.getIdentifier());
bambooServer.publish(planPermission);
}
PlanPermissions createPlanPermission(PlanIdentifier planIdentifier) {
Permissions permission = new Permissions()
.groupPermissions("bamboo-admin", PermissionType.ADMIN)
.anonymousUserPermissionView();
return new PlanPermissions(planIdentifier.getProjectKey(), planIdentifier.getPlanKey()).permissions(permission);
}
Project project = new Project().name("Bamboo Specs").key("DRAGON");
Plan createPlan() {
return new Plan(
project,
"Java Specs Plan 2", "JSPTT2")
.description("Plan created from (enter repository url of your plan)")
.planRepositories(new BitbucketServerRepository()
.name("New Pattern Playbook")
.repositoryViewer(new BitbucketServerRepositoryViewer())
.server(new ApplicationLink()
.name("Bitbucket")
.id("bca01bef-a3d8-3da3-9187-91b73d0f1f77"))
.projectKey("ALM")
.repositorySlug("pattern.dotnet")
.sshPublicKey("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC2ETaXXCvEeZqcJWxybcMA91jiskcjrh5PB2UqLNenhiGRdh2kZBUgBMur/JsBYzFF2tNTlWdOXW1oRhSQ38PeUGXVRg3pMR5mxvOO/K/wO1DB6ZqjzRgwLFBJJMqCk58I213Y2pvd7Q9ot/xLludzh3rKmJFHwqOOBJ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A/l1AcaquO\ngpllhs00+YqAmIUZT17xTlP77DCiMfFP71mwOAUUb68zih8bSrf/dBsCgYEA1rE0\nIuM46bLq9ru5deatl6N3RR0uX8qZaIg8S1ur7O3rTgWUvsmvVkSgHHOEPawcuioQ\n4HbLeMIVcA3roxGV9TD+uG0qGtv3G6ZUJ/izdNi5czp1N/XCMtagjWe2G33FscTT\neugQIbSRGOehimPtJsOuPMscAbDroChYwJLQizECgYBjDaiOBKT0mlovTnYaRBFN\n/rKnj0iKefKRdxMYZntG/jZ3+uJoYXfX/JYga3lT8S0PDF2Ny0RME6HPw9Tq9wXH\nL6M9vBCWYGj9q2P0TEIOm7FoCqdMjEYTlIXcQZjgGq+d52yq6DjVckBJfc8jVmUQ\nYi2jAb5XTusHJDZBmz407QKBgQCoCyHU4OeuPKYfJAbhWwKrO37isRmYTvtOz7vp\n/EIQ/JT+h+3KfBDqxGJSgrSSlUITEVQObc2Lotam066J//zRY10tO/0F8wBzOviK\nJOdKYUye/bW8bHdp1Ybrx67Jy+NO5tHlVPkzeKNNzBgsO1Tnz6h020H7rOBxhsMZ\nUJE9MQKBgDqRwfKmnBUcOElwvhQ1iH7aJL8zD5Ugbu0Xd72XUXcli1BcixvGdRyI\nWjnACbAVfPA/mcT8Ztto9uM/ZvH1rsAaqVnjKdxtlPYefuTff5QYUNWeR5C7FlJh\ntEJaTQdg/yXvnKpKCAtp+KJVfLyuRtuPwppR3yIGfpJNMYxUxHRb\n-----END RSA PRIVATE KEY-----\n")
.sshCloneUrl("ssh://git#stash-lab.cdk.com:7999/alm/pattern.dotnet.git")
.remoteAgentCacheEnabled(false)
.changeDetection(new VcsChangeDetection()))
.stages(new Stage("Stage 1")
.jobs(new Job("First Job","JOB1")
.tasks(new ScriptTask()
.inlineBody("echo Hello World")
)));
}
Deployment createDeployment() {
return new Deployment(new PlanIdentifier("DRAGON", "JSPTT"),
"Java Specs Plan Deployment")
.releaseNaming(new ReleaseNaming("release-1")
.autoIncrement(true))
.environments(new Environment("Java Specs environment")
.tasks(new ScriptTask().inlineBody("echo Hello world!")));
}
}
Error:
[ERROR] /Users/kamblea/Documents/REPOS/bamboo-spec/java/bamboospecjava/bamboo-specs/src/main/java/tutorial/PlanSpec.java:[90,25] cannot find symbol
[ERROR] symbol: method sshCloneUrl(java.lang.String)
[ERROR] location: class com.atlassian.bamboo.specs.builders.repository.bitbucket.server.BitbucketServerRepository
[ERROR]
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

I resolved it on my own.
Solution: I am using Bamboo version 6.3.1 and trying to use Bamboo Specs 6.4 version which is only compatible with Bamboo 6.4 and higher version.
So, I refer the older API reference to solve this issue and it worked.

Related

Java Selenium 'Cannot resolve symbol Test' TestNG

I have a problem with TestNG. I cannot run a test.
I am getting this error:
POM.xml has no errors.
Here is the code in test page:
import Pages.SearchPage;
import org.testng.annotations.Test;
import core.Web.AllListeners.*;
public class Search extends Listener {
#Test(groups = "Regression")
public void ticketBookingFunctionality() {
new SearchPage()
.openUrl()
.inputCaption("Comic")
.selectCityByValue()
.inputDateFrom("2020-01-01")
.inputDateTo("2021-07-05")
.clickButtonSearch()
.clickButtonBuy()
.chooseTicket()
.choosePrice()
.pushButtonFindTickets()
.closeLoginPopup();
}
}
Where can be the problem?
You need to add the following testng related jar files within your project.

lucene java11 WARNING?

I have this really simple java Lucene code that works in my friends PC but it makes a lot of errors for me ... we all use Lucene 5.3.1, I think that the problem is my jdk11
package project;
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.IntField;
import org.apache.lucene.document.TextField;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.IndexWriterConfig;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.FSDirectory;
public class Act1 {
public static void main(String[] args) throws
IOException {
Document doc = new Document();
Field titre = new TextField("Titre", "mon A staticestimation technique",Field.Store.YES);
Field ref = new IntField("Year", 2001,Field.Store.YES);
Field auteurs = new TextField("Auteurs","TaewhanKim, Ki-Seok Chung, C. L. Liu",Field.Store.YES);
doc.add(titre);
doc.add(ref);
doc.add(auteurs);
Path p = Paths.get("C:\\Users\\user\\Desktop\\abc");
Directory dir = FSDirectory.open(p);
StandardAnalyzer analyzer = new StandardAnalyzer();
IndexWriterConfig config = new IndexWriterConfig(analyzer);
IndexWriter index = new IndexWriter(dir, config);
index.addDocument(doc);
index.close();
}
}
but it make those errors
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.apache.lucene.store.MMapDirectory$1 (file:/C:/Users/user/Downloads/lucene-5.3.1/core/lucene-core-5.3.1.jar) to method java.nio.DirectByteBuffer.cleaner()
WARNING: Please consider reporting this to the maintainers of org.apache.lucene.store.MMapDirectory$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Exception in thread "main" java.io.IOException: Unable to unmap the mapped buffer: MMapIndexInput(path="C:\Users\user\Desktop\abc\_1_Lucene50_0.doc")
at org.apache.lucene.store.MMapDirectory$2.freeBuffer(MMapDirectory.java:329)
at org.apache.lucene.store.ByteBufferIndexInput.freeBuffer(ByteBufferIndexInput.java:376)
at org.apache.lucene.store.ByteBufferIndexInput.close(ByteBufferIndexInput.java:355)
at org.apache.lucene.codecs.lucene50.Lucene50CompoundFormat.write(Lucene50CompoundFormat.java:92)
at org.apache.lucene.index.IndexWriter.createCompoundFile(IndexWriter.java:4680)
at org.apache.lucene.index.DocumentsWriterPerThread.sealFlushedSegment(DocumentsWriterPerThread.java:492)
at org.apache.lucene.index.DocumentsWriterPerThread.flush(DocumentsWriterPerThread.java:459)
at org.apache.lucene.index.DocumentsWriter.doFlush(DocumentsWriter.java:503)
at org.apache.lucene.index.DocumentsWriter.flushAllThreads(DocumentsWriter.java:615)
at org.apache.lucene.index.IndexWriter.doFlush(IndexWriter.java:3121)
at org.apache.lucene.index.IndexWriter.flush(IndexWriter.java:3096)
at org.apache.lucene.index.IndexWriter.shutdown(IndexWriter.java:1078)
at org.apache.lucene.index.IndexWriter.close(IndexWriter.java:1123)
at projet.Act1.main(Act1.java:31)
Caused by: java.lang.IllegalAccessException: class org.apache.lucene.store.MMapDirectory$2$1 cannot access class jdk.internal.ref.Cleaner (in module java.base) because module java.base does not export jdk.internal.ref to unnamed module #6e8dacdf
at java.base/jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:361)
at java.base/java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:591)
at java.base/java.lang.reflect.Method.invoke(Method.java:558)
at org.apache.lucene.store.MMapDirectory$2$1.run(MMapDirectory.java:322)
at org.apache.lucene.store.MMapDirectory$2$1.run(MMapDirectory.java:314)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at org.apache.lucene.store.MMapDirectory$2.freeBuffer(MMapDirectory.java:314)
... 13 more
please help me to fix this problem ...
and plz if there is anyone who is good in java and Lucene help I'm struggling I have a mini java/Lucene project and because of covid19 we didn't had any course... as you can see I can't even write a simple code

Android Instrumentation Tests Stuck "Running Tests" Forever Android Studio

I use Android Espresso Tests with latest Android Studio 2.1.2 and Tests are running ok but it does not seems like the standalone test app returns back the results to reflect back to Android Studio and it shows Running Tests Forever
I realize this is an old question, but I just ran into this and didn't see any other search results that had the same problem.
In my case, this was caused by the code under test having a stack overflow exception, which it seems that the test runner failed to handle. I was only able to figure it out by looking at the "Android Monitor" and looking in the logcat.
So if you get to the point where AS just sits at "running test" forever, you might want to look in logcat for an exception that the test runner couldn't handle.
You have to try removing testCoverageEnabled option from build.gradle file if it's there.
possible duplicate
Gradle build tool long for android Tests
In case this helps anyone.
In my case, I was setting the idle state wrongly(false instead of true) after doing a background task, so espresso was stuck thinking that was idle.
You can add an exit test class like this and include this in your Test Suite or Executor in the last
import android.os.Looper;
import androidx.test.rule.ActivityTestRule;
import androidx.test.runner.AndroidJUnit4;
import org.junit.FixMethodOrder;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.MethodSorters;
import java.io.IOException;
import static androidx.test.InstrumentationRegistry.getInstrumentation;
#RunWith(AndroidJUnit4.class)
#FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class ExitTests {
#Rule
public ActivityTestRule<MainActivity> myActivityTestRule =
new ActivityTestRule<>(MainActivity.class, false, true);
public void init(){
getInstrumentation().waitForIdleSync();
if(Looper.myLooper() == null)
Looper.prepare();
}
#Test
public void Exit() throws InterruptedException, IOException {
Runtime.getRuntime().exec(new String[] {"am", "force-stop", "com.package.name"});
}
}
Here is the Test Suite
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
#RunWith(Suite.class)
#Suite.SuiteClasses({ABC.class, ExitTests.class})
public class TestExecutionOrder {
}

How to use selenium-server-standalone-2.0rc2 while creating script with RC

package com.html;
import com.thoughtworks.selenium.DefaultSelenium;
import com.thoughtworks.selenium.Selenium;
import junit.framework.TestCase;
public class Html5 extends TestCase{`enter code here`
Selenium selenium1;
public void setUp()
{
selenium1=new DefaultSelenium("localhost",4444,"*firefox","http://live.com");
selenium1.start();
}
}
Error appearing in com.thoughtworks.selenium.DefaultSelenium; and DefaultSelenium("localhost",4444,"*firefox","http://live.com"); line.
Please suggest.
First :
What the enter code here string does there ?
Secondly :
If there is an error in the import com.thoughtworks.selenium.DefaultSelenium; and in the new DefaultSelenium, it's certainly that the jars are not in your classpath
selenium-server-standalone contains the Selenium server classes, but not the client ones, where DefaultSelenium is. You'll have to bring the client jars in your classpath, that is selenium2-java for this version I think
I think you need to give Path to firefox.exe in your Constructor..So
selenium1 = new DefaultSelenium("localhost",4444,"*firefox","http://live.com"); Goes like
selenium1 = new DefaultSelenium("localhost",4444,"*firefox C:\Documents and Settings\Mozilla Firefox\firefox.exe","http://live.com");
Try this once.

Eclipse Juno EE NoClassDefFoundError when using external Jar

I added an external jar in my eclipse dynamic webproject via Folder -> properties -> build path -> Libraries -> add external jar.
The code is working fine on compile time.
package servlet;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.MultipartConfig;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.tika.Tika;
#WebServlet(name="UploadServlet", urlPatterns={"/uploadFile"}) // specify urlPattern for servlet
#MultipartConfig //Specify that this servlet will receive a multipart data
public class UploadServlet extends HttpServlet {
protected void doPost(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException{
Tika tika = new Tika();
res.setContentType("text/html");
PrintWriter writer = res.getWriter();
writer.write(mediaType);
}
}
I added Apache Tika but when I run my application. these exception occured.
root cause
java.lang.NoClassDefFoundError: org/apache/tika/Tika
servlet.UploadServlet.doPost(UploadServlet.java:19)
javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
root cause
java.lang.ClassNotFoundException: org.apache.tika.Tika
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
servlet.UploadServlet.doPost(UploadServlet.java:19)
javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
I am using Apache Tika to determine what file has been upload, I want to use it for validating if a file is an image, or audio file
You forgot to add that jar to the Deployment Assembly page. It's not deployed to the server when you run your application, hence the NoClassDefFoundErrors.