Convert aos over to flatbuffers

Everything builds, and all the tests pass.  I suspect that some entries
are missing from the config files, but those will be found pretty
quickly on startup.

There is no logging or live introspection of queue messages.

Change-Id: I496ee01ed68f202c7851bed7e8786cee30df29f5
diff --git a/aos/configuration_test.cc b/aos/configuration_test.cc
index 0f13041..e20b308 100644
--- a/aos/configuration_test.cc
+++ b/aos/configuration_test.cc
@@ -4,6 +4,8 @@
 #include "aos/json_to_flatbuffer.h"
 #include "aos/testing/test_logging.h"
 #include "aos/util/file.h"
+#include "flatbuffers/reflection.h"
+#include "glog/logging.h"
 #include "gtest/gtest.h"
 
 namespace aos {
@@ -25,7 +27,7 @@
 TEST_F(ConfigurationTest, ConfigMerge) {
   FlatbufferDetachedBuffer<Configuration> config =
       ReadConfig("aos/testdata/config1.json");
-  printf("Read: %s\n", FlatbufferToJson(config, true).c_str());
+  LOG(INFO) << "Read: " << FlatbufferToJson(config, true);
 
   EXPECT_EQ(
       absl::StripSuffix(
@@ -33,6 +35,19 @@
       FlatbufferToJson(config, true));
 }
 
+// Tests that we sort the entries in a config so we can look entries up.
+TEST_F(ConfigurationTest, UnsortedConfig) {
+  FlatbufferDetachedBuffer<Configuration> config =
+      ReadConfig("aos/testdata/backwards.json");
+
+  LOG(INFO) << "Read: " << FlatbufferToJson(config, true);
+
+  EXPECT_EQ(FlatbufferToJson(GetChannel(config, ".aos.robot_state",
+                                        "aos.RobotState", "app1")),
+            "{ \"name\": \".aos.robot_state\", \"type\": \"aos.RobotState\", "
+            "\"max_size\": 5 }");
+}
+
 // Tests that we die when a file is imported twice.
 TEST_F(ConfigurationDeathTest, DuplicateFile) {
   EXPECT_DEATH(