List of usage examples for java.util List containsAll
boolean containsAll(Collection<?> c);
From source file:com.example.snapcacheexample.SelectionFragment.java
private void handleAnnounce() { pendingAnnounce = false;/*from www . j av a 2s .c om*/ Session session = Session.getActiveSession(); if (session == null || !session.isOpened()) { return; } List<String> permissions = session.getPermissions(); if (!permissions.containsAll(PERMISSIONS)) { pendingAnnounce = true; requestPublishPermissions(session); return; } // Show a progress dialog because sometimes the requests can take a while. progressDialog = ProgressDialog.show(getActivity(), "", getActivity().getResources().getString(R.string.progress_dialog_text), true); // Run this in a background thread since some of the populate methods may take // a non-trivial amount of time. AsyncTask<Void, Void, Response> task = new AsyncTask<Void, Void, Response>() { @Override protected Response doInBackground(Void... voids) { EatAction eatAction = GraphObject.Factory.create(EatAction.class); for (BaseListElement element : listElements) { element.populateOGAction(eatAction); } Request request = new Request(Session.getActiveSession(), POST_ACTION_PATH, null, HttpMethod.POST); request.setGraphObject(eatAction); return request.executeAndWait(); } @Override protected void onPostExecute(Response response) { onPostActionResponse(response); } }; task.execute(); }
From source file:de.dhke.projects.cutil.collections.cow.CopyOnWriteMultiMapEntrySetTest.java
/** * Test of toArray method, of class CopyOnWriteMultiMapEntrySet. *///from w w w.jav a2s . co m @Test public void testToArray_null() { List<Map.Entry<String, Collection<String>>> referenceList = new ArrayList<>(); referenceList.add(new DefaultMapEntry<String, Collection<String>>("1", Arrays.asList("a", "A"))); referenceList.add(new DefaultMapEntry<String, Collection<String>>("2", Arrays.asList("b", "B"))); referenceList.add(new DefaultMapEntry<String, Collection<String>>("3", Arrays.asList("c", "C"))); Map.Entry[] resultArray = _entrySet.toArray(new Map.Entry[] {}); assertEquals(3, resultArray.length); assertTrue(referenceList.containsAll(Arrays.asList(resultArray))); }
From source file:org.makersoft.shards.unit.persistence.VerticalShardsTests.java
@Test @Transactional/*from w w w.ja va 2 s.c o m*/ public void testSelect() throws Exception { List<User> maleUsers = Lists.newArrayList(); for (int i = 0; i < 10; i++) { String name = "makersoft-vertical_" + i; String password = "makersoft-vertical_" + i; int age = i; int gender = (i % 2) == 0 ? User.SEX_MALE : User.SEX_FEMALE; User user = this.insertUser(name, password, age, gender); if (gender == User.SEX_MALE) { maleUsers.add(user); } } List<User> users = userMapper.findByGender(User.SEX_MALE); assertTrue("find by gender total size error", users.size() == 5); assertTrue(maleUsers.containsAll(users)); List<Role> allRoles = Lists.newArrayList(); for (int i = 0; i < 10; i++) { String name = "ROLE_" + i; String code = "CODE_" + i; Role role = this.insertRole(name, code); allRoles.add(role); } List<Role> roles = roleMapper.findAll(); assertTrue(allRoles.containsAll(roles)); }
From source file:edu.uci.ics.asterix.optimizer.rules.RemoveUnusedOneToOneEquiJoinRule.java
private void gatherProducingDataScans(Mutable<ILogicalOperator> opRef, List<LogicalVariable> joinUsedVars, List<DataSourceScanOperator> dataScans) { AbstractLogicalOperator op = (AbstractLogicalOperator) opRef.getValue(); if (op.getOperatorTag() != LogicalOperatorTag.DATASOURCESCAN) { for (Mutable<ILogicalOperator> inputOp : op.getInputs()) { gatherProducingDataScans(inputOp, joinUsedVars, dataScans); }//ww w . j av a 2 s . c om return; } DataSourceScanOperator dataScan = (DataSourceScanOperator) op; fillPKVars(dataScan, pkVars); // Check if join uses all PK vars. if (joinUsedVars.containsAll(pkVars)) { dataScans.add(dataScan); } }
From source file:org.makersoft.shards.integration.VerticalShardsTests.java
@Test @Transactional//w w w . j av a 2 s.co m public void testSelect() throws Exception { List<User> maleUsers = Lists.newArrayList(); for (int i = 0; i < 10; i++) { String name = "makersoft-vertical_" + i; String password = "makersoft-vertical_" + i; int age = i; int gender = (i % 2) == 0 ? User.SEX_MALE : User.SEX_FEMALE; User user = this.insertUser(name, password, age, gender); if (gender == User.SEX_MALE) { maleUsers.add(user); } } List<User> users = userMapper.findByGender(User.SEX_MALE); assertTrue("find by gender total size error " + users.size(), users.size() == 5); assertTrue(maleUsers.containsAll(users)); List<Role> allRoles = Lists.newArrayList(); for (int i = 0; i < 10; i++) { String name = "ROLE_" + i; String code = "CODE_" + i; Role role = this.insertRole(name, code); allRoles.add(role); } List<Role> roles = roleMapper.findAll(); assertTrue(allRoles.containsAll(roles)); }
From source file:rhsm.cli.tests.HighAvailabilityTests.java
@Test(description = "verify that a local yum install will not delete the product database when repolist is empty", groups = { "AcceptanceTests", "Tier1Tests", "blockedByBug-806457" }, priority = 16, dependsOnMethods = { "RegisterToHighAvailabilityAccount_Test" }, enabled = true) //@ImplementsNitrateTest(caseId=) public void VerifyLocalYumInstallAndRemoveDoesNotAlterInstalledProducts_Test() throws JSONException { List<InstalledProduct> originalInstalledProducts = clienttasks.getCurrentlyInstalledProducts(); String originalProductIdJSONString = client.runCommandAndWait("cat " + clienttasks.productIdJsonFile) .getStdout();/* w w w.j a v a 2s .c o m*/ // assert that there are no active repos Assert.assertEquals(clienttasks.getYumRepolist("enabled").size(), 0, "Expected number of enabled yum repositories."); // get an rpm to perform a local yum install String localRpmFile = String.format("/tmp/%s.rpm", haPackage1); RemoteFileTasks.runCommandAndAssert(client, String.format("wget -O %s %s", localRpmFile, haPackage1Fetch), new Integer(0)); // do a yum local install and assert SSHCommandResult yumInstallResult = client .runCommandAndWait(String.format("yum -y --quiet --nogpgcheck localinstall %s", localRpmFile)); Assert.assertTrue(clienttasks.isPackageInstalled(haPackage1), "Local install of package '" + haPackage1 + "' completed successfully."); // verify that installed products remains unchanged List<InstalledProduct> currentlyInstalledProducts = clienttasks.getCurrentlyInstalledProducts(); Assert.assertTrue( currentlyInstalledProducts.containsAll(originalInstalledProducts) && originalInstalledProducts.containsAll(currentlyInstalledProducts), "The installed products remains unchanged after a yum local install of package '" + haPackage1 + "'."); // verify that the current product id database was unchanged String currentProductIdJSONString = client.runCommandAndWait("cat " + clienttasks.productIdJsonFile) .getStdout(); Assert.assertEquals(currentProductIdJSONString, originalProductIdJSONString, "The product id to repos JSON database file remains unchanged after a yum local install of package '" + haPackage1 + "'."); // finally remove the locally installed rpm clienttasks.yumRemovePackage(haPackage1); // verify that installed products remains unchanged currentlyInstalledProducts = clienttasks.getCurrentlyInstalledProducts(); Assert.assertTrue( currentlyInstalledProducts.containsAll(originalInstalledProducts) && originalInstalledProducts.containsAll(currentlyInstalledProducts), "The installed products remains unchanged after a yum removal of locally installed package '" + haPackage1 + "'."); // verify that the current product id database was unchanged currentProductIdJSONString = client.runCommandAndWait("cat " + clienttasks.productIdJsonFile).getStdout(); Assert.assertEquals(currentProductIdJSONString, originalProductIdJSONString, "The product id to repos JSON database file remains unchanged after a yum removal of locally installed package '" + haPackage1 + "'."); }
From source file:org.wso2.carbon.event.receiver.core.internal.util.helper.EventReceiverConfigurationHelper.java
private static boolean validateFromPropertyConfiguration(OMElement fromElement, String fromEventAdapterType) { List<String> requiredProperties = new ArrayList<String>(); List<String> propertiesInConfig = new ArrayList<String>(); Iterator toElementPropertyIterator = fromElement.getChildrenWithName( new QName(EventReceiverConstants.ER_CONF_NS, EventReceiverConstants.ER_ELEMENT_PROPERTY)); InputEventAdapterService eventAdapterService = EventReceiverServiceValueHolder .getInputEventAdapterService(); InputEventAdapterSchema adapterSchema = eventAdapterService .getInputEventAdapterSchema(fromEventAdapterType); if (adapterSchema == null) { throw new EventReceiverValidationException( "Event Adapter with type: " + fromEventAdapterType + " does not exist", fromEventAdapterType); }/*ww w .ja v a 2s.c o m*/ List<Property> propertyList = adapterSchema.getPropertyList(); if (propertyList != null) { for (Property property : propertyList) { if (property.isRequired()) { requiredProperties.add(property.getPropertyName()); } } while (toElementPropertyIterator.hasNext()) { OMElement toElementProperty = (OMElement) toElementPropertyIterator.next(); String propertyName = toElementProperty .getAttributeValue(new QName(EventReceiverConstants.ER_ATTR_NAME)); propertiesInConfig.add(propertyName); } if (!propertiesInConfig.containsAll(requiredProperties)) { return false; } } return true; }
From source file:it.unibas.spicy.model.algebra.NestedLoopJoinOperator.java
@SuppressWarnings("unchecked") private boolean stringMatchListsForJoin(List list1, List list2) { if (isEmpty(list1) || isEmpty(list2)) { return false; }// w ww . j av a 2 s. c o m boolean stringMatch = false; //list1 contains the "fromValues" //list2 contains the "toValues" for (Object str1 : list1) { for (Object str2 : list2) { if (str1.toString().toLowerCase().contains(str2.toString().toLowerCase()) || str2.toString().toLowerCase().contains(str1.toString().toLowerCase())) { stringMatch = true; } } } if (list1.containsAll(list2) && list2.containsAll(list1)) { stringMatch = true; } ; // (list1.containsAll(list2) && list2.containsAll(list1)); return stringMatch; }
From source file:org.finra.herd.rest.JobRestControllerTest.java
@Test public void testCreateJob() throws Exception { // Create the namespace entity. namespaceDaoTestHelper.createNamespaceEntity(TEST_ACTIVITI_NAMESPACE_CD); // Create a job definition create request using hard coded test values. JobDefinitionCreateRequest jobDefinitionCreateRequest = jobDefinitionServiceTestHelper .createJobDefinitionCreateRequest(); // Create the job definition. jobDefinitionService.createJobDefinition(jobDefinitionCreateRequest, false); // Create a job create request using hard coded test values. JobCreateRequest jobCreateRequest = jobServiceTestHelper.createJobCreateRequest(TEST_ACTIVITI_NAMESPACE_CD, TEST_ACTIVITI_JOB_NAME);/* ww w .j av a2 s .c om*/ // Create the job. Job resultJob = jobRestController.createJob(jobCreateRequest); // Validate the results. assertNotNull(resultJob); assertNotNull(resultJob.getId()); assertTrue(!resultJob.getId().isEmpty()); assertEquals(TEST_ACTIVITI_NAMESPACE_CD, resultJob.getNamespace()); assertEquals(TEST_ACTIVITI_JOB_NAME, resultJob.getJobName()); assertEquals(jobDefinitionCreateRequest.getParameters().size() + jobCreateRequest.getParameters().size(), resultJob.getParameters().size()); List<String> expectedParameters = new ArrayList<>(); expectedParameters.addAll(parametersToStringList(jobDefinitionCreateRequest.getParameters())); expectedParameters.addAll(parametersToStringList(jobCreateRequest.getParameters())); List<String> resultParameters = parametersToStringList(resultJob.getParameters()); assertTrue(expectedParameters.containsAll(resultParameters)); assertTrue(resultParameters.containsAll(expectedParameters)); }
From source file:com.test.sharksharding.util.sequence.GetMysqlSequenceId2Test.java
/** * ???SequenceId/*from w ww .ja v a 2 s . co m*/ * * @author gaoxianglong */ public @Test void getSequenceId3() { final CountDownLatch count = new CountDownLatch(2); final List<Long> id1 = new ArrayList<Long>(); final List<Long> id2 = new ArrayList<Long>(); final int size = 10000; new Thread() { public void run() { for (int i = 0; i < size; i++) { id1.add(SequenceIDManger.getSequenceId(100, 10, 5000)); } count.countDown(); } }.start(); new Thread() { public void run() { for (int i = 0; i < size; i++) { id2.add(SequenceIDManger.getSequenceId(100, 10, 5000)); } count.countDown(); } }.start(); try { count.await(); Assert.assertFalse(id1.containsAll(id2)); } catch (Exception e) { e.printStackTrace(); } }