Search in sources :

Example 1 with Agent

use of com.arnaugarcia.uplace.domain.Agent in project uplace.es by Uplace.

the class AgentResourceIntTest method createEntity.

/**
 * Create an entity for this test.
 *
 * This is a static method, as tests for other entities might also need it,
 * if they test an entity which requires the current entity.
 */
public static Agent createEntity(EntityManager em) {
    User user = UserResourceIntTest.createEntity(em);
    Agent agent = new Agent().firstName(DEFAULT_FIRST_NAME).lastName(DEFAULT_LAST_NAME).phone(DEFAULT_PHONE).photo(DEFAULT_PHOTO).photoContentType(DEFAULT_PHOTO_CONTENT_TYPE).user(user);
    return agent;
}
Also used : Agent(com.arnaugarcia.uplace.domain.Agent) User(com.arnaugarcia.uplace.domain.User)

Example 2 with Agent

use of com.arnaugarcia.uplace.domain.Agent in project uplace.es by Uplace.

the class AgentResourceIntTest method createAgent.

@Test
@Transactional
@Ignore
public void createAgent() throws Exception {
    int databaseSizeBeforeCreate = agentRepository.findAll().size();
    // Create the Agent
    restAgentMockMvc.perform(post("/api/agents").contentType(TestUtil.APPLICATION_JSON_UTF8).content(TestUtil.convertObjectToJsonBytes(agent))).andExpect(status().isCreated());
    // Validate the Agent in the database
    List<Agent> agentList = agentRepository.findAll();
    assertThat(agentList).hasSize(databaseSizeBeforeCreate + 1);
    Agent testAgent = agentList.get(agentList.size() - 1);
    assertThat(testAgent.getFirstName()).isEqualTo(DEFAULT_FIRST_NAME);
    assertThat(testAgent.getLastName()).isEqualTo(DEFAULT_LAST_NAME);
    assertThat(testAgent.getPhone()).isEqualTo(DEFAULT_PHONE);
    assertThat(testAgent.getPhoto()).isEqualTo(DEFAULT_PHOTO);
    assertThat(testAgent.getPhotoContentType()).isEqualTo(DEFAULT_PHOTO_CONTENT_TYPE);
}
Also used : Agent(com.arnaugarcia.uplace.domain.Agent) Ignore(org.junit.Ignore) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) Transactional(org.springframework.transaction.annotation.Transactional)

Example 3 with Agent

use of com.arnaugarcia.uplace.domain.Agent in project uplace.es by Uplace.

the class AgentResourceIntTest method updateAgent.

@Test
@Transactional
@Ignore
public void updateAgent() throws Exception {
    // Initialize the database
    agentService.save(agent);
    int databaseSizeBeforeUpdate = agentRepository.findAll().size();
    // Update the agent
    Agent updatedAgent = agentRepository.findOne(agent.getId());
    // Disconnect from session so that the updates on updatedAgent are not directly saved in db
    em.detach(updatedAgent);
    updatedAgent.firstName(UPDATED_FIRST_NAME).lastName(UPDATED_LAST_NAME).phone(UPDATED_PHONE).photo(UPDATED_PHOTO).photoContentType(UPDATED_PHOTO_CONTENT_TYPE);
    restAgentMockMvc.perform(put("/api/agents").contentType(TestUtil.APPLICATION_JSON_UTF8).content(TestUtil.convertObjectToJsonBytes(updatedAgent))).andExpect(status().isOk());
    // Validate the Agent in the database
    List<Agent> agentList = agentRepository.findAll();
    assertThat(agentList).hasSize(databaseSizeBeforeUpdate);
    Agent testAgent = agentList.get(agentList.size() - 1);
    assertThat(testAgent.getFirstName()).isEqualTo(UPDATED_FIRST_NAME);
    assertThat(testAgent.getLastName()).isEqualTo(UPDATED_LAST_NAME);
    assertThat(testAgent.getPhone()).isEqualTo(UPDATED_PHONE);
    assertThat(testAgent.getPhoto()).isEqualTo(UPDATED_PHOTO);
    assertThat(testAgent.getPhotoContentType()).isEqualTo(UPDATED_PHOTO_CONTENT_TYPE);
}
Also used : Agent(com.arnaugarcia.uplace.domain.Agent) Ignore(org.junit.Ignore) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) Transactional(org.springframework.transaction.annotation.Transactional)

Example 4 with Agent

use of com.arnaugarcia.uplace.domain.Agent in project uplace.es by Uplace.

the class AgentResourceIntTest method equalsVerifier.

@Test
@Transactional
public void equalsVerifier() throws Exception {
    TestUtil.equalsVerifier(Agent.class);
    Agent agent1 = new Agent();
    agent1.setId(1L);
    Agent agent2 = new Agent();
    agent2.setId(agent1.getId());
    assertThat(agent1).isEqualTo(agent2);
    agent2.setId(2L);
    assertThat(agent1).isNotEqualTo(agent2);
    agent1.setId(null);
    assertThat(agent1).isNotEqualTo(agent2);
}
Also used : Agent(com.arnaugarcia.uplace.domain.Agent) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) Transactional(org.springframework.transaction.annotation.Transactional)

Example 5 with Agent

use of com.arnaugarcia.uplace.domain.Agent in project uplace.es by Uplace.

the class PropertyResourceIntTest method getAllPropertiesByManagerIsEqualToSomething.

@Test
@Transactional
public void getAllPropertiesByManagerIsEqualToSomething() throws Exception {
    // Initialize the database
    Agent manager = AgentResourceIntTest.createEntity(em);
    em.persist(manager);
    em.flush();
    property.addManager(manager);
    propertyRepository.saveAndFlush(property);
    Long managerId = manager.getId();
    // Get all the propertyList where manager equals to managerId
    defaultPropertyShouldBeFound("managerId.equals=" + managerId);
    // Get all the propertyList where manager equals to managerId + 1
    defaultPropertyShouldNotBeFound("managerId.equals=" + (managerId + 1));
}
Also used : Agent(com.arnaugarcia.uplace.domain.Agent) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

Agent (com.arnaugarcia.uplace.domain.Agent)8 Test (org.junit.Test)4 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)4 Transactional (org.springframework.transaction.annotation.Transactional)4 Timed (com.codahale.metrics.annotation.Timed)3 Ignore (org.junit.Ignore)2 User (com.arnaugarcia.uplace.domain.User)1 BadRequestAlertException (com.arnaugarcia.uplace.web.rest.errors.BadRequestAlertException)1 URI (java.net.URI)1