I've been trying to fetch files from the Integrity server with java MKS api, using command "si createsandbox" . It went fine connecting to servers and making directories, but won't fetch any files, even with the option "populate". So I tried another command, "si resync", and it won't get me anything either.
Here is my code, simplified:
public void createsandbox(CmdRunner cmdRunner)
String fullDir = "U:/workspace/test/Admin_Project";
String projectName = "/Admin_Project/project.pj";
Command command = new Command(Command.SI, "createsandbox");
command.addOption(new Option("project", projectName));
command.addOption(new Option("Y"));
command.addOption(new Option("cwd", fullDir));
Response reponse = cmdRunner.execute(command);
public void resync(CmdRunner cmdRunner)
String sandbox = "U:/workspace/test/Admin_Project/project.pj";
Command command= new Command(Command.SI, "resync");
command.addOption(new Option("sandbox", sandbox));
command.addOption(new Option("Y"));
Response reponse = cmdRunner.execute(command);
I tried them with command-line, and they worked fine. These are the command-lines I used.
si createsandbox --project "/Admin_Project/project.pj" --cwd "U:/workspace/test/Admin_Project"
si resync --sandbox "U:/workspace/test/Admin_Project/project.pj" --Y
Any thoughts or comments would be very useful for me, thx in advance.
figured it out.
I added a simple code adding another options,
command.addOption(new Option("R"));
which means "Recurse into subsandboxes creation"
Related
I have two questions here. One, I am not able to run my appium tests against the sauce labs driver url specified in my account settings https://xxxxx:xxxxxxx#ondemand.eu-central-1.saucelabs.com:443/wd/hub. I do not get any error too..
But, i am able to run my tests against http://appium.testobject.com/wd/hub url. But i am not sure where to see my test results. If i try https://app.testobject.com, I am not able to login even though i give the correct credentials and am already logged in sauce labs. Please help.
I noticed a few things that could be doing wrong here. First, you are trying to run the tests on the European datacenter and port 443, which is an https connection. See which endpoint you should connect to. Some possible solutions:
Make sure you are using the endpoint for US West (if you are in the US and that is the data center you signed up for)
All your capabilities are up to date
You used your sauce username and access key when connecting to the driver.
It's hard to know what is wrong without capabilities and knowing if you want to connect to a virtual device or a real device, testing an app or browser. Here is an example configuration for an app test on RDC:
#BeforeMethod
public void setup(Method method) throws MalformedURLException {
System.out.println("Sauce iOS Native - BeforeMethod hook");
String username = System.getenv("SAUCE_USERNAME");
String accesskey = System.getenv("SAUCE_ACCESS_KEY");
String sauceUrl;
if (region.equalsIgnoreCase("eu")) {
sauceUrl = "#ondemand.eu-central-1.saucelabs.com:443";
} else {
sauceUrl = "#ondemand.us-west-1.saucelabs.com:443";
}
String SAUCE_REMOTE_URL = "https://" + username + ":" + accesskey + sauceUrl +"/wd/hub";
String appName = "iOS.RealDevice.SauceLabs.Mobile.Sample.app.2.7.1.ipa";
String methodName = method.getName();
URL url = new URL(SAUCE_REMOTE_URL);
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("deviceName", "iPhone 8.*");
capabilities.setCapability("platformName", "iOS");
capabilities.setCapability("automationName", "XCuiTest");
capabilities.setCapability("app", "storage:filename="+appName);
try {
iosDriver.set(new IOSDriver(url, capabilities));
} catch (Exception e) {
System.out.println("*** Problem to create the iOS driver " + e.getMessage());
throw new RuntimeException(e);
}
}
I found out how to view my test results while using http://appium.testobject.com/wd/hub url. Navigate to saucelabs as usual. Then select "legacy rdc" under Sauce Apps in the displayed page. You can view the results in the displayed window.
I'm trying to use the ExchangeService.AutodiscoverUrl() method, but it's not working. It doesn't seem to be getting a URL, resulting in the error "Cannot read property 'AbsoluteUri' of undefined" from ExchangeCredentials.GetUriWithoutSuffix.
Here is my code ('c' is just a json object):
service = new EwsJS.ExchangeService(EwsJS.ExchangeVersion.Exchange2016);
service.Credentials = new EwsJS.ExchangeCredentials(c.UserName, c.Password);
service.AutodiscoverUrl("email#domain.com", RedirectCallback);
// I'm forcing the accepted redirect here.
function RedirectCallback(url) {
return true;
}
Autodiscover in ews-javascript-api needs major re-write to work properly.
Autodiscover is re-written, latest dev build is out with #next tag.
you can now use it when installing npm i ews-javascript-api#next, once stable build is out you can install regular build.
var Service = new ExchangeService(ExchangeVersion.Exchange2010_SP1);
Service.Credentials = new WebCredentials(user, pass);
//Autodiscover
Service.AutodiscoverUrl(user, this.RedirectionUrlValidationCallback);
console.log(Service.Url);
My every attempt to call ManagementClient.Subscriptions.Get() hangs forever.
If I change it to ManagementClient.Subscriptions.GetAsync(), and run it on its own thread, the task stays in WaitingForActivation state forever.
Any suggestions?
Sample Code: (it's the last line that hangs.)
using System;
using Microsoft.Azure;
using Microsoft.WindowsAzure.Management;
using Microsoft.WindowsAzure.Management.Models;
using Microsoft.IdentityModel.Clients.ActiveDirectory;
class Program1
{
static void Main1(string[] args)
{
AuthenticationContext context = new AuthenticationContext(...);
AuthenticationResult authResult = context.AcquireToken(...);
TokenCloudCredentials token = new TokenCloudCredentials(authResult.AccessToken);
ManagementClient client = new ManagementClient(token);
SubscriptionGetResponse subresp = client.Subscriptions.Get();
}
}
Thanks in advance.
Apparently, error recovery is lacking in Subscriptions.Get and friends. My problem was that the URL in context.AcquireToken was wrong. I had "https://management.core.windows.net", but needed "https://management.core.windows.net/" (i.e., the trailing slash made all of the difference.)
I have 2 branches in my depot.
//depot/project/mainline/...
//depot/project/staging/...
I am using an in-house tool that manages the build of the project, and would like to create a build step that automatically promotes all the files from mainline into staging. I have been trying to write it using p4.net API, following the following example. I am able to run powershell commands from the build tool. My plan was to write a c# console application, compile it using the tool, and then execute it as a build step. Unfortunately I am getting nowhere with that example. I am able to create a client, create a branch spec and even sync the files down, but I for the life of me cant figure out how to submit the integrate.
I feel like I am trying to over-engineer a solution thought. This is something that should be easy to do. I am attaching my broken code below. If it dose not make sense, its because I am using trial and error to figure stuff out and didn't make a final pass through it yet. That said, if i don't need to use the p4 api, all the better. The only requirement is that there be no user input required to run the commands. If there is a merge conflict, I want to automatically accept the source.
Thanks
string uri = "server";
string user = "user";
string pass = null;
string ws_client = "Project-Temp-"+ Guid.NewGuid().ToString();
Server server = new Server(new ServerAddress(uri));
Repository rep = new Repository(server);
Connection con = rep.Connection;
con.UserName = user;
con.Client = new Client();
con.Client.Name = ws_client;
con.Client.ViewMap = new ViewMap();
con.Connect(null);
Credential cred = con.Login(pass, null, null);
rep.DeleteClient(con.Client, null);
rep.CreateClient(con.Client);
con.Client.ViewMap.Clear();
con.Client.ViewMap.Add("//depot/project/...", String.Format("//{0}/...", con.Client.Name), MapType.Include);
rep.UpdateClient(con.Client);
var files = con.Client.SyncFiles(new SyncFilesCmdOptions(SyncFilesCmdFlags.None, -1));
ViewMap vm = new ViewMap();
vm.Add(new MapEntry(MapType.Include,new ClientPath("//depot/project/mainline/..."), new ClientPath("//depot/project/staging/...")));
string msg = "Mainline to Staging";
BranchSpec bs = new BranchSpec("Project-Temp", user, DateTime.Now, DateTime.Now, msg, true, vm, null, null);
int change = -1;
IntegrateFilesCmdOptions BranchOptions = new IntegrateFilesCmdOptions(IntegrateFilesCmdFlags.None, change, -1, "Project-Temp", null, null);
rep.CreateBranchSpec(bs);
rep.UpdateClient(con.Client);
var integrated = con.Client.IntegrateFiles(BranchOptions);
con.Client.ResolveFiles(files, new ResolveCmdOptions(ResolveFilesCmdFlags.AutomaticYoursMode, change));
rep.DeleteClient(con.Client, null);
From the command line this is:
p4 integrate //depot/project/mainline/... //depot/project/staging/...
p4 resolve -am
p4 resolve -at
p4 resolve -ay
p4 submit -d "Integrate."
The "resolve -am" automerges all files without conflicts.
The "resolve -at" accepts the source of all remaining files.
On the very off chance there are source files that can't be accepted (e.g. the source revisions have been obliterated, or the source and target actions are incompatible), the "resolve -ay" ignores them.
I'm creating unit tests for our application, and I'm stuck. For testing I have a simple HelloWebServlet that I'm protecting via annotations:
#WebServlet(urlPatterns = {"/hello"})
#ServletSecurity(#HttpConstraint(rolesAllowed = {"user"}))
I'm starting the server the way that's always worked OK (see [1]) and creating users (see [2]) seems to be OK because output from CommandRunner calls to list-file-users and list-file-groups are correct, but I'm getting this error when I try to connect using the username and password:
WARNING: WEB9102: Web Login Failed: com.sun.enterprise.security.auth.login.common.LoginException: Login failed: Unable to locate a login configuration
The calling code uses the Jersey client API:
#Test
public void testPingServletLoggedIn() {
Client client = Client.create();
client.addFilter(new HTTPBasicAuthFilter(GlassFishServerHelper.USERNAME, "xx"));
WebResource webResource = client.resource(GlassFishServerHelper.getBaseUri() + "/hello");
ClientResponse clientResponse = webResource
.accept(MediaType.TEXT_PLAIN)
.get(ClientResponse.class); // #GET
assertEquals(ClientResponse.Status.OK, clientResponse.getClientResponseStatus());
}
(Note: I tried to set javax.enterprise.system.core.security.level=FINE but that call failed with: PlainTextActionReporterFAILURENo configuration found for javax.enterprise.system.core.security . Drat!)
I've tried this against both glassfish-embedded-all-3.1.2.jar (our production version) and glassfish-embedded-all-3.2-b06.jar with the same results. What do you think would solve this? I've struggled and succeeded way too many times with GFE to give up without a fight!
==== [1] server startup (excerpt) ====
public static void startServer() {
GlassFishProperties gfProps = new GlassFishProperties();
gfProps.setPort("http-listener", PORT);
GLASSFISH = GlassFishRuntime.bootstrap().newGlassFish(gfProps);
GLASSFISH.start();
enableDefaultPrincipleToRoleMapping();
createUsersAndGroups();
ScatteredArchive archive = new ScatteredArchive(WEB_APP_NAME, ScatteredArchive.Type.WAR);
File classesDir = new File("out/production/simple-security-servlet-test");
archive.addClassPath(classesDir);
DEPLOYER = GLASSFISH.getDeployer();
APP_NAME = DEPLOYER.deploy(archive.toURI());
private static void enableDefaultPrincipleToRoleMapping() throws GlassFishException {
CommandRunner cr = GLASSFISH.getCommandRunner();
CommandResult result = cr.run("set",
"server-config.security-service.activate-default-principal-to-role-mapping=true");
}
==== [2] user creation (excerpt) ====
private static void createUsersAndGroups() throws GlassFishException {
CommandRunner commandRunner = GLASSFISH.getCommandRunner();
File passwordFile = new File("password-file.txt");
CommandResult result = commandRunner.run("create-file-user",
"--passwordfile", passwordFile.getAbsolutePath(),
"--groups", "user",
USERNAME
);
}
I was getting the same error and have managed to work around it, although my situation is slightly different. I'm starting GF 3.1.2 from the "maven-embedded-glassfish-plugin" maven plugin, but this might work for you as well.
Try setting the following system property:
java.security.auth.login.config=target/test-classes/login.conf
This should point to a copy of the login.conf file. You can find this file in the "config" folder in any Glassfish domain folder.