public static ConfigDefinitionKey createConfigDefinitionKeyFromDefFile(File file) throws IOException {
        String[] fileName = file.getName().split("\\.");
        assert (fileName.length >= 2);
        String name = fileName[fileName.length - 2];
        byte[] content = IOUtils.readFileBytes(file);

        return createConfigDefinitionKeyFromDefContent(name, content);
    }
@Test
    public void testCreateConfigDefinitionKeyFromDefFile() {
        ConfigDefinitionKey def = null;
        try {
            def = ConfigUtils.createConfigDefinitionKeyFromDefFile(new File("src/test/resources/configs/def-files/app.def"));
        } catch (IOException e) {
            e.printStackTrace();
            fail();
        }
        assertEquals("app", def.getName());
        assertEquals("foo", def.getNamespace());

        try {
            def = ConfigUtils.createConfigDefinitionKeyFromDefFile(new File("src/test/resources/configs/def-files/testnamespace.def"));
        } catch (IOException e) {
            e.printStackTrace();
            fail();
        }
        assertEquals("testnamespace", def.getName());
        assertEquals("foo", def.getNamespace());

        try {
            byte[] content = IOUtils.readFileBytes(new File("src/test/resources/configs/def-files/app.def"));
            def = ConfigUtils.createConfigDefinitionKeyFromDefContent("app", content);
        } catch (IOException e) {
            fail();
        }
        assertEquals("app", def.getName());
        assertEquals("foo", def.getNamespace());

        try {
            byte[] content = IOUtils.readFileBytes(new File("src/test/resources/configs/def-files-nogen/app.def"));
            def = ConfigUtils.createConfigDefinitionKeyFromDefContent("app", content);
        } catch (IOException e) {
            fail();
        }
        assertEquals("app", def.getName());
        assertEquals("mynamespace", def.getNamespace());
    }