com.google.common.base.Joiner Java Examples
The following examples show how to use
com.google.common.base.Joiner.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SetLimitsCustomizer.java From brooklyn-server with Apache License 2.0 | 6 votes |
@Override public void customize(MachineLocation machine) { if (!(machine instanceof SshMachineLocation)) { throw new IllegalStateException("Machine must be a SshMachineLocation, but got "+machine); } String file = config.get(FILE_NAME); List<String> contents = config.get(CONTENTS); checkArgument(Strings.isNonBlank(config.get(FILE_NAME)), "File must be non-empty"); log.info("SetLimitsCustomizer setting limits on "+machine+" in file "+file+" to: "+Joiner.on("; ").join(contents)); try { List<String> cmds = new ArrayList<>(); for (String content : contents) { cmds.add(sudo(String.format("echo \"%s\" | tee -a %s", content, file))); } exec((SshMachineLocation)machine, true, cmds.toArray(new String[cmds.size()])); } catch (Exception e) { log.info("SetLimitsCustomizer failed to set limits on "+machine+" (rethrowing)", e); throw e; } }
Example #2
Source File: TomcatSqoopRunner.java From incubator-sentry with Apache License 2.0 | 6 votes |
private void configureSentryAuthorization(Map<String, String> properties) { properties.put("org.apache.sqoop.security.authorization.handler", "org.apache.sentry.sqoop.authz.SentryAuthorizationHander"); properties.put("org.apache.sqoop.security.authorization.access_controller", "org.apache.sentry.sqoop.authz.SentryAccessController"); properties.put("org.apache.sqoop.security.authorization.validator", "org.apache.sentry.sqoop.authz.SentryAuthorizationValidator"); properties.put("org.apache.sqoop.security.authorization.server_name", serverName); properties.put("sentry.sqoop.site.url", sentrySite); /** set Sentry related jars into classpath */ List<String> extraClassPath = new LinkedList<String>(); for (String jar : System.getProperty("java.class.path").split(":")) { if ((jar.contains("sentry") || jar.contains("shiro-core") || jar.contains("libthrift")) && jar.endsWith("jar")) { extraClassPath.add(jar); } } properties.put("org.apache.sqoop.classpath.extra",Joiner.on(":").join(extraClassPath)); }
Example #3
Source File: HaxelibClasspathUtils.java From intellij-haxe with Apache License 2.0 | 6 votes |
/** * * @param project * @param dir * @param executable * @param sdk * @return */ @NotNull public static List<String> getProjectDisplayInformation(@NotNull Project project, @NotNull File dir, @NotNull String executable, @NotNull Sdk sdk) { List<String> strings1 = Collections.EMPTY_LIST; if (getInstalledLibraries(sdk).contains(executable)) { ArrayList<String> commandLineArguments = new ArrayList<String>(); commandLineArguments.add(HaxelibCommandUtils.getHaxelibPath(sdk)); commandLineArguments.add("run"); commandLineArguments.add(executable); commandLineArguments.add("display"); commandLineArguments.add("flash"); List<String> strings = HaxelibCommandUtils.getProcessStdout(commandLineArguments, dir, HaxeSdkUtilBase.getSdkData(sdk)); String s = Joiner.on("\n").join(strings); strings1 = getHXMLFileClasspaths(project, s); } return strings1; }
Example #4
Source File: HiveStreamingDataWriter.java From spark-llap with Apache License 2.0 | 6 votes |
@Override public void write(final InternalRow record) throws IOException { String delimitedRow = Joiner.on(",").useForNull("") .join(scala.collection.JavaConversions.seqAsJavaList(record.toSeq(schema))); try { streamingConnection.write(delimitedRow.getBytes(Charset.forName("UTF-8"))); rowsWritten++; if (rowsWritten > 0 && commitAfterNRows > 0 && (rowsWritten % commitAfterNRows == 0)) { LOG.info("Committing transaction after rows: {}", rowsWritten); streamingConnection.commitTransaction(); streamingConnection.beginTransaction(); } } catch (StreamingException e) { throw new IOException(e); } }
Example #5
Source File: FirebaseApp.java From firebase-admin-java with Apache License 2.0 | 6 votes |
/** * Returns the instance identified by the unique name, or throws if it does not exist. * * @param name represents the name of the {@link FirebaseApp} instance. * @return the {@link FirebaseApp} corresponding to the name. * @throws IllegalStateException if the {@link FirebaseApp} was not initialized, either via {@link * #initializeApp(FirebaseOptions, String)} or {@link #getApps()}. */ public static FirebaseApp getInstance(@NonNull String name) { synchronized (appsLock) { FirebaseApp firebaseApp = instances.get(normalize(name)); if (firebaseApp != null) { return firebaseApp; } List<String> availableAppNames = getAllAppNames(); String availableAppNamesMessage; if (availableAppNames.isEmpty()) { availableAppNamesMessage = ""; } else { availableAppNamesMessage = "Available app names: " + Joiner.on(", ").join(availableAppNames); } String errorMessage = String.format( "FirebaseApp with name %s doesn't exist. %s", name, availableAppNamesMessage); throw new IllegalStateException(errorMessage); } }
Example #6
Source File: TestingPrestoServer.java From presto with Apache License 2.0 | 6 votes |
private static void updateConnectorIdAnnouncement(Announcer announcer, CatalogName catalogName, InternalNodeManager nodeManager) { // // This code was copied from PrestoServer, and is a hack that should be removed when the connectorId property is removed // // get existing announcement ServiceAnnouncement announcement = getPrestoAnnouncement(announcer.getServiceAnnouncements()); // update connectorIds property Map<String, String> properties = new LinkedHashMap<>(announcement.getProperties()); String property = nullToEmpty(properties.get("connectorIds")); Set<String> connectorIds = new LinkedHashSet<>(Splitter.on(',').trimResults().omitEmptyStrings().splitToList(property)); connectorIds.add(catalogName.toString()); properties.put("connectorIds", Joiner.on(',').join(connectorIds)); // update announcement announcer.removeServiceAnnouncement(announcement.getId()); announcer.addServiceAnnouncement(serviceAnnouncement(announcement.getType()).addProperties(properties).build()); announcer.forceAnnounce(); nodeManager.refreshNodes(); }
Example #7
Source File: RTInspection.java From react-templates-plugin with MIT License | 6 votes |
@NotNull private HyperlinkLabel createHyperLink() { //JSBundle.message("settings.javascript.root.configurable.name") List<String> path = ContainerUtil.newArrayList("HTML", getDisplayName()); String title = Joiner.on(" / ").join(path); final HyperlinkLabel settingsLink = new HyperlinkLabel(title); settingsLink.addHyperlinkListener(new HyperlinkAdapter() { public void hyperlinkActivated(HyperlinkEvent e) { // DataContext dataContext = DataManager.getInstance().getDataContext(settingsLink); // OptionsEditor optionsEditor = OptionsEditor.KEY.getData(dataContext); // if (optionsEditor == null) { // Project project = CommonDataKeys.PROJECT.getData(dataContext); // if (project != null) { // showSettings(project); // } // return; // } // Configurable configurable = optionsEditor.findConfigurableById(RTInspection.this.getId()); // if (configurable != null) { // optionsEditor.clearSearchAndSelect(configurable); // } } }); return settingsLink; }
Example #8
Source File: AbstractMetricSubject.java From java-monitoring-client-library with Apache License 2.0 | 6 votes |
/** * Asserts that the metric has any (non-default) value for the specified label values. * * @param labels the labels for which the value is being asserted; the number and order of labels * should match the definition of the metric */ public And<S> hasAnyValueForLabels(String... labels) { MetricPoint<T> metricPoint = findMetricPointForLabels(ImmutableList.copyOf(labels)); if (metricPoint == null) { failWithBadResults( "has a value for labels", Joiner.on(':').join(labels), "has labeled values", Lists.transform( Ordering.<MetricPoint<T>>natural().sortedCopy(actual.getTimestampedValues()), metricPointConverter)); } if (hasDefaultValue(metricPoint)) { failWithBadResults( "has a non-default value for labels", Joiner.on(':').join(labels), "has a value of", getMessageRepresentation(metricPoint.value())); } expectedNondefaultLabelTuples.add(ImmutableList.copyOf(labels)); return andChainer(); }
Example #9
Source File: TableMessageStatReporter.java From DBus with Apache License 2.0 | 6 votes |
public void mark(HeartbeatPulse pulse) { // 判断心跳类型是否为checkpoint if (!pulse.getPacket().contains(CHECKPOINT_FLAG)) { return; } String key = Joiner.on(".").join(pulse.getSchemaName(), pulse.getTableName()); logger.debug("mark: {}", key); StatMessage message; if (!statMessageMap.containsKey(key)) { message = new StatMessage(pulse.getDsName(), pulse.getSchemaName(), pulse.getTableName(), STAT_TYPE); statMessageMap.put(key, message); } else { message = statMessageMap.get(key); } HeartBeatPacket packet = HeartBeatPacket.parse(pulse.getPacket()); message.setCheckpointMS(packet.getTime()); message.setTxTimeMS(packet.getTxtime()); message.setLocalMS(System.currentTimeMillis()); message.setLatencyMS(message.getLocalMS() - message.getCheckpointMS()); sender.sendStat(message.toJSONString(), message.getDsName(), message.getSchemaName(), message.getTableName()); message.cleanUp(); }
Example #10
Source File: Type.java From turbine with Apache License 2.0 | 6 votes |
@Override public final String toString() { StringBuilder sb = new StringBuilder(); boolean first = true; for (SimpleClassTy c : classes()) { for (AnnoInfo anno : c.annos()) { sb.append(anno); sb.append(' '); } if (!first) { sb.append('.'); sb.append(c.sym().binaryName().substring(c.sym().binaryName().lastIndexOf('$') + 1)); } else { sb.append(c.sym().binaryName().replace('/', '.').replace('$', '.')); } if (!c.targs().isEmpty()) { sb.append('<'); Joiner.on(',').appendTo(sb, c.targs()); sb.append('>'); } first = false; } return sb.toString(); }
Example #11
Source File: ByteFragmentUtilsTest.java From clickhouse-jdbc with Apache License 2.0 | 6 votes |
@Test(dataProvider = "dateArray") public void testParseArray(Date[] array) throws Exception { final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); String sourceString = "[" + Joiner.on(",").join(Iterables.transform(Arrays.asList(array), new Function<Date, String>() { @Override public String apply(Date s) { return dateFormat.format(s); } })) + "]"; byte[] bytes = sourceString.getBytes(StreamUtils.UTF_8); ByteFragment fragment = new ByteFragment(bytes, 0, bytes.length); Date[] parsedArray = (Date[]) ByteFragmentUtils.parseArray(fragment, Date.class, dateFormat, 1); assertEquals(parsedArray.length, array.length); for (int i = 0; i < parsedArray.length; i++) { assertEquals(parsedArray[i], array[i]); } }
Example #12
Source File: AppleConfiguration.java From bazel with Apache License 2.0 | 6 votes |
@Nullable @Override public String getOutputDirectoryName() { List<String> components = new ArrayList<>(); if (!appleSplitCpu.isEmpty()) { components.add(applePlatformType.toString().toLowerCase()); components.add(appleSplitCpu); if (options.getMinimumOsVersion() != null) { components.add("min" + options.getMinimumOsVersion()); } } if (configurationDistinguisher != ConfigurationDistinguisher.UNKNOWN) { components.add(configurationDistinguisher.getFileSystemName()); } if (components.isEmpty()) { return null; } return Joiner.on('-').join(components); }
Example #13
Source File: SqlFormatter.java From ksql-fork-with-deep-learning-function with Apache License 2.0 | 6 votes |
@Override protected Void visitSampledRelation(SampledRelation node, Integer indent) { process(node.getRelation(), indent); builder.append(" TABLESAMPLE ") .append(node.getType()) .append(" (") .append(node.getSamplePercentage()) .append(')'); if (node.getColumnsToStratifyOn().isPresent()) { builder.append(" STRATIFY ON ") .append(" (") .append(Joiner.on(",").join(node.getColumnsToStratifyOn().get())); builder.append(')'); } return null; }
Example #14
Source File: BlockRecoveryCommand.java From big-c with Apache License 2.0 | 5 votes |
@Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("BlockRecoveryCommand(\n "); Joiner.on("\n ").appendTo(sb, recoveringBlocks); sb.append("\n)"); return sb.toString(); }
Example #15
Source File: CycleFinderTest.java From j2objc with Apache License 2.0 | 5 votes |
private void findCycles(Options options) throws IOException { if (!whitelistEntries.isEmpty()) { File whitelistFile = new File(tempDir, "whitelist"); Files.asCharSink(whitelistFile, Charset.defaultCharset()) .write(Joiner.on("\n").join(whitelistEntries)); options.addWhitelistFile(whitelistFile.getAbsolutePath()); } if (!blacklistEntries.isEmpty()) { File blacklistFile = new File(tempDir, "type_filter"); Files.asCharSink(blacklistFile, Charset.defaultCharset()) .write(Joiner.on("\n").join(blacklistEntries)); options.addBlacklistFile(blacklistFile.getAbsolutePath()); } options.setSourceFiles(inputFiles); options.setClasspath(System.getProperty("java.class.path")); if (printReferenceGraph) { options.setPrintReferenceGraph(); } CycleFinder finder = new CycleFinder(options); finder.constructGraph(); cycles = finder.findCycles(); if (printReferenceGraph) { referenceGraph = finder.getReferenceGraph(); } if (ErrorUtil.errorCount() > 0) { fail("CycleFinder failed with errors:\n" + Joiner.on("\n").join(ErrorUtil.getErrorMessages())); } }
Example #16
Source File: PreValidator.java From java-n-IDE-for-Android with Apache License 2.0 | 5 votes |
/** * Checks that an element which is supposed to have a key does have one. * @param mergingReport report to log warnings and errors. * @param xmlElement xml element to check for key presence. * @return true if the element has a valid key or false it does not need one or it is invalid. */ private static boolean checkKeyPresence( MergingReport.Builder mergingReport, XmlElement xmlElement) { ManifestModel.NodeKeyResolver nodeKeyResolver = xmlElement.getType().getNodeKeyResolver(); ImmutableList<String> keyAttributesNames = nodeKeyResolver.getKeyAttributesNames(); if (keyAttributesNames.isEmpty()) { return false; } if (Strings.isNullOrEmpty(xmlElement.getKey())) { // we should have a key but we don't. String message = keyAttributesNames.size() > 1 ? String.format( "Missing one of the key attributes '%1$s' on element %2$s at %3$s", Joiner.on(',').join(keyAttributesNames), xmlElement.getId(), xmlElement.printPosition()) : String.format( "Missing '%1$s' key attribute on element %2$s at %3$s", keyAttributesNames.get(0), xmlElement.getId(), xmlElement.printPosition()); xmlElement.addMessage(mergingReport, ERROR, message); return false; } return true; }
Example #17
Source File: KubernetesAccountTest.java From halyard with Apache License 2.0 | 5 votes |
@Test void testLastOAuthServiceAccountIsKept_lowercaseA() { Yaml yamlParser = new Yaml(); Object parsedYaml = yamlParser.load( Joiner.on('\n') .join( "oAuthServiceAccount: \"uppercase-a\"", // "oauthServiceAccount: \"lowercase-a\"")); KubernetesAccount account = new StrictObjectMapper().convertValue(parsedYaml, KubernetesAccount.class); assertThat(account.getOAuthServiceAccount()).isEqualTo("lowercase-a"); }
Example #18
Source File: TestVarArgsToArrayAdapterGenerator.java From presto with Apache License 2.0 | 5 votes |
@Test public void testArrayElements() { assertFunction("var_args_sum()", INTEGER, 0); assertFunction("var_args_sum(1)", INTEGER, 1); assertFunction("var_args_sum(1, 2)", INTEGER, 3); assertFunction("var_args_sum(null)", INTEGER, null); assertFunction("var_args_sum(1, null, 2, null, 3)", INTEGER, null); assertFunction("var_args_sum(1, 2, 3)", INTEGER, 6); // var_args_sum(1, 2, 3, ..., k) int k = 100; int expectedSum = (1 + k) * k / 2; assertFunction(format("var_args_sum(%s)", Joiner.on(",").join(IntStream.rangeClosed(1, k).boxed().collect(toSet()))), INTEGER, expectedSum); }
Example #19
Source File: CppCompileActionTemplate.java From bazel with Apache License 2.0 | 5 votes |
private CppCompileAction createAction( Artifact sourceTreeFileArtifact, Artifact outputTreeFileArtifact, @Nullable Artifact dotdFileArtifact, ImmutableList<Artifact> privateHeaders) throws ActionTemplateExpansionException { CppCompileActionBuilder builder = new CppCompileActionBuilder(cppCompileActionBuilder); builder.setAdditionalPrunableHeaders(privateHeaders); builder.setSourceFile(sourceTreeFileArtifact); builder.setOutputs(outputTreeFileArtifact, dotdFileArtifact); CcToolchainVariables.Builder buildVariables = CcToolchainVariables.builder(cppCompileActionBuilder.getVariables()); buildVariables.overrideStringVariable( CompileBuildVariables.SOURCE_FILE.getVariableName(), sourceTreeFileArtifact.getExecPathString()); buildVariables.overrideStringVariable( CompileBuildVariables.OUTPUT_FILE.getVariableName(), outputTreeFileArtifact.getExecPathString()); if (dotdFileArtifact != null) { buildVariables.overrideStringVariable( CompileBuildVariables.DEPENDENCY_FILE.getVariableName(), dotdFileArtifact.getExecPathString()); } builder.setVariables(buildVariables.build()); List<String> errors = new ArrayList<>(); CppCompileAction result = builder.buildAndVerify((String errorMessage) -> errors.add(errorMessage)); if (!errors.isEmpty()) { throw new ActionTemplateExpansionException(Joiner.on(".\n").join(errors)); } return result; }
Example #20
Source File: ElasticTestActions.java From dremio-oss with Apache License 2.0 | 5 votes |
public CreateAliases addAlias(String[] indices, String alias) { List<String> quotedIndices = new ArrayList<>(); for (String index : indices) { quotedIndices.add(String.format("\"%s\"", index)); } aliases.add(String.format("{ \"add\": {\"indices\" : [%s], \"alias\": \"%s\" } }", Joiner.on(",").join(quotedIndices), alias)); return this; }
Example #21
Source File: AndroidDataBuilder.java From bazel with Apache License 2.0 | 5 votes |
@Override public String create(String... lines) { return String.format( "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + "<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"" + " android:layout_width=\"fill_parent\"" + " android:layout_height=\"fill_parent\">%s</LinearLayout>", Joiner.on("\n").join(lines)); }
Example #22
Source File: PaperParcelProcessorTest.java From paperparcel with Apache License 2.0 | 5 votes |
@Test public void failIfGenericFieldTypeIsRaw() { JavaFileObject source = JavaFileObjects.forSourceString("test.Test", Joiner.on('\n').join( "package test;", "import paperparcel.PaperParcel;", "import android.os.Parcel;", "import android.os.Parcelable;", "import java.util.List;", "@PaperParcel", "public final class Test implements Parcelable {", " private final List child;", " public Test(List child) {", " this.child = child;", " }", " public List getChild() {", " return this.child;", " }", " public int describeContents() {", " return 0;", " }", " public void writeToParcel(Parcel dest, int flags) {", " }", "}" )); assertAbout(javaSource()).that(source) .processedWith(new PaperParcelProcessor()) .failsToCompile() .withErrorContaining(ErrorMessages.FIELD_MISSING_TYPE_ARGUMENTS) .in(source) .onLine(8); }
Example #23
Source File: JavaBinaryIntegrationTest.java From buck with Apache License 2.0 | 5 votes |
@Test public void fatJarWithVmArguments() throws IOException, InterruptedException { setUpProjectWorkspaceForScenario("fat_jar"); ImmutableList<String> args = ImmutableList.of("-ea", "-Dfoo.bar.baz=1234", "-Xms64m"); String expected = Joiner.on("\n").join(args); Path jar = workspace.buildAndReturnOutput("//:bin-jvm-args"); ProcessExecutor.Result result = workspace.runJar(jar, args); assertEquals(expected, result.getStdout().get().trim()); }
Example #24
Source File: SnippetTest.java From api-compiler with Apache License 2.0 | 5 votes |
private void evalWithError(String snippet, Object... args) { if (snippets == null) { // Error reported return; } testOutput().printf("---- eval %s(%s) ==>%n", snippet, Joiner.on(",").join(args)); try { testOutput().println(snippets.eval(snippet, args).prettyPrint()); testOutput().println("Unexpected success!"); } catch (EvalException e) { testOutput().println("Found expected error: " + e.getMessage()); } testOutput().println("---- end"); }
Example #25
Source File: LoginRestController.java From metasfresh-webui-api-legacy with GNU General Public License v3.0 | 5 votes |
private Set<JSONLoginRole> createJSONLoginRoles(final Login loginService, final Set<KeyNamePair> availableRoles) { if (availableRoles.isEmpty()) { return ImmutableSet.of(); } final LoginContext ctx = loginService.getCtx(); final ImmutableSet.Builder<JSONLoginRole> jsonRoles = ImmutableSet.builder(); for (final KeyNamePair role : availableRoles) { final RoleId roleId = RoleId.ofRepoId(role.getKey()); final UserId userId = ctx.getUserId(); for (final KeyNamePair tenant : loginService.getAvailableClients(roleId, userId)) { final ClientId clientId = ClientId.ofRepoId(tenant.getKey()); final Set<KeyNamePair> availableOrgs = loginService.getAvailableOrgs(roleId, userId, clientId); for (final KeyNamePair org : availableOrgs) { // If there is more than one available Org, then skip the "*" org final OrgId orgId = OrgId.ofRepoIdOrAny(org.getKey()); if (availableOrgs.size() > 1 && orgId.isAny()) { continue; } final String caption = Joiner.on(", ").join(role.getName(), tenant.getName(), org.getName()); final JSONLoginRole jsonRole = JSONLoginRole.of(caption, roleId.getRepoId(), clientId.getRepoId(), orgId.getRepoId()); jsonRoles.add(jsonRole); } } } return jsonRoles.build(); }
Example #26
Source File: TreeBackedTypesTest.java From buck with Apache License 2.0 | 5 votes |
@Test public void testIsNotSameTypeIntersectionTypeDifferentSizeReversed() throws IOException { compile( Joiner.on('\n') .join( "class Foo<T extends java.lang.CharSequence & java.lang.Runnable & java.io.Closeable> { }", "class Bar<T extends java.lang.CharSequence & java.lang.Runnable> { }")); IntersectionType fooType = (IntersectionType) getTypeParameterUpperBound("Foo", 0); IntersectionType barType = (IntersectionType) getTypeParameterUpperBound("Bar", 0); assertNotSameType(fooType, barType); }
Example #27
Source File: UIfTest.java From Refaster with Apache License 2.0 | 5 votes |
@Test public void inlineWithoutElse() { UIf ifTree = UIf.create( UFreeIdent.create("cond"), UBlock.create(UExpressionStatement.create( UAssign.create(UFreeIdent.create("x"), UFreeIdent.create("y")))), null); bind(new UFreeIdent.Key("cond"), parseExpression("true")); bind(new UFreeIdent.Key("x"), parseExpression("x")); bind(new UFreeIdent.Key("y"), parseExpression("\"foo\"")); assertInlines(Joiner.on('\n').join( "if (true) {", " x = \"foo\";", "}"), ifTree); }
Example #28
Source File: MarkdownTableExtensionTest.java From js-dossier with Apache License 2.0 | 5 votes |
@Test public void singleColumnRequiresAtLeastOnePipe() { String html = Joiner.on('\n') .join( "<table>", "<thead>", "<tr><th>A</th></tr>", "</thead>", "<tbody></tbody>", "</table>"); assertHtml("|A\n-", "<h2>|A</h2>"); assertHtml("A\n-|", "<p>A\n-|</p>"); assertHtml("|A\n|-", html); assertHtml("A|\n|-", html); assertHtml("|A|\n|-", html); assertHtml("|A\n|-", html); assertHtml("|A\n-|", html); assertHtml("|A\n|-|", html); assertHtml("|A|\n|-", html); assertHtml("|A|\n-|", html); assertHtml("|A|\n|-|", html); }
Example #29
Source File: HgCmdLineInterfaceIntegrationTest.java From buck with Apache License 2.0 | 5 votes |
private static void run(Path directory, String... args) throws IOException, InterruptedException { Process proc = new ProcessBuilder().command(args).directory(directory.toFile()).start(); proc.waitFor(); assertEquals( String.format( "Could not run %s, got result %s", Joiner.on(" ").join(args), proc.exitValue()), 0, proc.exitValue()); }
Example #30
Source File: BeforeAfterState.java From passopolis-server with GNU General Public License v3.0 | 5 votes |
private void addUserDataToSet(Set<Integer> userIds, Multimap<Integer, Integer> userToSecret) throws SQLException { if (userIds.isEmpty()) return; String getAccessibleSecrets = "SELECT identity.id, group_secret.\"serverVisibleSecret_id\" " + " FROM group_secret " + " JOIN acl ON (acl.group_id = group_secret.group_id) " + " JOIN identity ON (identity.id = acl.member_identity) " + " WHERE identity.id IN (" + Joiner.on(',').join(userIds) + ')'; List<String[]> secretsResults = Lists.newArrayList(manager.identityDao.queryRaw(getAccessibleSecrets)); for (String[] cols : secretsResults) { int userId = Integer.parseInt(cols[0], 10); int secretId = Integer.parseInt(cols[1], 10); userToSecret.put(userId, secretId); } }