use of br.com.caelum.vraptor.environment.Environment in project mamute by caelum.
the class ScriptSessionCreator method buildEnv.
private Environment buildEnv() {
Environment env;
try {
String envName = System.getenv("DATAIMPORT_ENV");
if (isNullOrEmpty(envName)) {
envName = firstNonNull(System.getProperty(ENVIRONMENT_PROPERTY), "development");
}
env = new DefaultEnvironment(new EnvironmentType(envName));
LOG.info("using env '" + envName + "' for script session creator");
return env;
} catch (IOException e) {
throw new RuntimeException(e);
}
}
use of br.com.caelum.vraptor.environment.Environment in project mamute by caelum.
the class TagsValidatorTest method setup.
@Before
public void setup() {
environment = mock(Environment.class);
when(environment.get("tags.sanitizer.regex")).thenReturn("[a-zA-Z0-9-]");
messageFactory = new MessageFactory(bundle);
validator = new MockValidator();
tagsValidator = new TagsValidator(environment, validator, messageFactory);
User user = user("any", "any@brutal.com");
java = new Tag("java", "", user);
ruby = new Tag("ruby", "", user);
rails = new Tag("rails", "", user);
nonalpha = new Tag("java,mysql", "", user);
}
use of br.com.caelum.vraptor.environment.Environment in project mamute by caelum.
the class QuestionIndexProviderTest method should_build_solr_question_index.
@Test
public void should_build_solr_question_index() throws Exception {
Environment env = mock(Environment.class);
when(env.get(eq("feature.solr"), anyString())).thenReturn("true");
Instance<SolrServer> instance = mock(Instance.class);
Iterator<SolrServer> iterator = mock(Iterator.class);
when(instance.iterator()).thenReturn(iterator);
QuestionIndexProvider provider = new QuestionIndexProvider(env, instance);
QuestionIndex build = provider.build();
assertTrue(SolrQuestionIndex.class.isInstance(build));
}
use of br.com.caelum.vraptor.environment.Environment in project mamute by caelum.
the class QuestionIndexProviderTest method should_build_null_question_index.
@Test
public void should_build_null_question_index() throws Exception {
Environment env = mock(Environment.class);
when(env.get(eq("feature.solr"), anyString())).thenReturn("false");
Instance<SolrServer> instance = mock(Instance.class);
QuestionIndexProvider provider = new QuestionIndexProvider(env, instance);
QuestionIndex build = provider.build();
assertTrue(NullQuestionIndex.class.isInstance(build));
}
Aggregations