use of com.aws.greengrass.dependency.Context in project aws-greengrass-nucleus by aws-greengrass.
the class MergeTest method testSomeMethod.
@Test
void testSomeMethod() throws Exception {
try (Context context = new Context()) {
Configuration c = new Configuration(context);
c.read(Kernel.class.getResource("config.yaml"), false);
Configuration b = new Configuration(context).copyFrom(c);
assertEquals(c.getRoot(), b.getRoot());
}
}
use of com.aws.greengrass.dependency.Context in project aws-greengrass-nucleus by aws-greengrass.
the class ShellRunnerTest method beforeEach.
@BeforeEach
void beforeEach() throws IOException {
context = new Context();
Topics config = initializeMockedConfig();
Topics servicePrivateTopics = mock(Topics.class);
Topic mockTopic = mock(Topic.class);
when(config.lookupTopics(GreengrassService.PRIVATE_STORE_NAMESPACE_TOPIC)).thenReturn(servicePrivateTopics);
when(servicePrivateTopics.findLeafChild(SERVICE_UNIQUE_ID_KEY)).thenReturn(uniqueId);
when(servicePrivateTopics.createLeafChild(anyString())).thenReturn(mockTopic);
when(mockTopic.withParentNeedsToKnow(false)).thenReturn(mockTopic);
when(nucleusPaths.workPath(any())).thenReturn(tempDir);
lenient().when(nucleusPaths.workPath()).thenReturn(tempDir);
greengrassService = new GreengrassService(config);
context.put(NucleusPaths.class, nucleusPaths);
context.put(DeviceConfiguration.class, mock(DeviceConfiguration.class));
}
use of com.aws.greengrass.dependency.Context in project aws-greengrass-nucleus by aws-greengrass.
the class KernelConfigResolverTest method setupMocks.
@BeforeEach
void setupMocks() throws IOException {
path = Paths.get("Artifacts", TEST_INPUT_PACKAGE_A);
lenient().when(nucleusPaths.artifactPath(any())).thenReturn(path.toAbsolutePath());
config = new Configuration(new Context());
lenient().when(kernel.getConfig()).thenReturn(config);
lenient().when(deviceConfiguration.getNucleusComponentName()).thenReturn(DEFAULT_NUCLEUS_COMPONENT_NAME);
lenient().when(deviceConfiguration.getThingName()).thenReturn(config.lookup("thingname").withValue(THE_THINGNAME));
}
use of com.aws.greengrass.dependency.Context in project aws-greengrass-nucleus by aws-greengrass.
the class DependencyResolverTest method setupTopics.
@BeforeEach
void setupTopics() throws Exception {
context = new Context();
groupToTargetComponentsTopics = Topics.of(context, GROUP_TO_ROOT_COMPONENTS_TOPICS, null);
ComponentRecipe componentRecipe = mock(ComponentRecipe.class);
lenient().when(componentRecipe.getComponentType()).thenReturn(ComponentType.GENERIC);
lenient().when(componentStore.getPackageRecipe(any())).thenReturn(componentRecipe);
}
use of com.aws.greengrass.dependency.Context in project aws-greengrass-nucleus by aws-greengrass.
the class AuthorizationPolicyParserTest method readConfig.
private void readConfig(String filename) throws IOException {
realConfig = new Configuration(new Context());
try (InputStream inputStream = getClass().getResourceAsStream(filename)) {
assertNotNull(inputStream);
realConfig.mergeMap(0, new YAMLMapper().readValue(inputStream, Map.class));
}
when(kernel.getConfig()).thenReturn(realConfig);
}
Aggregations