use of co.cask.cdap.WordCountApp in project cdap by caskdata.
the class DefaultStoreTest method testRemoveAll.
@Test
public void testRemoveAll() throws Exception {
ApplicationSpecification spec = Specifications.from(new WordCountApp());
NamespaceId namespaceId = new NamespaceId("account1");
ApplicationId appId = namespaceId.app("application1");
store.addApplication(appId, spec);
Assert.assertNotNull(store.getApplication(appId));
// removing flow
store.removeAll(namespaceId);
Assert.assertNull(store.getApplication(appId));
}
use of co.cask.cdap.WordCountApp in project cdap by caskdata.
the class DefaultStoreTest method testRemoveApplication.
@Test
public void testRemoveApplication() throws Exception {
ApplicationSpecification spec = Specifications.from(new WordCountApp());
NamespaceId namespaceId = new NamespaceId("account1");
ApplicationId appId = namespaceId.app(spec.getName());
store.addApplication(appId, spec);
Assert.assertNotNull(store.getApplication(appId));
// removing application
store.removeApplication(appId);
Assert.assertNull(store.getApplication(appId));
}
use of co.cask.cdap.WordCountApp in project cdap by caskdata.
the class PreferencesHttpHandlerTest method testApplication.
@Test
public void testApplication() throws Exception {
addApplication(TEST_NAMESPACE1, new WordCountApp());
Map<String, String> propMap = Maps.newHashMap();
Assert.assertEquals(propMap, getProperty(getURI(TEST_NAMESPACE1, "WordCountApp"), false, 200));
Assert.assertEquals(propMap, getProperty(getURI(TEST_NAMESPACE1, "WordCountApp"), true, 200));
getProperty(getURI(TEST_NAMESPACE1, "InvalidAppName"), false, 404);
setProperty(getURI(), ImmutableMap.of("k1", "instance"), 200);
setProperty(getURI(TEST_NAMESPACE1), ImmutableMap.of("k1", "namespace"), 200);
setProperty(getURI(TEST_NAMESPACE1, "WordCountApp"), ImmutableMap.of("k1", "application"), 200);
Assert.assertEquals("application", getProperty(getURI(TEST_NAMESPACE1, "WordCountApp"), false, 200).get("k1"));
Assert.assertEquals("application", getProperty(getURI(TEST_NAMESPACE1, "WordCountApp"), true, 200).get("k1"));
Assert.assertEquals("namespace", getProperty(getURI(TEST_NAMESPACE1), false, 200).get("k1"));
Assert.assertEquals("namespace", getProperty(getURI(TEST_NAMESPACE1), true, 200).get("k1"));
Assert.assertEquals("instance", getProperty(getURI(), true, 200).get("k1"));
Assert.assertEquals("instance", getProperty(getURI(), false, 200).get("k1"));
deleteProperty(getURI(TEST_NAMESPACE1, "WordCountApp"), 200);
Assert.assertEquals("namespace", getProperty(getURI(TEST_NAMESPACE1, "WordCountApp"), true, 200).get("k1"));
Assert.assertNull(getProperty(getURI(TEST_NAMESPACE1, "WordCountApp"), false, 200).get("k1"));
deleteProperty(getURI(TEST_NAMESPACE1), 200);
Assert.assertEquals("instance", getProperty(getURI(TEST_NAMESPACE1, "WordCountApp"), true, 200).get("k1"));
Assert.assertEquals("instance", getProperty(getURI(TEST_NAMESPACE1), true, 200).get("k1"));
Assert.assertNull(getProperty(getURI(TEST_NAMESPACE1), false, 200).get("k1"));
deleteProperty(getURI(), 200);
Assert.assertNull(getProperty(getURI(), true, 200).get("k1"));
Assert.assertNull(getProperty(getURI(TEST_NAMESPACE1), true, 200).get("k1"));
Assert.assertNull(getProperty(getURI(TEST_NAMESPACE1, "WordCountApp"), true, 200).get("k1"));
}
use of co.cask.cdap.WordCountApp in project cdap by caskdata.
the class PreferencesHttpHandlerTest method testProgram.
@Test
public void testProgram() throws Exception {
addApplication(TEST_NAMESPACE2, new WordCountApp());
Map<String, String> propMap = Maps.newHashMap();
Assert.assertEquals(propMap, getProperty(getURI(TEST_NAMESPACE2, "WordCountApp", "flows", "WordCountFlow"), false, 200));
getProperty(getURI(TEST_NAMESPACE2, "WordCountApp", "invalidType", "somename"), false, 400);
getProperty(getURI(TEST_NAMESPACE2, "WordCountApp", "flows", "somename"), false, 404);
propMap.put("k1", "k349*&#$");
setProperty(getURI(TEST_NAMESPACE2, "WordCountApp", "flows", "WordCountFlow"), propMap, 200);
Assert.assertEquals(propMap, getProperty(getURI(TEST_NAMESPACE2, "WordCountApp", "flows", "WordCountFlow"), false, 200));
propMap.put("k1", "instance");
setProperty(getURI(), propMap, 200);
Assert.assertEquals(propMap, getProperty(getURI(), true, 200));
propMap.put("k1", "k349*&#$");
Assert.assertEquals(propMap, getProperty(getURI(TEST_NAMESPACE2, "WordCountApp", "flows", "WordCountFlow"), false, 200));
deleteProperty(getURI(TEST_NAMESPACE2, "WordCountApp", "flows", "WordCountFlow"), 200);
propMap.put("k1", "instance");
Assert.assertEquals(0, getProperty(getURI(TEST_NAMESPACE2, "WordCountApp", "flows", "WordCountFlow"), false, 200).size());
Assert.assertEquals(propMap, getProperty(getURI(TEST_NAMESPACE2, "WordCountApp", "flows", "WordCountFlow"), true, 200));
deleteProperty(getURI(), 200);
propMap.clear();
Assert.assertEquals(propMap, getProperty(getURI(TEST_NAMESPACE2, "WordCountApp", "flows", "WordCountFlow"), false, 200));
Assert.assertEquals(propMap, getProperty(getURI(), false, 200));
}
use of co.cask.cdap.WordCountApp in project cdap by caskdata.
the class DefaultStoreTest method testAddApplication.
@Test
public void testAddApplication() throws Exception {
ApplicationSpecification spec = Specifications.from(new WordCountApp());
ApplicationId appId = new ApplicationId("account1", "application1");
store.addApplication(appId, spec);
ApplicationSpecification stored = store.getApplication(appId);
assertWordCountAppSpecAndInMetadataStore(stored);
}
Aggregations