use of com.agiletec.aps.system.common.entity.model.attribute.MonoTextAttribute in project entando-core by entando.
the class UserProfileManagerIntegrationTest method createProfile.
private IUserProfile createProfile(String name, String surname, String email, Date birthdate, String language) {
IUserProfile profile = this._profileManager.getDefaultProfileType();
MonoTextAttribute nameAttr = (MonoTextAttribute) profile.getAttribute("fullname");
nameAttr.setText(name + " " + surname);
MonoTextAttribute emailAttr = (MonoTextAttribute) profile.getAttribute("email");
emailAttr.setText(email);
DateAttribute birthdateAttr = (DateAttribute) profile.getAttribute("birthdate");
birthdateAttr.setDate(birthdate);
MonoTextAttribute languageAttr = (MonoTextAttribute) profile.getAttribute("language");
languageAttr.setText(language);
((UserProfile) profile).setPublicProfile(true);
return profile;
}
use of com.agiletec.aps.system.common.entity.model.attribute.MonoTextAttribute in project entando-core by entando.
the class UserProfileManagerIntegrationTest method testAddProfile.
public void testAddProfile() throws Throwable {
String username = "admin";
Date birthdate = this.getBirthdate(1982, 10, 25);
IUserProfile profile = this.createProfile("stefano", "puddu", "spuddu@agiletec.it", birthdate, "it");
try {
this._profileManager.addProfile("admin", profile);
IUserProfile added = this._profileManager.getProfile(username);
assertEquals("spuddu@agiletec.it", added.getValue("email"));
assertEquals(username, added.getUsername());
MonoTextAttribute emailAttr = (MonoTextAttribute) ((IUserProfile) profile).getAttribute("email");
emailAttr.setText("agiletectest@gmail.com");
this._profileManager.updateProfile(profile.getUsername(), profile);
IUserProfile updated = this._profileManager.getProfile(username);
assertEquals("agiletectest@gmail.com", updated.getValue("email"));
assertEquals(username, added.getUsername());
} catch (Throwable t) {
throw t;
} finally {
this._profileManager.deleteProfile(username);
assertNull(this._profileManager.getProfile(username));
}
}
use of com.agiletec.aps.system.common.entity.model.attribute.MonoTextAttribute in project entando-core by entando.
the class UserProfileManagerTest method testAddProfile.
@Test
public void testAddProfile() throws ApsSystemException {
// @formatter:off
when(entityTypeFactory.extractEntityType(SystemConstants.DEFAULT_PROFILE_TYPE_CODE, UserProfile.class, configItemName, this.entityTypeDom, userProfileManager.getName(), this.entityDom)).thenReturn(this.createFakeProfile(SystemConstants.DEFAULT_PROFILE_TYPE_CODE));
// @formatter:on
IUserProfile userProfile = userProfileManager.getDefaultProfileType();
String name = "Jack_Bower";
MonoTextAttribute attribute = (MonoTextAttribute) userProfile.getAttribute("Name");
attribute.setText(name);
this.userProfileManager.addProfile(name, userProfile);
assertThat(userProfile.getId(), is(name));
Mockito.verify(userProfileDAO, Mockito.times(1)).addEntity(userProfile);
Mockito.verify(notifyManager, Mockito.times(1)).publishEvent(Mockito.any(ProfileChangedEvent.class));
}
use of com.agiletec.aps.system.common.entity.model.attribute.MonoTextAttribute in project entando-core by entando.
the class UserProfileManagerTest method createFakeProfile.
private IApsEntity createFakeProfile(String defaultProfileTypeCode) {
UserProfile userProfile = new UserProfile();
MonoTextAttribute monoTextAttribute = new MonoTextAttribute();
monoTextAttribute.setName("Name");
monoTextAttribute.setHandler(new MonoTextAttributeHandler());
userProfile.addAttribute(monoTextAttribute);
userProfile.setTypeCode(defaultProfileTypeCode);
return userProfile;
}
use of com.agiletec.aps.system.common.entity.model.attribute.MonoTextAttribute in project entando-core by entando.
the class TestContentDAO method getMockContent.
private Content getMockContent() {
Content content = this._contentManager.createContentType("ART");
content.setId("temp");
content.setMainGroup(Group.FREE_GROUP_NAME);
content.addGroup("firstGroup");
content.addGroup("secondGroup");
content.addGroup("thirdGroup");
AttributeInterface attribute = new MonoTextAttribute();
attribute.setName("temp");
attribute.setDefaultLangCode("it");
attribute.setRenderingLang("it");
attribute.setSearchable(true);
attribute.setType("Monotext");
content.addAttribute(attribute);
content.setDefaultLang("it");
content.setDefaultModel("content_viewer");
content.setDescription("temp");
content.setListModel("Monolist");
content.setRenderingLang("it");
content.setStatus("Bozza");
content.setTypeCode("ART");
content.setTypeDescription("Articolo rassegna stampa");
return content;
}
Aggregations