List of usage examples for org.apache.commons.lang3 StringUtils wrap
public static String wrap(final String str, final String wrapWith)
Wraps a String with another String.
From source file:com.simpligility.maven.plugins.android.phase08preparepackage.DexMojo.java
private File generateMainDexClassesFile() throws MojoExecutionException { CommandExecutor executor = CommandExecutor.Factory.createDefaultCommmandExecutor(); executor.setLogger(getLog());//from w w w. ja v a 2 s . c om List<String> commands = new ArrayList<>(); commands.add("--output"); File mainDexClasses = new File(targetDirectory, "mainDexClasses.txt"); commands.add(mainDexClasses.getAbsolutePath()); Set<File> inputFiles = getDexInputFiles(); StringBuilder sb = new StringBuilder(); sb.append(StringUtils.join(inputFiles, File.pathSeparatorChar)); if (Os.isFamily(Os.FAMILY_WINDOWS)) { commands.add(StringUtils.wrap(sb.toString(), '"')); } else { commands.add(sb.toString()); } String executable = getAndroidSdk().getMainDexClasses().getAbsolutePath(); try { executor.executeCommand(executable, commands, project.getBasedir(), false); } catch (ExecutionException ex) { throw new MojoExecutionException("Failed to execute mainDexClasses", ex); } return mainDexClasses; }
From source file:org.finra.herd.dao.helper.EmrHelperTest.java
@Test public void testGetActiveEmrClusterIdAssertParametersTrimmed() { EmrDao originalEmrDao = emrHelper.getEmrDao(); EmrDao mockEmrDao = mock(EmrDao.class); emrHelper.setEmrDao(mockEmrDao);// w ww . j ava 2 s .co m try { String emrClusterId = "emrClusterId"; String emrClusterName = "emrClusterName"; String expectedEmrClusterId = "expectedEmrClusterId"; when(mockEmrDao.getEmrClusterById(any(), any())).thenReturn(new Cluster().withId(expectedEmrClusterId) .withName(emrClusterName).withStatus(new ClusterStatus().withState(ClusterState.RUNNING))); assertEquals(expectedEmrClusterId, emrHelper.getActiveEmrClusterId(StringUtils.wrap(emrClusterId, BLANK_TEXT), StringUtils.wrap(emrClusterName, BLANK_TEXT), null)); verify(mockEmrDao).getEmrClusterById(eq(emrClusterId.trim()), any()); verifyNoMoreInteractions(mockEmrDao); } finally { emrHelper.setEmrDao(originalEmrDao); } }
From source file:org.finra.herd.service.helper.NamespaceIamRoleAuthorizationHelperTest.java
@Test public void checkPermissionsAssertRoleNameIsTrimmed() { NamespaceEntity expectedNamespaceEntity = new NamespaceEntity(); String iamRoleName1 = "iamRoleName1"; String iamRoleName2 = "iamRoleName2"; Collection<String> requestedIamRoleNames = Arrays.asList(StringUtils.wrap(iamRoleName1, BLANK_TEXT), StringUtils.wrap(iamRoleName2, BLANK_TEXT)); List<NamespaceIamRoleAuthorizationEntity> namespaceIamRoleAuthorizationEntities = new ArrayList<>(); NamespaceIamRoleAuthorizationEntity namespaceIamRoleAuthorizationEntity1 = new NamespaceIamRoleAuthorizationEntity(); namespaceIamRoleAuthorizationEntity1.setIamRoleName(iamRoleName1); namespaceIamRoleAuthorizationEntities.add(namespaceIamRoleAuthorizationEntity1); NamespaceIamRoleAuthorizationEntity namespaceIamRoleAuthorizationEntity2 = new NamespaceIamRoleAuthorizationEntity(); namespaceIamRoleAuthorizationEntity2.setIamRoleName(iamRoleName2); namespaceIamRoleAuthorizationEntities.add(namespaceIamRoleAuthorizationEntity2); when(configurationHelper.getBooleanProperty(any())).thenReturn(true); when(namespaceIamRoleAuthorizationDao.getNamespaceIamRoleAuthorizations(any())) .thenReturn(namespaceIamRoleAuthorizationEntities); namespaceIamRoleAuthorizationHelper.checkPermissions(expectedNamespaceEntity, requestedIamRoleNames); verify(configurationHelper).getBooleanProperty(ConfigurationValue.NAMESPACE_IAM_ROLE_AUTHORIZATION_ENABLED); verify(namespaceIamRoleAuthorizationDao).getNamespaceIamRoleAuthorizations(expectedNamespaceEntity); verifyNoMoreInteractions(configurationHelper, namespaceIamRoleAuthorizationDao); }
From source file:org.talend.designer.maven.utils.ClasspathsJarGenerator.java
private static String wrapWithSlash(String str) { str = StringUtils.strip(str, SLASH); str = StringUtils.wrap(str, SLASH); return str; }