@Test public void testFindProfileSpec() throws JSONException { DevicePluginContext pluginContext = Mockito.mock(DevicePluginContext.class); String jsonString = FileLoader.readString("testProfile.json"); DConnectServiceSpec spec = new DConnectServiceSpec(pluginContext); spec.addProfileSpec("testProfile", jsonString); Operation operation = spec.findOperationSpec(Method.GET, "/gotapi/testProfile"); assertThat(operation, is(notNullValue())); operation = spec.findOperationSpec(Method.GET, "/gotapi/testProfile/"); assertThat(operation, is(notNullValue())); operation = spec.findOperationSpec(Method.GET, "/gotapi/testProfile/a0"); assertThat(operation, is(notNullValue())); operation = spec.findOperationSpec(Method.GET, "/gotapi/testProfile/a0/"); assertThat(operation, is(notNullValue())); operation = spec.findOperationSpec(Method.GET, "/gotapi/testProfile/a1"); assertThat(operation, is(notNullValue())); operation = spec.findOperationSpec(Method.GET, "/gotapi/testProfile/a1/"); assertThat(operation, is(notNullValue())); }
public Swagger findProfileSpec(final String profileName) { if (profileName == null) { return null; } synchronized (mProfileSpecs) { return mProfileSpecs.get(profileName.toLowerCase()); } }
DConnectServiceSpec { public Swagger findProfileSpec(final String profileName) { if (profileName == null) { return null; } synchronized (mProfileSpecs) { return mProfileSpecs.get(profileName.toLowerCase()); } } }
DConnectServiceSpec { public Swagger findProfileSpec(final String profileName) { if (profileName == null) { return null; } synchronized (mProfileSpecs) { return mProfileSpecs.get(profileName.toLowerCase()); } } DConnectServiceSpec(DevicePluginContext pluginContext); }
DConnectServiceSpec { public Swagger findProfileSpec(final String profileName) { if (profileName == null) { return null; } synchronized (mProfileSpecs) { return mProfileSpecs.get(profileName.toLowerCase()); } } DConnectServiceSpec(DevicePluginContext pluginContext); Map<String, Swagger> getProfileSpecs(); void addProfileSpec(final String profileName); void addProfileSpec(final String profileName, final String jsonString); Swagger removeProfileSpec(final String profileName); Swagger findProfileSpec(final String profileName); Path findPathSpec(String path); Path findPathSpec(Intent request); Operation findOperationSpec(Method method, String path); Operation findOperationSpec(Method method, String profileName, String attributeName); Operation findOperationSpec(Method method, String profileName, String interfaceName, String attributeName); Operation findOperationSpec(Method method, String apiName, String profileName, String interfaceName, String attributeName); Operation findOperationSpec(Intent request); }
DConnectServiceSpec { public Swagger findProfileSpec(final String profileName) { if (profileName == null) { return null; } synchronized (mProfileSpecs) { return mProfileSpecs.get(profileName.toLowerCase()); } } DConnectServiceSpec(DevicePluginContext pluginContext); Map<String, Swagger> getProfileSpecs(); void addProfileSpec(final String profileName); void addProfileSpec(final String profileName, final String jsonString); Swagger removeProfileSpec(final String profileName); Swagger findProfileSpec(final String profileName); Path findPathSpec(String path); Path findPathSpec(Intent request); Operation findOperationSpec(Method method, String path); Operation findOperationSpec(Method method, String profileName, String attributeName); Operation findOperationSpec(Method method, String profileName, String interfaceName, String attributeName); Operation findOperationSpec(Method method, String apiName, String profileName, String interfaceName, String attributeName); Operation findOperationSpec(Intent request);  }