List of usage examples for java.util List containsAll
boolean containsAll(Collection<?> c);
From source file:org.openecomp.sdc.be.components.impl.ServiceBusinessLogic.java
private Either<Boolean, ResponseFormat> validateAndUpdateTags(User user, Service currentService, Service serviceUpdate, boolean hasBeenCertified, AuditingActionEnum audatingAction) { List<String> tagsUpdated = serviceUpdate.getTags(); List<String> tagsCurrent = currentService.getTags(); if (tagsUpdated == null || tagsUpdated.isEmpty()) { ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.COMPONENT_MISSING_TAGS); componentsUtils.auditComponentAdmin(responseFormat, user, serviceUpdate, "", "", audatingAction, ComponentTypeEnum.SERVICE); return Either.right(responseFormat); }/*www .j a v a2s .c om*/ if (!(tagsCurrent.containsAll(tagsUpdated) && tagsUpdated.containsAll(tagsCurrent))) { Either<Boolean, ResponseFormat> validatResponse = validateTagsListAndRemoveDuplicates(user, serviceUpdate, audatingAction); if (validatResponse.isRight()) { ResponseFormat errorRespons = validatResponse.right().value(); return Either.right(errorRespons); } currentService.setTags(tagsUpdated); } return Either.left(true); }
From source file:org.finra.herd.dao.HerdDaoTest.java
@Test public void testGetStorages() { // Create and persist storage entities. for (StorageKey key : getTestStorageKeys()) { createStorageEntity(key.getStorageName()); }//from w w w . ja v a 2s .com // Retrieve a list of storage keys. List<StorageKey> resultStorageKeys = herdDao.getStorages(); // Validate the returned object. assertNotNull(resultStorageKeys); assertTrue(resultStorageKeys.containsAll(getTestStorageKeys())); }
From source file:org.apache.hadoop.yarn.applications.distributedshell.TestDistributedShell.java
private int verifyContainerLog(int containerNum, List<String> expectedContent, boolean count, String expectedWord) {//from w w w. j av a 2 s . c om File logFolder = new File(yarnCluster.getNodeManager(0).getConfig().get(YarnConfiguration.NM_LOG_DIRS, YarnConfiguration.DEFAULT_NM_LOG_DIRS)); File[] listOfUsersFolder = logFolder.listFiles(); int currentContainerLogFileIndex = -1; int currentUserLogFileIndex = -1; for (int j = listOfUsersFolder.length - 1; j >= 0; j--) { File[] listOfFiles = listOfUsersFolder[j].listFiles(); boolean foundit = false; for (int i = listOfFiles.length - 1; i >= 0; i--) { if (listOfFiles[i].listFiles().length == containerNum + 1) { currentContainerLogFileIndex = i; currentUserLogFileIndex = j; foundit = true; break; } } if (foundit) { break; } } Assert.assertTrue(currentContainerLogFileIndex != -1); File[] containerFiles = listOfUsersFolder[currentUserLogFileIndex].listFiles()[currentContainerLogFileIndex] .listFiles(); int numOfWords = 0; for (int i = 0; i < containerFiles.length; i++) { for (File output : containerFiles[i].listFiles()) { if (output.getName().trim().contains("stdout")) { BufferedReader br = null; List<String> stdOutContent = new ArrayList<String>(); try { String sCurrentLine; br = new BufferedReader(new FileReader(output)); int numOfline = 0; while ((sCurrentLine = br.readLine()) != null) { if (count) { if (sCurrentLine.contains(expectedWord)) { numOfWords++; } } else if (output.getName().trim().equals("stdout")) { if (!Shell.WINDOWS) { Assert.assertEquals("The current is" + sCurrentLine, expectedContent.get(numOfline), sCurrentLine.trim()); numOfline++; } else { stdOutContent.add(sCurrentLine.trim()); } } } /* By executing bat script using cmd /c, * it will output all contents from bat script first * It is hard for us to do check line by line * Simply check whether output from bat file contains * all the expected messages */ if (Shell.WINDOWS && !count && output.getName().trim().equals("stdout")) { Assert.assertTrue(stdOutContent.containsAll(expectedContent)); } } catch (IOException e) { e.printStackTrace(); } finally { try { if (br != null) br.close(); } catch (IOException ex) { ex.printStackTrace(); } } } } } return numOfWords; }
From source file:org.finra.herd.dao.HerdDaoTest.java
@Test public void testGetFileTypes() throws Exception { // Create and persist file type entities. for (FileTypeKey key : getTestFileTypeKeys()) { createFileTypeEntity(key.getFileTypeCode()); }/*from w w w .j av a 2 s . c o m*/ // Retrieve a list of file type keys. List<FileTypeKey> resultFileTypeKeys = herdDao.getFileTypes(); // Validate the returned object. assertNotNull(resultFileTypeKeys); assertTrue(resultFileTypeKeys.containsAll(getTestFileTypeKeys())); }
From source file:org.finra.herd.dao.HerdDaoTest.java
@Test public void testGetNamespaces() { // Create and persist namespace entities. for (NamespaceKey key : getTestNamespaceKeys()) { createNamespaceEntity(key.getNamespaceCode()); }/*from ww w. ja v a 2 s . c om*/ // Retrieve a list of namespace keys. List<NamespaceKey> resultNamespaceKeys = herdDao.getNamespaces(); // Validate the returned object. assertNotNull(resultNamespaceKeys); assertTrue(resultNamespaceKeys.containsAll(getTestNamespaceKeys())); }
From source file:squash.booking.lambdas.core.RuleManagerTest.java
@Test public void testGetRulesReturnsCorrectRules() throws Exception { // ARRANGE/* ww w. jav a2s . c om*/ initialiseRuleManager(); expectOptimisticPersisterToReturnVersionedAttributes(1); // ACT // N.B. The parameter is arbitrary here. List<BookingRule> returnedBookingRules = ruleManager.getRules(true); // Assert lists equal - ignoring order assertTrue("Unexpected booking rules returned by getRules", returnedBookingRules.containsAll(existingBookingRules) && existingBookingRules.containsAll(returnedBookingRules) && (new HashSet<>(returnedBookingRules).size() == returnedBookingRules.size())); }
From source file:org.pentaho.di.core.ConstTest.java
@Test public void testGetConversionFormats() { final List<String> dateFormats = Arrays.asList(Const.getDateFormats()); final List<String> numberFormats = Arrays.asList(Const.getNumberFormats()); final List<String> conversionFormats = Arrays.asList(Const.getConversionFormats()); assertEquals(dateFormats.size() + numberFormats.size(), conversionFormats.size()); assertTrue(conversionFormats.containsAll(dateFormats)); assertTrue(conversionFormats.containsAll(numberFormats)); }
From source file:org.finra.dm.dao.AbstractDaoTest.java
protected void validateS3FileUpload(S3FileTransferRequestParamsDto s3FileTransferRequestParamsDto, List<String> expectedS3Keys) { // Validate the upload. List<StorageFile> actualStorageFiles = s3Dao.listDirectory(s3FileTransferRequestParamsDto); assertTrue(actualStorageFiles.size() == expectedS3Keys.size()); // Build a list of the actual S3 keys. List<String> actualS3Keys = new ArrayList<>(); for (StorageFile storageFile : actualStorageFiles) { actualS3Keys.add(storageFile.getFilePath()); }//ww w . j a v a 2 s . com // Check that all local test files got uploaded. assertTrue(expectedS3Keys.containsAll(actualS3Keys)); assertTrue(actualS3Keys.containsAll(expectedS3Keys)); }
From source file:org.finra.herd.dao.HerdDaoTest.java
@Test public void testGetPartitionKeyGroups() { // Create and persist two partition key group entities. for (PartitionKeyGroupKey partitionKeyGroupKey : getTestPartitionKeyGroupKeys()) { createPartitionKeyGroupEntity(partitionKeyGroupKey.getPartitionKeyGroupName()); }/* w w w .j a va2 s . c om*/ // Get the list of partition key groups. List<PartitionKeyGroupKey> resultPartitionKeyGroupKeys = herdDao.getPartitionKeyGroups(); // Validate the results. assertNotNull(resultPartitionKeyGroupKeys); assertTrue(resultPartitionKeyGroupKeys.containsAll(getTestPartitionKeyGroupKeys())); }
From source file:squash.booking.lambdas.core.RuleManagerTest.java
@Test public void testGetRulesReturnsCorrectRules_HyphenatedNames() throws Exception { // This tests hyphenated players' names are handled correctly. // ARRANGE/*from w ww . ja v a2 s.com*/ initialiseRuleManager(); // Ensure an existing rule has hyphenated palyers names List<BookingRule> existingRules = new ArrayList<>(); existingRules.addAll(existingBookingRules); // Create a booking rule without exclusions BookingRule hyphenatedRule = new BookingRule(existingSaturdayRecurringRuleWithExclusion); hyphenatedRule.getBooking().setName("I.AmHyphen-ated/S.O-am-I"); existingRules.remove(existingSaturdayRecurringRuleWithExclusion); existingRules.add(hyphenatedRule); expectOptimisticPersisterToReturnVersionedAttributes(2, existingRules); // ACT // N.B. The parameter is arbitrary here. List<BookingRule> returnedBookingRules = ruleManager.getRules(true); // Assert lists equal - ignoring order assertTrue("Unexpected booking rules returned by getRules", returnedBookingRules.containsAll(existingRules) && existingRules.containsAll(returnedBookingRules) && (new HashSet<>(returnedBookingRules).size() == returnedBookingRules.size())); }