Example usage for java.util ArrayList containsAll

List of usage examples for java.util ArrayList containsAll

Introduction

In this page you can find the example usage for java.util ArrayList containsAll.

Prototype

boolean containsAll(Collection<?> c);

Source Link

Document

Returns true if this list contains all of the elements of the specified collection.

Usage

From source file:com.microsoft.windowsazure.management.ManagementIntegrationTestBase.java

protected static void getLocation() throws Exception {
    ArrayList<String> serviceName = new ArrayList<String>();
    serviceName.add(LocationAvailableServiceNames.STORAGE);

    LocationsListResponse locationsListResponse = managementClient.getLocationsOperations().list();
    for (LocationsListResponse.Location location : locationsListResponse) {
        ArrayList<String> availableServicelist = location.getAvailableServices();
        String locationName = location.getName();
        if (availableServicelist.containsAll(serviceName) == true) {
            if (locationName.contains("West US") == true) {
                smLocation = locationName;
            }//w  w w  .ja  va 2 s. c  om
            if (smLocation == null) {
                smLocation = locationName;
            }
        }
    }
}

From source file:com.microsoft.windowsazure.management.storage.StorageManagementIntegrationTestBase.java

protected static void getLocation() throws Exception {
    ArrayList<String> serviceName = new ArrayList<String>();
    serviceName.add(LocationAvailableServiceNames.STORAGE);

    LocationsListResponse locationsListResponse = managementClient.getLocationsOperations().list();
    for (LocationsListResponse.Location location : locationsListResponse) {
        ArrayList<String> availableServicelist = location.getAvailableServices();
        String locationName = location.getName();
        if (availableServicelist.containsAll(serviceName) == true) {
            if (locationName.contains("West US") == true) {
                storageLocation = locationName;
            }/*from  www.jav a2  s .  c  o  m*/
            if (storageLocation == null) {
                storageLocation = locationName;
            }
        }
    }
}

From source file:com.microsoft.windowsazure.management.scheduler.SchedulerIntegrationTestBase.java

protected static void getLocation() throws Exception {
    ArrayList<String> serviceName = new ArrayList<String>();
    serviceName.add(LocationAvailableServiceNames.STORAGE);

    LocationsListResponse locationsListResponse = managementClient.getLocationsOperations().list();
    for (LocationsListResponse.Location location : locationsListResponse) {
        ArrayList<String> availableServicelist = location.getAvailableServices();
        String locationName = location.getName();
        if (availableServicelist.containsAll(serviceName) == true) {
            if (locationName.contains("West US") == true) {
                hostedLocation = locationName;
            }//w w  w  .  ja  v  a2s  . c  om
            if (hostedLocation == null) {
                hostedLocation = locationName;
            }
        }
    }
}

From source file:com.microsoft.windowsazure.management.mediaservices.MediaServiceManagementIntegrationTestBase.java

protected static void getLocation() throws Exception {
    ArrayList<String> serviceName = new ArrayList<String>();
    serviceName.add(LocationAvailableServiceNames.HIGHMEMORY);

    LocationsListResponse locationsListResponse = managementClient.getLocationsOperations().list();
    for (LocationsListResponse.Location location : locationsListResponse) {
        ArrayList<String> availableServicelist = location.getAvailableServices();
        String locationName = location.getName();
        if (availableServicelist.containsAll(serviceName) == true) {
            if (locationName.contains("West US") == true) {
                storageLocation = locationName;
            }//from  w  ww .ja  v a  2  s.co m
            if (storageLocation == null) {
                storageLocation = locationName;
            }
        }
    }
}

From source file:com.microsoft.windowsazure.management.sql.SqlManagementIntegrationTestBase.java

protected static void getLocation() throws Exception {
    ArrayList<String> serviceName = new ArrayList<String>();
    serviceName.add(LocationAvailableServiceNames.STORAGE);

    LocationsListResponse locationsListResponse = managementClient.getLocationsOperations().list();
    for (LocationsListResponse.Location location : locationsListResponse) {
        ArrayList<String> availableServicelist = location.getAvailableServices();
        String locationName = location.getName();
        if (availableServicelist.containsAll(serviceName) == true) {
            if (locationName.contains("West US") == true) {
                testLocationValue = locationName;
            }/*from  w ww .  ja v  a 2 s  . c o  m*/
            if (testLocationValue == null) {
                testLocationValue = locationName;
            }
        }
    }
}

From source file:com.microsoft.windowsazure.management.compute.ComputeManagementIntegrationTestBase.java

protected static void getLocation() throws Exception {
    //has to be a location that support compute, storage, vm, some of the locations are not, need to find out the right one
    ArrayList<String> serviceName = new ArrayList<String>();
    serviceName.add(LocationAvailableServiceNames.COMPUTE);
    serviceName.add(LocationAvailableServiceNames.PERSISTENTVMROLE);
    serviceName.add(LocationAvailableServiceNames.STORAGE);

    LocationsListResponse locationsListResponse = managementClient.getLocationsOperations().list();
    for (LocationsListResponse.Location location : locationsListResponse) {
        ArrayList<String> availableServicelist = location.getAvailableServices();
        String locationName = location.getName();
        if (availableServicelist.containsAll(serviceName) == true) {
            if (locationName.contains("West US") == true) {
                vmLocation = locationName;
            }// ww w.  j  a v  a2 s  .c  om
            if (vmLocation == null) {
                vmLocation = locationName;
            }
        }
    }
}

From source file:org.openmrs.web.dwr.DWRProviderServiceTest.java

/**
 * @see DWRProviderService#findProvider(String,boolean,Integer,Integer)
 * @verifies return the list of providers matching the search name
 *///from   w ww  .ja va2 s  . co  m
