Skip to content
Browse files

Transformd application unloaded to the new interface format

  • Loading branch information...
1 parent f29ce2d commit 2cf94a3999c24db7936658c249026dec22d5eac4 Gianfranco committed Jun 30, 2011
Showing with 16 additions and 5 deletions.
  1. +13 −3 src/frame_axiom.erl
  2. +3 −2 test/frame_axiom_tests.erl
View
16 src/frame_axiom.erl
@@ -119,10 +119,13 @@ snapshot(Ets,application,stopped) ->
snapshot(Ets,application,loaded) ->
Loaded = [element(1,A)||A<-application:loaded_applications()],
ets:insert(Ets,{{application,loaded},Loaded}),
+ Ets;
+snapshot(Ets,application,unloaded) ->
+ Loaded = [element(1,A)||A<-application:loaded_applications()],
+ ets:insert(Ets,{{application,unloaded},Loaded}),
Ets.
-
-
+
diff(Ets,[X]) ->
diff(Ets,X);
diff(Ets,DiffSpecs) when is_list(DiffSpecs) ->
@@ -252,7 +255,14 @@ diff(Ets,application,loaded) ->
Loaded = [element(1,A)||A<-application:loaded_applications()],
Key = {application,loaded},
[{Key,Recorded}] = ets:lookup(Ets,Key),
- [{loaded,L}||L<-Loaded,not lists:member(L,Recorded)].
+ [{loaded,L}||L<-Loaded,not lists:member(L,Recorded)];
+diff(Ets,application,unloaded) ->
+ Loaded = [element(1,A)||A<-application:loaded_applications()],
+ Key = {application,unloaded},
+ [{Key,Recorded}] = ets:lookup(Ets,Key),
+ [{unloaded,U}||U<-Recorded,not lists:member(U,Loaded)].
+
+
View
5 test/frame_axiom_tests.erl
@@ -154,10 +154,11 @@ application_load_diff_test() ->
?assertEqual([{loaded,snmp}],frame_axiom:diff(Ref,[{application,Options}])).
application_unload_diff_test() ->
+ Options = [unloaded],
application:load(snmp),
- Ref = frame_axiom:snapshot(application),
+ Ref = frame_axiom:snapshot([{application,Options}]),
application:unload(snmp),
- ?assertEqual([{unloaded,snmp}],frame_axiom:diff(Ref,application,load_unload)).
+ ?assertEqual([{unloaded,snmp}],frame_axiom:diff(Ref,[{application,Options}])).
application_load_no_change_diff_test() ->
Ref = frame_axiom:snapshot(application),

0 comments on commit 2cf94a3

Please sign in to comment.
Something went wrong with that request. Please try again.