Skip to content

Commit

Permalink
FORGE-2319: No need to check if facet is installed before firing event
Browse files Browse the repository at this point in the history
  • Loading branch information
gastaldi committed Jun 17, 2015
1 parent e48fb1f commit 082a390
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -214,13 +214,8 @@ public boolean accept(FACETTYPE type)
else if (FacetInspector.isConstraintSatisfied(faceted, requiredFacets) && filter.accept(facet))
try
{
boolean installed = facet.isInstalled();
result = ((MutableFaceted<FACETTYPE>) faceted).install(facet);
// Fire only if Facet#install() was called
if (!installed && facet.isInstalled())
{
fireFacetInstalled(facet);
}
fireFacetInstalled(facet);
}
catch (Exception e)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,10 @@ public FacetInstalledImpl(Facet<?> facet)
{
super(facet);
}

@Override
public String toString()
{
return "FacetInstalled [" + getFacet() + "]";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public void processEvent(FacetEvent event)
}

@Test
public void testAlreadyInstallFacetsShouldNotFireEvents()
public void testFacetAlreadyInstalledShouldNotFireEvents()
{
final List<FacetEvent> facetEvents = new ArrayList<>();
ListenerRegistration<FacetListener> registration = facetFactory
Expand Down

0 comments on commit 082a390

Please sign in to comment.