@Test
public void findProvider_shouldReturnTheListOfProvidersMatchingTheSearchName() throws Exception {

    Vector<Object> providers = service.findProvider("provider", false, 0, 10);
    Assert.assertEquals(2, providers.size());

    final ArrayList<String> providerNames = new ArrayList<String>();

    CollectionUtils.forAllDo(providers, new Closure() {

        @Override
        public void execute(Object input) {
            providerNames.add(((ProviderListItem) input).getDisplayName());
        }
    });

    Assert.assertTrue(providerNames.containsAll(Arrays.asList("Bruno Otterbourg", "Hippocrates of Cos")));
}

From source file:com.facebook.login.GetTokenLoginMethodHandler.java

void getTokenCompleted(LoginClient.Request request, Bundle result) {
    if (getTokenClient != null) {
        getTokenClient.setCompletedListener(null);
    }//from   w  w  w.  j ava  2 s  . c  om
    getTokenClient = null;

    loginClient.notifyBackgroundProcessingStop();

    if (result != null) {
        ArrayList<String> currentPermissions = result.getStringArrayList(NativeProtocol.EXTRA_PERMISSIONS);
        Set<String> permissions = request.getPermissions();
        if ((currentPermissions != null)
                && ((permissions == null) || currentPermissions.containsAll(permissions))) {
            // We got all the permissions we needed, so we can complete the auth now.
            complete(request, result);
            return;
        }

        // We didn't get all the permissions we wanted, so update the request with just the
        // permissions we still need.
        Set<String> newPermissions = new HashSet<String>();
        for (String permission : permissions) {
            if (!currentPermissions.contains(permission)) {
                newPermissions.add(permission);
            }
        }
        if (!newPermissions.isEmpty()) {
            addLoggingExtra(LoginLogger.EVENT_EXTRAS_NEW_PERMISSIONS, TextUtils.join(",", newPermissions));
        }

        request.setPermissions(newPermissions);
    }

    loginClient.tryNextHandler();
}

From source file:net.i2cat.netconf.test.BaseNetconfTest.java

@Test
public void testCapabilities() {

    ArrayList<Capability> activeCapabilities = session.getActiveCapabilities();
    ArrayList<Capability> clientCapabilities = session.getClientCapabilities();
    ArrayList<Capability> serverCapabilities = session.getServerCapabilities();

    assertTrue("Base capability must be supported and active", activeCapabilities.contains(Capability.BASE));
    assertTrue("There is an active capability that we don't support",
            clientCapabilities.containsAll(activeCapabilities));
    assertTrue("There is an active capability that the server doesn't support",
            serverCapabilities.containsAll(activeCapabilities));

    ArrayList<Capability> commonCapabilities = new ArrayList<Capability>(clientCapabilities);
    commonCapabilities.retainAll(serverCapabilities);

    assertTrue("Active capabilities equal common client/server capabilities",
            commonCapabilities.containsAll(activeCapabilities)
                    && activeCapabilities.containsAll(commonCapabilities));
}

From source file:administraScan.OrganizaDirectorios.java

public void copiarCompletos() throws IOException {
    FileUtils Files = new FileUtils();
    AdministraScan adm = new AdministraScan();
    File origen;/* w  w  w . jav a2 s . c  om*/
    File destino;
    File f = new File(conf.carpetaCT);
    ArrayList<String> cts = new ArrayList<>(Arrays.asList(f.list()));
    for (String ct : cts) {
        String dirCT = conf.carpetaCT + ct.trim();
        File dir_expedientes = new File(dirCT);
        ArrayList<String> curps = new ArrayList<>(Arrays.asList(dir_expedientes.list()));
        for (String curp : curps) {
            String dircurp = dirCT + "\\" + curp.trim();
            File doc = new File(dircurp);
            ArrayList<String> documentos = new ArrayList<>(Arrays.asList(doc.list()));
            ArrayList<String> claves = adm.RetornaCT(documentos);
            ArrayList<String> obli_cedula = new ArrayList<>(Arrays.asList(conf.DOC_R));
            obli_cedula.remove("CUGE");
            boolean completo_cedula = claves.containsAll(obli_cedula)
                    && (claves.contains("CPL") || claves.contains("CPM") || claves.contains("CPD"))
                    && !claves.contains("CUGE");
            if (claves.containsAll(conf.OBLIGATORIOS) || completo_cedula) {
                String clave = "";
                String nombre_ss = "";
                clave = ct.substring(3, 5);
                this.conectarbd();
                String consultaDescripcionSS = "Select descripcion from cg_nivel_educativo where nivel_educativo = ?";
                try {
                    PreparedStatement SPreparada;
                    SPreparada = connection.prepareStatement(consultaDescripcionSS);
                    SPreparada.setString(1, clave);
                    ResultSet resultadoDescripcion = SPreparada.executeQuery();
                    if (resultadoDescripcion.next()) {
                        nombre_ss = resultadoDescripcion.getString("descripcion").trim();
                    }
                    SPreparada.close();
                    connection.close();

                } catch (SQLException ex) {
                    Logger.getLogger(OrganizaDirectorios.class.getName()).log(Level.SEVERE, null, ex);
                }
                String ruta_destino = conf.carpetaRemota + "completos\\" + nombre_ss + "\\" + ct.trim();
                origen = new File(dircurp);
                destino = new File(ruta_destino);
                File destino_final = new File(ruta_destino + "\\" + curp.trim());
                if (!destino_final.exists()) {
                    Files.copyDirectoryToDirectory(doc, destino);
                    System.out.println(
                            "Movi carpeta: " + doc.getAbsolutePath() + " a " + destino_final.getAbsolutePath());
                }
            }
        }
    }
}