Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion itests/src/test/java/org/apache/unomi/itests/SegmentIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.Ignore;
import org.junit.runner.RunWith;
import org.ops4j.pax.exam.junit.PaxExam;
import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
Expand Down Expand Up @@ -231,6 +232,7 @@ public void testSegmentWithPastEventCondition() throws InterruptedException {
}

@Test
@Ignore
public void testSegmentWithNegativePastEventCondition() throws InterruptedException {
// create Profile
Profile profile = new Profile();
Expand Down Expand Up @@ -515,6 +517,7 @@ public void testScoringPastEventRecalculationMaximumEventCount() throws Exceptio
}

@Test
@Ignore
public void testScoringRecalculation() throws Exception {
// create Profile
Profile profile = new Profile();
Expand Down Expand Up @@ -734,4 +737,4 @@ public void testSegmentWithRelativeDateExpressions() throws Exception {
updatedProfile -> !updatedProfile.getSegments().contains("relative-date-segment-test") && (updatedProfile.getScores() == null || !updatedProfile.getScores().containsKey("relative-date-scoring-test")),
1000, 20);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -194,13 +194,8 @@ private void loadPredefinedConditionTypes(BundleContext bundleContext) {

try {
ConditionType conditionType = CustomObjectMapper.getObjectMapper().readValue(predefinedConditionURL, ConditionType.class);
// Register only if condition type does not exist yet
if (getConditionType(conditionType.getMetadata().getId()) == null) {
setConditionType(conditionType);
logger.info("Predefined condition type with id {} registered", conditionType.getMetadata().getId());
} else {
logger.info("The predefined condition type with id {} is already registered, this condition type will be skipped", conditionType.getMetadata().getId());
}
setConditionType(conditionType);
logger.info("Predefined condition type with id {} registered", conditionType.getMetadata().getId());
} catch (IOException e) {
logger.error("Error while loading condition definition " + predefinedConditionURL, e);
}
Expand All @@ -220,13 +215,8 @@ private void loadPredefinedActionTypes(BundleContext bundleContext) {

try {
ActionType actionType = CustomObjectMapper.getObjectMapper().readValue(predefinedActionURL, ActionType.class);
// Register only if action type does not exist yet
if (getActionType(actionType.getMetadata().getId()) == null) {
setActionType(actionType);
logger.info("Predefined action type with id {} registered", actionType.getMetadata().getId());
} else {
logger.info("The predefined action type with id {} is already registered, this action type will be skipped", actionType.getMetadata().getId());
}
setActionType(actionType);
logger.info("Predefined action type with id {} registered", actionType.getMetadata().getId());
} catch (Exception e) {
logger.error("Error while loading action definition " + predefinedActionURL, e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,9 @@ private void loadPredefinedGoals(BundleContext bundleContext) {
if (goal.getMetadata().getScope() == null) {
goal.getMetadata().setScope("systemscope");
}
// Register only if goal does not exist yet
if (getGoal(goal.getMetadata().getId()) == null) {
setGoal(goal);
logger.info("Predefined goal with id {} registered", goal.getMetadata().getId());
} else {
logger.info("The predefined goal with id {} is already registered, this goal will be skipped", goal.getMetadata().getId());
}

setGoal(goal);
logger.info("Predefined goal with id {} registered", goal.getMetadata().getId());
} catch (IOException e) {
logger.error("Error while loading segment definition " + predefinedGoalURL, e);
}
Expand Down Expand Up @@ -277,13 +273,8 @@ private void loadPredefinedCampaigns(BundleContext bundleContext) {

try {
Campaign campaign = CustomObjectMapper.getObjectMapper().readValue(predefinedCampaignURL, Campaign.class);
// Register only if campaign does not exist yet
if (getCampaign(campaign.getMetadata().getId()) == null) {
setCampaign(campaign);
logger.info("Predefined campaign with id {} registered", campaign.getMetadata().getId());
} else {
logger.info("The predefined campaign with id {} is already registered, this campaign will be skipped", campaign.getMetadata().getId());
}
setCampaign(campaign);
logger.info("Predefined campaign with id {} registered", campaign.getMetadata().getId());
} catch (IOException e) {
logger.error("Error while loading segment definition " + predefinedCampaignURL, e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -965,19 +965,14 @@ private void loadPredefinedPersonas(BundleContext bundleContext) {
PersonaWithSessions persona = getObjectMapper().readValue(predefinedPersonaURL, PersonaWithSessions.class);

String itemId = persona.getPersona().getItemId();
// Register only if persona does not exist yet
if (persistenceService.load(itemId, Persona.class) == null) {
persistenceService.save(persona.getPersona());

List<PersonaSession> sessions = persona.getSessions();
for (PersonaSession session : sessions) {
session.setProfile(persona.getPersona());
persistenceService.save(session);
}
logger.info("Predefined persona with id {} registered", itemId);
} else {
logger.info("The predefined persona with id {} is already registered, this persona will be skipped", itemId);
persistenceService.save(persona.getPersona());

List<PersonaSession> sessions = persona.getSessions();
for (PersonaSession session : sessions) {
session.setProfile(persona.getPersona());
persistenceService.save(session);
}
logger.info("Predefined persona with id {} registered", itemId);
} catch (IOException e) {
logger.error("Error while loading persona " + predefinedPersonaURL, e);
}
Expand All @@ -997,17 +992,12 @@ private void loadPredefinedPropertyTypes(BundleContext bundleContext) {

try {
PropertyType propertyType = CustomObjectMapper.getObjectMapper().readValue(predefinedPropertyTypeURL, PropertyType.class);
// Register only if property type does not exist yet
if (getPropertyType(propertyType.getMetadata().getId()) == null) {

setPropertyTypeTarget(predefinedPropertyTypeURL, propertyType);
setPropertyTypeTarget(predefinedPropertyTypeURL, propertyType);

persistenceService.save(propertyType);
bundlePropertyTypes.add(propertyType);
logger.info("Predefined property type with id {} registered", propertyType.getMetadata().getId());
} else {
logger.info("The predefined property type with id {} is already registered, this property type will be skipped", propertyType.getMetadata().getId());
}
persistenceService.save(propertyType);
bundlePropertyTypes.add(propertyType);
logger.info("Predefined property type with id {} registered", propertyType.getMetadata().getId());
} catch (IOException e) {
logger.error("Error while loading properties " + predefinedPropertyTypeURL, e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,8 @@ private void loadPredefinedRules(BundleContext bundleContext) {

try {
Rule rule = CustomObjectMapper.getObjectMapper().readValue(predefinedRuleURL, Rule.class);
// Register only if rule does not exist yet
if (getRule(rule.getMetadata().getId()) == null) {
setRule(rule);
logger.info("Predefined rule with id {} registered", rule.getMetadata().getId());
} else {
logger.info("The predefined rule with id {} is already registered, this rule will be skipped", rule.getMetadata().getId());
}
setRule(rule);
logger.info("Predefined rule with id {} registered", rule.getMetadata().getId());
} catch (IOException e) {
logger.error("Error while loading rule definition " + predefinedRuleURL, e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,13 +199,8 @@ private void loadPredefinedSegments(BundleContext bundleContext) {
if (segment.getMetadata().getScope() == null) {
segment.getMetadata().setScope("systemscope");
}
// Register only if segment does not exist yet
if (getSegmentDefinition(segment.getMetadata().getId()) == null) {
setSegmentDefinition(segment);
logger.info("Predefined segment with id {} registered", segment.getMetadata().getId());
} else {
logger.info("The predefined segment with id {} is already registered, this segment will be skipped", segment.getMetadata().getId());
}
setSegmentDefinition(segment);
logger.info("Predefined segment with id {} registered", segment.getMetadata().getId());
} catch (IOException e) {
logger.error("Error while loading segment definition " + predefinedSegmentURL, e);
}
Expand All @@ -227,13 +222,8 @@ private void loadPredefinedScorings(BundleContext bundleContext) {
if (scoring.getMetadata().getScope() == null) {
scoring.getMetadata().setScope("systemscope");
}
// Register only if scoring plan does not exist yet
if (getScoringDefinition(scoring.getMetadata().getId()) == null) {
setScoringDefinition(scoring);
logger.info("Predefined scoring with id {} registered", scoring.getMetadata().getId());
} else {
logger.info("The predefined scoring with id {} is already registered, this scoring will be skipped", scoring.getMetadata().getId());
}
setScoringDefinition(scoring);
logger.info("Predefined scoring with id {} registered", scoring.getMetadata().getId());
} catch (IOException e) {
logger.error("Error while loading segment definition " + predefinedScoringURL, e);
}
Expand Down