Search in sources :

Example 1 with GenericPreferenceValueFactory

use of org.apache.qpid.server.model.preferences.GenericPreferenceValueFactory in project qpid-broker-j by apache.

the class LatestManagementControllerTest method createPreferences.

private UUID createPreferences(final Subject testSubject, final QueueManagingVirtualHost<?> virtualHost, final String preferenceType, final String preferenceName, final Map<String, Object> preferenceValue) throws Exception {
    UUID uuid = UUID.randomUUID();
    final Preference preference = new PreferenceImpl(virtualHost, uuid, preferenceName, preferenceType, "Some preference", null, new Date(), new Date(), null, new GenericPreferenceValueFactory().createInstance(preferenceValue));
    final List<Preference> preferenceList = Collections.singletonList(preference);
    final Future<Void> result = Subject.doAs(testSubject, (PrivilegedAction<Future<Void>>) () -> virtualHost.getUserPreferences().updateOrAppend(preferenceList));
    result.get(2000L, TimeUnit.MILLISECONDS);
    return uuid;
}
Also used : GenericPreferenceValueFactory(org.apache.qpid.server.model.preferences.GenericPreferenceValueFactory) Preference(org.apache.qpid.server.model.preferences.Preference) Future(java.util.concurrent.Future) UUID(java.util.UUID) PreferenceImpl(org.apache.qpid.server.model.preferences.PreferenceImpl) Date(java.util.Date)

Aggregations

Date (java.util.Date)1 UUID (java.util.UUID)1 Future (java.util.concurrent.Future)1 GenericPreferenceValueFactory (org.apache.qpid.server.model.preferences.GenericPreferenceValueFactory)1 Preference (org.apache.qpid.server.model.preferences.Preference)1 PreferenceImpl (org.apache.qpid.server.model.preferences.PreferenceImpl)1