NEMOparser implements NEMOparserConstants { static final public String Query(UserId userId, DataBroker dataBroker, TenantManage tenantManage) throws ParseException { String strReturn = null; Token objItemToken = null; Token objTargetToken = null; Query query = new Query(tenantManage); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case TYPE: objItemToken = jj_consume_token(TYPE); break; case CONTAIN: objItemToken = jj_consume_token(CONTAIN); break; case PROPERTY: objItemToken = jj_consume_token(PROPERTY); break; case ENDNODES: objItemToken = jj_consume_token(ENDNODES); break; case MATCH: objItemToken = jj_consume_token(MATCH); break; case PRIORITY: objItemToken = jj_consume_token(PRIORITY); break; case TARGET: objItemToken = jj_consume_token(TARGET); break; case CONDITION: objItemToken = jj_consume_token(CONDITION); break; case ACTION: objItemToken = jj_consume_token(ACTION); break; case ID: objItemToken = jj_consume_token(ID); break; case NODES: objItemToken = jj_consume_token(NODES); break; case CONNECTIONS: objItemToken = jj_consume_token(CONNECTIONS); break; case FLOWS: objItemToken = jj_consume_token(FLOWS); break; case OPERATIONS: objItemToken = jj_consume_token(OPERATIONS); break; default: jj_la1[53] = jj_gen; jj_consume_token(-1); throw new ParseException(); } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case FROM: jj_consume_token(FROM); objTargetToken = jj_consume_token(ID); break; default: jj_la1[54] = jj_gen; ; } jj_consume_token(SEMICOLON); if (objTargetToken == null) { String target = null; {if (true) return query.query(userId,objItemToken.image,target);} } else { {if (true) return query.query(userId,objItemToken.image,objTargetToken.image);} } throw new Error("Missing return statement in function"); } NEMOparser(java.io.InputStream stream);  NEMOparser(java.io.InputStream stream, String encoding);  NEMOparser(java.io.Reader stream);  NEMOparser(NEMOparserTokenManager tm); String parseNEMO(UserId userId,String strNEMO, DataBroker dataBroker, TenantManage tenantManage); static final String NEMO(UserId userId, DataBroker dataBroker, TenantManage tenantManage); static final String UpdateIntent(UserId userId, DataBroker dataBroker, TenantManage tenantManage); static final String DeleteIntent(UserId userId, DataBroker dataBroker, TenantManage tenantManage); static final String UpdateNode(UserId userId, DataBroker dataBroker, TenantManage tenantManage); static final String UpdateConnection(UserId userId, DataBroker dataBroker, TenantManage tenantManage); static final String UpdateFlow(UserId userId, DataBroker dataBroker, TenantManage tenantManage); static final String UpdateOperation(UserId userId, DataBroker dataBroker, TenantManage tenantManage); static final String NodeModel(UserId userId, DataBroker dataBroker, TenantManage tenantManage); static final String abstractNode(UpdateTemplateDefinitionLang definition); static final String abstractConnection(UpdateTemplateDefinitionLang definition); static final String abstractFlow(UpdateTemplateDefinitionLang definition); static final String abstractOperation(UpdateTemplateDefinitionLang definition); static final String DeleteNode(UserId userId, DataBroker dataBroker, TenantManage tenantManage); static final String DeleteConnection(UserId userId, DataBroker dataBroker, TenantManage tenantManage); static final String DeleteFlow(UserId userId, DataBroker dataBroker, TenantManage tenantManage); static final String DeleteOperation(UserId userId, DataBroker dataBroker, TenantManage tenantManage); static final String Query(UserId userId, DataBroker dataBroker, TenantManage tenantManage); static final LinkedHashMap<String,String> conditionTarget(); static final LinkedHashMap<String,String> property(); static final LinkedHashMap<String,String> nodeMultiProperty(); static void ReInit(java.io.InputStream stream); static void ReInit(java.io.InputStream stream, String encoding); static void ReInit(java.io.Reader stream); void ReInit(NEMOparserTokenManager tm); static final Token getNextToken(); static final Token getToken(int index); static ParseException generateParseException(); static final void enable_tracing(); static final void disable_tracing(); static public NEMOparserTokenManager token_source; static public Token token; static public Token jj_nt; }
@Test public void testQuery() throws Exception { UserId userId = mock(UserId.class); DataBroker dataBroker = mock(DataBroker.class); TenantManage tenantManage = mock(TenantManage.class); Field field_jj_ntk = class1.getDeclaredField("jj_ntk"); field_jj_ntk.setAccessible(true); Field field_token = class1.getDeclaredField("token"); field_token.setAccessible(true); Token token1 = new Token(); Token token2 = new Token(); Token token3 = new Token(); token1.next = token2; token2.next = token3; token3.kind = NEMOparserConstants.SEMICOLON; token2.kind = NEMOparserConstants.TYPE; token2.image = "1"; field_token.set(class1,token1); field_jj_ntk.set(class1, NEMOparserConstants.TYPE); Assert.assertTrue(NEMOparser.Query(userId,dataBroker,tenantManage).equals("The item is not supported.")); token2.kind = NEMOparserConstants.CONTAIN; token2.image = "2"; field_token.set(class1,token1); field_jj_ntk.set(class1, NEMOparserConstants.CONTAIN); Assert.assertTrue(NEMOparser.Query(userId,dataBroker,tenantManage).equals("The item is not supported.")); token2.kind = NEMOparserConstants.PROPERTY; token2.image = "2"; field_token.set(class1,token1); field_jj_ntk.set(class1, NEMOparserConstants.PROPERTY); Assert.assertTrue(NEMOparser.Query(userId,dataBroker,tenantManage).equals("The item is not supported.")); token2.kind = NEMOparserConstants.ENDNODES; token2.image = "2"; field_token.set(class1,token1); field_jj_ntk.set(class1, NEMOparserConstants.ENDNODES); Assert.assertTrue(NEMOparser.Query(userId,dataBroker,tenantManage).equals("The item is not supported.")); token2.kind = NEMOparserConstants.MATCH; token2.image = "2"; field_token.set(class1,token1); field_jj_ntk.set(class1, NEMOparserConstants.MATCH); Assert.assertTrue(NEMOparser.Query(userId,dataBroker,tenantManage).equals("The item is not supported.")); token2.kind = NEMOparserConstants.PRIORITY; token2.image = "2"; field_token.set(class1,token1); field_jj_ntk.set(class1, NEMOparserConstants.PRIORITY); Assert.assertTrue(NEMOparser.Query(userId,dataBroker,tenantManage).equals("The item is not supported.")); token2.kind = NEMOparserConstants.TARGET; token2.image = "2"; field_token.set(class1,token1); field_jj_ntk.set(class1, NEMOparserConstants.TARGET); Assert.assertTrue(NEMOparser.Query(userId,dataBroker,tenantManage).equals("The item is not supported.")); token2.kind = NEMOparserConstants.CONDITION; token2.image = "2"; field_token.set(class1,token1); field_jj_ntk.set(class1, NEMOparserConstants.CONDITION); Assert.assertTrue(NEMOparser.Query(userId,dataBroker,tenantManage).equals("The item is not supported.")); token2.kind = NEMOparserConstants.ACTION; token2.image = "2"; field_token.set(class1,token1); field_jj_ntk.set(class1, NEMOparserConstants.ACTION); Assert.assertTrue(NEMOparser.Query(userId,dataBroker,tenantManage).equals("The item is not supported.")); token2.kind = NEMOparserConstants.ID; token2.image = "2"; field_token.set(class1,token1); field_jj_ntk.set(class1, NEMOparserConstants.ID); Assert.assertTrue(NEMOparser.Query(userId,dataBroker,tenantManage).equals("The item is not supported.")); token2.kind = NEMOparserConstants.NODES; token2.image = "2"; field_token.set(class1,token1); field_jj_ntk.set(class1, NEMOparserConstants.NODES); Assert.assertTrue(NEMOparser.Query(userId,dataBroker,tenantManage).equals("The item is not supported.")); token2.kind = NEMOparserConstants.CONNECTIONS; token2.image = "2"; field_token.set(class1,token1); field_jj_ntk.set(class1, NEMOparserConstants.CONNECTIONS); Assert.assertTrue(NEMOparser.Query(userId,dataBroker,tenantManage).equals("The item is not supported.")); token2.kind = NEMOparserConstants.FLOWS; token2.image = "2"; field_token.set(class1,token1); field_jj_ntk.set(class1, NEMOparserConstants.FLOWS); Assert.assertTrue(NEMOparser.Query(userId,dataBroker,tenantManage).equals("The item is not supported.")); token2.kind = NEMOparserConstants.OPERATIONS; token2.image = "2"; field_token.set(class1,token1); field_jj_ntk.set(class1, NEMOparserConstants.OPERATIONS); Assert.assertTrue(NEMOparser.Query(userId,dataBroker,tenantManage).equals("The item is not supported.")); }