protected void assertSetEList(List<?> prototypeList) { EList<Object> eList = new BasicEList<Object>(); ECollections.setEList(eList, prototypeList); assertTrue("Empty list test", TestUtil.areEqual(prototypeList, eList)); eList = new BasicEList<Object>(); eList.add(0, "String"); eList.add(Boolean.FALSE); ECollections.setEList(eList, prototypeList); assertTrue("Smaller list test", TestUtil.areEqual(prototypeList, eList)); eList = (EList<Object>) populateList(new BasicEList<Object>()); ECollections.setEList(eList, prototypeList); assertTrue("Same list test", TestUtil.areEqual(prototypeList, eList)); eList.remove(2); eList.add(3, this); ECollections.setEList(eList, prototypeList); assertTrue("Equal size list test", TestUtil.areEqual(prototypeList, eList)); eList.add(0, "String"); eList.add(2, Boolean.FALSE); eList.add(Boolean.FALSE); eList.add(this); ECollections.setEList(eList, prototypeList); assertTrue("Bigger list test", TestUtil.areEqual(prototypeList, eList)); }
@Override public EList<Office> getOffices() { List<Office> prototypeList = Activator.getDefault().getOffices(); EList<Office> eList = new BasicEList<Office>(prototypeList.size()); ECollections.setEList(eList, prototypeList); return eList; }
@Override public EList<Office> loadOffices() { List<FCICredentials> creds = new ArrayList<FCICredentials>(); // Get the preference store IPreferenceStore preferenceStore = Activator.getDefault().getPreferenceStore(); int accountsnum = preferenceStore.getInt("AccountNums"); for (int i = 0; i < accountsnum; i++) { FCICredentials cred = FederationOffice.fcielements.FcielementsFactory.eINSTANCE.createFCICredentials(); EMap<String, String> opts = cred.getCredoptions(); opts.put(SFAUtils.REGISTRY_URL, preferenceStore.getString("REGISTRYURL_" + i)); opts.put(SFAUtils.AM_URL, preferenceStore.getString("AGGREGATEURL_" + i)); opts.put(SFAUtils.SM_URL, preferenceStore.getString("SLICEMGRURL_" + i)); opts.put(SFAUtils.KEYSTORE_FILEPATH, preferenceStore.getString("KEYSTORE_" + i)); opts.put(SFAUtils.KEYSTORE_PASSWORD, preferenceStore.getString("KEYSTOREPASSWORD_" + i)); opts.put(SFAUtils.TRUSTSTORE_FILEPATH, preferenceStore.getString("TRUSTSTORE_" + i)); opts.put(SFAUtils.TRUSTSTORE_PASSWORD, preferenceStore.getString("TRUSTSTOREPASSWORD_" + i)); opts.put(SFAUtils.AUTHORITY, preferenceStore.getString("AUTHORITY_" + i)); opts.put(SFAUtils.USERNAME, preferenceStore.getString("USERNAME_" + i)); opts.put( SFAUtils.SELF_CERTIFICATE_FILEPATH, preferenceStore.getString("CERTIFICATEFILENAME_" + i)); opts.put(SFAUtils.SFA_VERSION, preferenceStore.getString("SFAVERSION_" + i)); opts.put(SFAUtils.SFA_TYPE, preferenceStore.getString("SFATYPE_" + i)); opts.put(SFAUtils.ENABLED_ACCOUND, preferenceStore.getString("ENABLEDACCOUNT_" + i)); opts.put(SFAUtils.CACHE_MODEL, preferenceStore.getString("CACHEMODEL_" + i)); if (preferenceStore.getBoolean( "ENABLEDACCOUNT_" + i)) // only if the account is enabled then load it creds.add(cred); } List<Office> prototypeList = Activator.getDefault().loadSFAOfficesDescriptions(creds); EList<Office> eList = new BasicEList<Office>(prototypeList.size()); ECollections.setEList(eList, prototypeList); return eList; }