Permalink
Browse files

Transformed loaded for Application into new interface format

  • Loading branch information...
1 parent 609886c commit f29ce2d7ddae19425df794a7ee50ca6fba196c69 Gianfranco committed Jun 30, 2011
Showing with 16 additions and 3 deletions.
  1. +13 −1 src/frame_axiom.erl
  2. +3 −2 test/frame_axiom_tests.erl
View
@@ -115,8 +115,13 @@ snapshot(Ets,application,started) ->
snapshot(Ets,application,stopped) ->
Running = [element(1,A)||A<-application:which_applications()],
ets:insert(Ets,{{application,stopped},Running}),
+ Ets;
+snapshot(Ets,application,loaded) ->
+ Loaded = [element(1,A)||A<-application:loaded_applications()],
+ ets:insert(Ets,{{application,loaded},Loaded}),
Ets.
+
diff(Ets,[X]) ->
diff(Ets,X);
@@ -242,7 +247,14 @@ diff(Ets,application,stopped) ->
Running = [element(1,A)||A<-application:which_applications()],
Key = {application,stopped},
[{Key,Recorded}] = ets:lookup(Ets,Key),
- [{stopped,S}||S<-Recorded,not lists:member(S,Running)].
+ [{stopped,S}||S<-Recorded,not lists:member(S,Running)];
+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)].
+
+
@@ -147,10 +147,11 @@ application_stop_diff_test() ->
?assertEqual([{stopped,snmp}],frame_axiom:diff(Ref,[{application,Options}])).
application_load_diff_test() ->
+ Options = [loaded],
application:unload(snmp),
- Ref = frame_axiom:snapshot(application),
+ Ref = frame_axiom:snapshot([{application,Options}]),
application:load(snmp),
- ?assertEqual([{loaded,snmp}],frame_axiom:diff(Ref,application,load_unload)).
+ ?assertEqual([{loaded,snmp}],frame_axiom:diff(Ref,[{application,Options}])).
application_unload_diff_test() ->
application:load(snmp),

0 comments on commit f29ce2d

Please sign in to comment.